RecordRTC & RTCMultiConnection ® Muaz Khan
© 2013 Muaz Khan<@muazkh> » @WebRTC Experiments » Google+ » What's New?
#123456789
- You can record video from both local and remote media streams (only one chrome, though!)
- You can record audio from local stream both on chrome and 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.
- "recordingType" can be either "audio" or "video".
- A real "Blob" object is returned.
connection.streams['stream-id'].stopRecording(function (blob) { var mediaElement = document.createElement(blob.recordingType); mediaElement.src = URL.createObjectURL(blob); document.documentElement.appendChild(h2); });
You can force to stop a specific stream:
connection.streams['stream-id'].stopRecording(onBlob, { 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({ audio: true, video: true }); // record 10 sec audio/video var recordingInterval = 10 * 10000; setTimeout(function () { connection.streams[e.streamid].stopRecording(function (blob) { var mediaElement = document.createElement(blob.recordingType); mediaElement.src = URL.createObjectURL(blob); document.documentElement.appendChild(h2); }); }, recordingInterval) }