RecordRTC & RTCMultiConnection ® Muaz Khan
HOME © Muaz Khan . @WebRTCWeb . Github . Latest issues . What's New?
#123456789
- You can record both local and remote audio+video streams in chrome >= 50
- You can record video from both local and remote media streams (chrome,firefox,opera)
- You can record audio from local stream (chrome,firefox,opera)
- You can record "remote-audio" only on firefox
- Many streams can be added; renegotiated; and recorded (simultaneously)!
You can invoke audio/video recorder like this:
connection.streams['stream-id'].startRecording({
audio: true,
video: true
});
You can skip argument:
// to record both audio and video connection.streams['stream-id'].startRecording();
Stop recording and get blob.
- A JavaScritp object is returned with audio/video blobs e.g. blob.audio or blob.video.
connection.streams['stream-id'].stopRecording(function (blob) {
var mediaElement = document.createElement('audio');
mediaElement.src = URL.createObjectURL(blob.audio);
document.documentElement.appendChild(h2);
});
You can force to stop a specific stream:
connection.streams['stream-id'].stopRecording(onBlobs, {
audio: true // stop audio recorder and get audio blob
});
A simple working example:
connection.onstream = function (e) {
// e.type == 'remote' || 'local'
connection.streams[e.streamid].startRecording({
video: true
});
// record 10 sec audio/video
var recordingInterval = 10 * 10000;
setTimeout(function () {
connection.streams[e.streamid].stopRecording(function (blob) {
var mediaElement = document.createElement('video');
mediaElement.src = URL.createObjectURL(blob.video);
document.documentElement.appendChild(h2);
});
}, recordingInterval)
};