Class: MRecordRTC

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

new MRecordRTC(mediaStream)

MRecordRTC stands for "Multiple-RecordRTC".

MRecordRTC runs on top of RecordRTC to bring multiple recordings in a single place, by providing simple API.
Parameters:
Name Type Description
mediaStream MediaStream MediaStream object fetched using getUserMedia API or generated using captureStreamUntilEnded or WebAudio API.
Author:
License:
Source:
See:
Example
var recorder = new MRecordRTC();
recorder.addStream(MediaStream);
recorder.mediaType = {
    audio: true, // or StereoAudioRecorder or MediaStreamRecorder
    video: true, // or WhammyRecorder or MediaStreamRecorder
    gif: true    // or GifRecorder
};
// mimeType is optional and should be set only in advance cases.
recorder.mimeType = {
    audio: 'audio/wav',
    video: 'video/webm',
    gif:   'image/gif'
};
recorder.startRecording();

Members

(static) this.mediaType

This property can be used to set the recording type e.g. audio, or video, or gif, or canvas.
Properties:
Name Type Description
mediaType object {audio: true, video: true, gif: true}
Source:
Example
var recorder = new MRecordRTC();
recorder.mediaType = {
    audio: true, // TRUE or StereoAudioRecorder or MediaStreamRecorder
    video: true, // TRUE or WhammyRecorder or MediaStreamRecorder
    gif  : true  // TRUE or GifRecorder
};

Methods

(static) getFromDisk(type, callback)

This method can be used to get all recorded blobs from IndexedDB storage.
Parameters:
Name Type Description
type string 'all' or 'audio' or 'video' or 'gif'
callback function Callback function to get all stored blobs.
Source:
Example
MRecordRTC.getFromDisk('all', function(dataURL, type){
    if(type === 'audio') { }
    if(type === 'video') { }
    if(type === 'gif')   { }
});

(static) this.addStream(mediaStream)

This method attaches MediaStream object to MRecordRTC.
Parameters:
Name Type Description
mediaStream MediaStream A MediaStream object, either fetched using getUserMedia API, or generated using captureStreamUntilEnded or WebAudio API.
Source:
Example
recorder.addStream(MediaStream);

(static) this.getBlob(callback)

This method can be used to manually get all recorded blobs.
Parameters:
Name Type Description
callback function All recorded blobs are passed back to the "callback" function.
Source:
Example
recorder.getBlob(function(recording){
    var audioBlob = recording.audio;
    var videoBlob = recording.video;
    var gifBlob   = recording.gif;
});
// or
var audioBlob = recorder.getBlob().audio;
var videoBlob = recorder.getBlob().video;

(static) this.getDataURL(callback)

This method can be used to manually get all recorded blobs' DataURLs.
Parameters:
Name Type Description
callback function All recorded blobs' DataURLs are passed back to the "callback" function.
Source:
Example
recorder.getDataURL(function(recording){
    var audioDataURL = recording.audio;
    var videoDataURL = recording.video;
    var gifDataURL   = recording.gif;
});

(static) this.pauseRecording()

This method pauses recording.
Source:
Example
recorder.pauseRecording();

(static) this.resumeRecording()

This method resumes recording.
Source:
Example
recorder.resumeRecording();

(static) this.save(args)

This method can be used to invoke a save-as dialog for all recorded blobs.
Parameters:
Name Type Description
args object {audio: 'audio-name', video: 'video-name', gif: 'gif-name'}
Source:
Example
recorder.save({
    audio: 'audio-file-name',
    video: 'video-file-name',
    gif  : 'gif-file-name'
});

(static) this.startRecording()

This method starts recording.
Source:
Example
recorder.startRecording();

(static) this.stopRecording(callback)

This method stops recording.
Parameters:
Name Type Description
callback function Callback function is invoked when all encoders finished their jobs.
Source:
Example
recorder.stopRecording(function(recording){
    var audioBlob = recording.audio;
    var videoBlob = recording.video;
    var gifBlob   = recording.gif;
});

(static) this.writeToDisk()

This method can be used to ask MRecordRTC to write all recorded blobs into IndexedDB storage.
Source:
Example
recorder.writeToDisk();

(static) writeToDisk(options)

This method can be used to store recorded blobs into IndexedDB storage.
Parameters:
Name Type Description
options object {audio: Blob, video: Blob, gif: Blob}
Source:
Example
MRecordRTC.writeToDisk({
    audio: audioBlob,
    video: videoBlob,
    gif  : gifBlob
});

RecordRTC Issues

Help Improve Documentation

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

Latest Updates