WebRTC Audio Recording using MediaStreamRecorder

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

ms

recorderType:


// cdn.webrtc-experiment.com/MediaStreamRecorder.js

var mediaConstraints = {
    audio: true
};

navigator.getUserMedia(mediaConstraints, onMediaSuccess, onMediaError);

function onMediaSuccess(stream) {
    var mediaRecorder = new MediaStreamRecorder(stream);
    mediaRecorder.mimeType = 'audio/webm'; // audio/webm or audio/ogg or audio/wav
    mediaRecorder.ondataavailable = function (blob) {
        // POST/PUT "Blob" using FormData/XHR2
        var blobURL = URL.createObjectURL(blob);
        document.write('' + blobURL + '');
    };
    mediaRecorder.start(3000);
}

function onMediaError(e) {
    console.error('media error', e);
}
MediaStreamRecorder Demos

Latest Updates

Latest Issues

Feedback

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

Latest Updates