RecordRTC & RTCMultiConnection ® Muaz Khan

© 2013 Muaz Khan<@muazkh> » @WebRTC Experiments » Google+ » What's New?

Private ?? #123456789
  1. You can record video from both local and remote media streams (only one chrome, though!)
  2. You can record audio from local stream both on chrome and firefox
  3. 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.

  1. "recordingType" can be either "audio" or "video".
  2. 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)
}

Feedback

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

Latest Updates