RecordRTCPromisesHandler(mediaStream, config)

new RecordRTCPromisesHandler(mediaStream, config)

Promises for RecordRTC

RecordRTCPromisesHandler adds promises support in RecordRTC. Try a demo here

Parameters:
Name Type Description
mediaStream MediaStream

Single media-stream object, array of media-streams, html-canvas-element, etc.

config object

{type:"video", recorderType: MediaStreamRecorder, disableLogs: true, numberOfAudioChannels: 1, bufferSize: 0, sampleRate: 0, video: HTMLVideoElement, etc.}

Author:
License:
Source:
See:
Requires:
Throws:

Will throw an error if "new" keyword is not used to initiate "RecordRTCPromisesHandler". Also throws error if first argument "MediaStream" is missing.

Example
var recorder = new RecordRTCPromisesHandler(mediaStream, options);
recorder.startRecording()
        .then(successCB)
        .catch(errorCB);
// Note: You can access all RecordRTC API using "recorder.recordRTC" e.g. 
recorder.recordRTC.onStateChanged = function(state) {};
recorder.recordRTC.setRecordingDuration(5000);

Requires

Members

(static) self.recordRTC

Properties:
Name Type Description
blob Blob

Access/reach the native RecordRTC object.

Source:
Example
let internal = recorder.recordRTC.getInternalRecorder();
alert(internal instanceof MediaStreamRecorder);
recorder.recordRTC.onStateChanged = function(state) {};

(static) self.recordRTC

Properties:
Name Type Description
blob Blob

Access/reach the native RecordRTC object.

Source:
Example
let internal = recorder.recordRTC.getInternalRecorder();
alert(internal instanceof MediaStreamRecorder);
recorder.recordRTC.onStateChanged = function(state) {};

(static) this.blob

Properties:
Name Type Description
blob Blob

Recorded data as "Blob" object.

Source:
Example
await recorder.stopRecording();
let blob = recorder.getBlob(); // or "recorder.recordRTC.blob"
invokeSaveAsDialog(blob);

(static) this.blob

Properties:
Name Type Description
blob Blob

Recorded data as "Blob" object.

Source:
Example
await recorder.stopRecording();
let blob = recorder.getBlob(); // or "recorder.recordRTC.blob"
invokeSaveAsDialog(blob);

Methods

(static) this.destroy()

Destroy RecordRTC instance. Clear all recorders and objects.

Source:
Example
recorder.destroy().then(successCB).catch(errorCB);

(static) this.destroy()

Destroy RecordRTC instance. Clear all recorders and objects.

Source:
Example
recorder.destroy().then(successCB).catch(errorCB);

(static) this.getBlob()

This method returns the recorded blob.

Source:
Example
recorder.stopRecording().then(function() {
    recorder.getBlob().then(function(blob) {})
}).catch(errorCB);

(static) this.getBlob()

This method returns the recorded blob.

Source:
Example
recorder.stopRecording().then(function() {
    recorder.getBlob().then(function(blob) {})
}).catch(errorCB);

(static) this.getDataURL()

This method returns data-url for the recorded blob.

Source:
Example
recorder.stopRecording().then(function() {
    recorder.getDataURL().then(function(dataURL) {
        window.open(dataURL);
    }).catch(errorCB);;
}).catch(errorCB);

(static) this.getDataURL()

This method returns data-url for the recorded blob.

Source:
Example
recorder.stopRecording().then(function() {
    recorder.getDataURL().then(function(dataURL) {
        window.open(dataURL);
    }).catch(errorCB);;
}).catch(errorCB);

(static) this.getInternalRecorder() → {Object}

Destroy RecordRTC instance. Clear all recorders and objects.

Source:
Returns:

Returns internal recording object.

Type
Object
Example
let internalRecorder = await recorder.getInternalRecorder();
if(internalRecorder instanceof MultiStreamRecorder) {
    internalRecorder.addStreams([newAudioStream]);
    internalRecorder.resetVideoStreams([screenStream]);
}

(static) this.getInternalRecorder() → {Object}

Destroy RecordRTC instance. Clear all recorders and objects.

Source:
Returns:

Returns internal recording object.

Type
Object
Example
let internalRecorder = await recorder.getInternalRecorder();
if(internalRecorder instanceof MultiStreamRecorder) {
    internalRecorder.addStreams([newAudioStream]);
    internalRecorder.resetVideoStreams([screenStream]);
}

(static) this.getState() → {String}

Get recorder's readonly state.

Source:
Returns:

Returns recording state.

Type
String
Example
let state = await recorder.getState();
// or
recorder.getState().then(state => { console.log(state); })

(static) this.getState() → {String}

Get recorder's readonly state.

Source:
Returns:

Returns recording state.

Type
String
Example
let state = await recorder.getState();
// or
recorder.getState().then(state => { console.log(state); })

(static) this.pauseRecording()

This method pauses the recording. You can resume recording using "resumeRecording" method.

Source:
Example
recorder.pauseRecording()
        .then(successCB)
        .catch(errorCB);

(static) this.pauseRecording()

This method pauses the recording. You can resume recording using "resumeRecording" method.

Source:
Example
recorder.pauseRecording()
        .then(successCB)
        .catch(errorCB);

(static) this.reset()

This method resets the recorder. So that you can reuse single recorder instance many times.

Source:
Example
await recorder.reset();
recorder.startRecording(); // record again

(static) this.reset()

This method resets the recorder. So that you can reuse single recorder instance many times.

Source:
Example
await recorder.reset();
recorder.startRecording(); // record again

(static) this.resumeRecording()

This method resumes the recording.

Source:
Example
recorder.resumeRecording()
        .then(successCB)
        .catch(errorCB);

(static) this.resumeRecording()

This method resumes the recording.

Source:
Example
recorder.resumeRecording()
        .then(successCB)
        .catch(errorCB);

(static) this.startRecording()

This method records MediaStream.

Source:
Example
recorder.startRecording()
        .then(successCB)
        .catch(errorCB);

(static) this.startRecording()

This method records MediaStream.

Source:
Example
recorder.startRecording()
        .then(successCB)
        .catch(errorCB);

(static) this.stopRecording()

This method stops the recording.

Source:
Example
recorder.stopRecording().then(function() {
    var blob = recorder.getBlob();
}).catch(errorCB);

(static) this.stopRecording()

This method stops the recording.

Source:
Example
recorder.stopRecording().then(function() {
    var blob = recorder.getBlob();
}).catch(errorCB);

RecordRTCPromisesHandler(mediaStream, config)

new RecordRTCPromisesHandler(mediaStream, config)

Promises for RecordRTC

RecordRTCPromisesHandler adds promises support in RecordRTC. Try a demo here

Parameters:
Name Type Description
mediaStream MediaStream

Single media-stream object, array of media-streams, html-canvas-element, etc.

config object

{type:"video", recorderType: MediaStreamRecorder, disableLogs: true, numberOfAudioChannels: 1, bufferSize: 0, sampleRate: 0, video: HTMLVideoElement, etc.}

Author:
License:
Source:
See:
Requires:
Throws:

Will throw an error if "new" keyword is not used to initiate "RecordRTCPromisesHandler". Also throws error if first argument "MediaStream" is missing.

Example
var recorder = new RecordRTCPromisesHandler(mediaStream, options);
recorder.startRecording()
        .then(successCB)
        .catch(errorCB);
// Note: You can access all RecordRTC API using "recorder.recordRTC" e.g. 
recorder.recordRTC.onStateChanged = function(state) {};
recorder.recordRTC.setRecordingDuration(5000);

Requires

Members

(static) self.recordRTC

Properties:
Name Type Description
blob Blob

Access/reach the native RecordRTC object.

Source:
Example
let internal = recorder.recordRTC.getInternalRecorder();
alert(internal instanceof MediaStreamRecorder);
recorder.recordRTC.onStateChanged = function(state) {};

(static) self.recordRTC

Properties:
Name Type Description
blob Blob

Access/reach the native RecordRTC object.

Source:
Example
let internal = recorder.recordRTC.getInternalRecorder();
alert(internal instanceof MediaStreamRecorder);
recorder.recordRTC.onStateChanged = function(state) {};

(static) this.blob

Properties:
Name Type Description
blob Blob

Recorded data as "Blob" object.

Source:
Example
await recorder.stopRecording();
let blob = recorder.getBlob(); // or "recorder.recordRTC.blob"
invokeSaveAsDialog(blob);

(static) this.blob

Properties:
Name Type Description
blob Blob

Recorded data as "Blob" object.

Source:
Example
await recorder.stopRecording();
let blob = recorder.getBlob(); // or "recorder.recordRTC.blob"
invokeSaveAsDialog(blob);

Methods

(static) this.destroy()

Destroy RecordRTC instance. Clear all recorders and objects.

Source:
Example
recorder.destroy().then(successCB).catch(errorCB);

(static) this.destroy()

Destroy RecordRTC instance. Clear all recorders and objects.

Source:
Example
recorder.destroy().then(successCB).catch(errorCB);

(static) this.getBlob()

This method returns the recorded blob.

Source:
Example
recorder.stopRecording().then(function() {
    recorder.getBlob().then(function(blob) {})
}).catch(errorCB);

(static) this.getBlob()

This method returns the recorded blob.

Source:
Example
recorder.stopRecording().then(function() {
    recorder.getBlob().then(function(blob) {})
}).catch(errorCB);

(static) this.getDataURL()

This method returns data-url for the recorded blob.

Source:
Example
recorder.stopRecording().then(function() {
    recorder.getDataURL().then(function(dataURL) {
        window.open(dataURL);
    }).catch(errorCB);;
}).catch(errorCB);

(static) this.getDataURL()

This method returns data-url for the recorded blob.

Source:
Example
recorder.stopRecording().then(function() {
    recorder.getDataURL().then(function(dataURL) {
        window.open(dataURL);
    }).catch(errorCB);;
}).catch(errorCB);

(static) this.getInternalRecorder() → {Object}

Destroy RecordRTC instance. Clear all recorders and objects.

Source:
Returns:

Returns internal recording object.

Type
Object
Example
let internalRecorder = await recorder.getInternalRecorder();
if(internalRecorder instanceof MultiStreamRecorder) {
    internalRecorder.addStreams([newAudioStream]);
    internalRecorder.resetVideoStreams([screenStream]);
}

(static) this.getInternalRecorder() → {Object}

Destroy RecordRTC instance. Clear all recorders and objects.

Source:
Returns:

Returns internal recording object.

Type
Object
Example
let internalRecorder = await recorder.getInternalRecorder();
if(internalRecorder instanceof MultiStreamRecorder) {
    internalRecorder.addStreams([newAudioStream]);
    internalRecorder.resetVideoStreams([screenStream]);
}

(static) this.getState() → {String}

Get recorder's readonly state.

Source:
Returns:

Returns recording state.

Type
String
Example
let state = await recorder.getState();
// or
recorder.getState().then(state => { console.log(state); })

(static) this.getState() → {String}

Get recorder's readonly state.

Source:
Returns:

Returns recording state.

Type
String
Example
let state = await recorder.getState();
// or
recorder.getState().then(state => { console.log(state); })

(static) this.pauseRecording()

This method pauses the recording. You can resume recording using "resumeRecording" method.

Source:
Example
recorder.pauseRecording()
        .then(successCB)
        .catch(errorCB);

(static) this.pauseRecording()

This method pauses the recording. You can resume recording using "resumeRecording" method.

Source:
Example
recorder.pauseRecording()
        .then(successCB)
        .catch(errorCB);

(static) this.reset()

This method resets the recorder. So that you can reuse single recorder instance many times.

Source:
Example
await recorder.reset();
recorder.startRecording(); // record again

(static) this.reset()

This method resets the recorder. So that you can reuse single recorder instance many times.

Source:
Example
await recorder.reset();
recorder.startRecording(); // record again

(static) this.resumeRecording()

This method resumes the recording.

Source:
Example
recorder.resumeRecording()
        .then(successCB)
        .catch(errorCB);

(static) this.resumeRecording()

This method resumes the recording.

Source:
Example
recorder.resumeRecording()
        .then(successCB)
        .catch(errorCB);

(static) this.startRecording()

This method records MediaStream.

Source:
Example
recorder.startRecording()
        .then(successCB)
        .catch(errorCB);

(static) this.startRecording()

This method records MediaStream.

Source:
Example
recorder.startRecording()
        .then(successCB)
        .catch(errorCB);

(static) this.stopRecording()

This method stops the recording.

Source:
Example
recorder.stopRecording().then(function() {
    var blob = recorder.getBlob();
}).catch(errorCB);

(static) this.stopRecording()

This method stops the recording.

Source:
Example
recorder.stopRecording().then(function() {
    var blob = recorder.getBlob();
}).catch(errorCB);