Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var startR=document.createElement("button"),stopR=startR.cloneNode();
- document.body.appendChild(startR);
- document.body.appendChild(stopR);
- startR.innerText="start capture";
- stopR.innerText="stop capture";
- self.auc=new AudioContext();
- var mes=auc.createMediaElementSource(document.getElementsByTagName("video")[0]);
- self.audio_merge=auc.createMediaStreamDestination();
- mes.connect(audio_merge);
- startR.onclick=function(){
- navigator.mediaDevices.getDisplayMedia({ video: true }).then(function(disp){
- var mediaRecorder1 = new MediaRecorder(disp,{"mimeType":"video/webm"/* , "audioBitsPerSecond":128*1024 */ }),
- mediaRecorder2 = new MediaRecorder(audio_merge.stream,{"mimeType":"audio/ogg"/* , "audioBitsPerSecond":128*1024 */ });
- self.Rchunks = []; self.Rchunks2=[];
- mediaRecorder1.ondataavailable = function(e) {
- Rchunks.push(e.data);
- },
- mediaRecorder2.ondataavailable = function(e) {
- Rchunks2.push(e.data);
- };
- setTimeout(function(){
- mediaRecorder1.start();
- mediaRecorder2.start();
- },1000);
- stopR.onclick=function(){
- mediaRecorder1.stop();mediaRecorder2.stop();
- };
- });
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement