AudioBuffer

Source: AudioBuffer.js:37

The AudioBuffer object provides sound recording and replaying to activities.


Constructor

new AudioBuffer(seconds?: number): AudioBuffer

AudioBuffer constructor

Parameters

  • seconds (number, optional) — The maximum amount of time allowed to be recorded by this AudioBuffer

Instance Methods

play()

Starts playing the currently recorded audio, if any.

stop()

Stops the current operation, either recording or playing audio

record($div?: external:jQuery)

Starts recording audio, or stops the recording if already started.

Parameters

  • $div (external:jQuery, optional) — Optional div element where the recording is performed, as a jQuery ref.

visualFeedbak(enabled: boolean, $div?: external:jQuery)

Set visual feedback to the user while the system is recording audio
Currently changes the cursor pointer associated to the HTML element
containing the recorder.

Parameters

  • enabled (boolean) — Flag indicating if the visual feedback should be active or inactive
  • $div (external:jQuery, optional) — Optional div element where the recording is performed, as a jQuery ref.

clear()

Clears all data associated to this AudioBuffer

Instance Fields

enabled: boolean

AudioBuffer is enabled only in browsers with navigator.MediaDevices.getuserMedia

seconds: number

Maximum length of recordings allowed to this AudioBuffer (in seconds)

mediaRecorder: external:MediaRecorder

The object used to record audio data and convert it to a valid stream for the ActiveMediaPlayer

chunks: Array.<external:Blob>

Array of data chunks collected during the recording

mediaPlayer: external:HTMLAudioElement

The HTML audio element used to play the recorded sound

timeoutID: number

The identifier of the timer launched to stop the recording when the maximum time is exceeded.
This member is null when no timeout function is associated to this AudioBuffer

playWhenFinished: boolean

Instructs this AudioBuffer recorder to start playing the collected audio at the end of the
current mediaRecorder task.

Static Fields

MAX_RECORD_LENGTH: number

Maximum amount of time allowed for recordings (in seconds)