WebRTC Gif Recording using MediaStreamRecorder
HOME © Muaz Khan . @WebRTCWeb . Github . Latest issues . What's New?
How to use?
// cdn.webrtc-experiment.com/MediaStreamRecorder.js // cdn.webrtc-experiment.com/gif-recorder.js var mediaConstraints = { video: true }; navigator.getUserMedia(mediaConstraints, onMediaSuccess, onMediaError); function onMediaSuccess(stream) { var mediaRecorder = new MediaStreamRecorder(stream); mediaRecorder.mimeType = 'image/gif'; mediaRecorder.ondataavailable = function (blob) { // POST/PUT "Blob" using FormData/XHR2 var blobURL = URL.createObjectURL(blob); document.write('<a href="' + blobURL + '">' + blobURL + '</a>'); }; mediaRecorder.start(3000); } function onMediaError(e) { console.error('media error', e); }