Class: StereoAudioRecorder

© Muaz Khan . @WebRTCWeb . Github . Latest issues . What's New?

new StereoAudioRecorder(mediaStream, config)

JavaScript standalone object for stereo audio recording.

StereoAudioRecorder is a standalone class used by RecordRTC to bring "stereo" audio-recording in chrome.
Parameters:
Name Type Description
mediaStream MediaStream MediaStream object fetched using getUserMedia API or generated using captureStreamUntilEnded or WebAudio API.
config object {sampleRate: 44100, bufferSize: 4096, numberOfAudioChannels: 1, etc.}
Author:
License:
Source:
See:
Example
var recorder = new StereoAudioRecorder(MediaStream, {
    sampleRate: 44100,
    bufferSize: 4096
});
recorder.record();
recorder.stop(function(blob) {
    video.src = URL.createObjectURL(blob);
});

Members

(static) bufferSize

From the spec: This value controls how frequently the audioprocess event is dispatched and how many sample-frames need to be processed each call. Lower values for buffer size will result in a lower (better) latency. Higher values will be necessary to avoid audio breakup and glitches The size of the buffer (in sample-frames) which needs to be processed each time onprocessaudio is called. Legal values are (256, 512, 1024, 2048, 4096, 8192, 16384).
Properties:
Name Type Description
bufferSize number Buffer-size for how frequently the audioprocess event is dispatched.
Source:
Example
recorder = new StereoAudioRecorder(mediaStream, {
    bufferSize: 4096
});

(static) sampleRate

The sample rate (in sample-frames per second) at which the AudioContext handles audio. It is assumed that all AudioNodes in the context run at this rate. In making this assumption, sample-rate converters or "varispeed" processors are not supported in real-time processing. The sampleRate parameter describes the sample-rate of the linear PCM audio data in the buffer in sample-frames per second. An implementation must support sample-rates in at least the range 22050 to 96000.
Properties:
Name Type Description
sampleRate number Buffer-size for how frequently the audioprocess event is dispatched.
Source:
Example
recorder = new StereoAudioRecorder(mediaStream, {
    sampleRate: 44100
});

(static) self.blob

Properties:
Name Type Description
blob Blob The recorded blob object.
Source:
Example
recorder.stop(function(){
    var blob = recorder.blob;
});

(static) self.buffer

Properties:
Name Type Description
buffer ArrayBuffer The recorded buffer object.
Source:
Example
recorder.stop(function(){
    var buffer = recorder.buffer;
});

(static) self.view

Properties:
Name Type Description
view DataView The recorded data-view object.
Source:
Example
recorder.stop(function(){
    var view = recorder.view;
});

Methods

(static) this.clearRecordedData()

This method resets currently recorded data.
Source:
Example
recorder.clearRecordedData();

(static) this.pause()

This method pauses the recording process.
Source:
Example
recorder.pause();

(static) this.record()

This method records MediaStream.
Source:
Example
recorder.record();

(static) this.resume()

This method resumes the recording process.
Source:
Example
recorder.resume();

(static) this.stop(callback)

This method stops recording MediaStream.
Parameters:
Name Type Description
callback function Callback function, that is used to pass recorded blob back to the callee.
Source:
Example
recorder.stop(function(blob) {
    video.src = URL.createObjectURL(blob);
});

(static) {function} onAudioProcessStarted()

This method is called on "onaudioprocess" event's first invocation.
Source:
Example
recorder.onAudioProcessStarted: function() { };

Help Improve Documentation

Enter your email too; if you want "direct" reply!