Add recording support

This commit is contained in:
Pierre HUBERT 2020-04-13 18:47:28 +02:00
parent e4478beda2
commit e27797cdcd
4 changed files with 66 additions and 1 deletions

File diff suppressed because one or more lines are too long

View File

@ -150,7 +150,7 @@
} }
.call-window .window-bottom .dropdown-menu { .call-window .window-bottom .dropdown-menu {
left: -95px; left: -125px;
} }
.call-window .window-bottom .dropdown-menu i { .call-window .window-bottom .dropdown-menu i {

View File

@ -203,6 +203,15 @@ class CallWindow extends CustomEvents {
} }
}, },
// Record streams
{
icon: "fa-save",
text: "Start / Stop recording",
onclick: () => {
this.startRecording()
}
},
] ]
//Add buttons //Add buttons
@ -885,4 +894,41 @@ class CallWindow extends CustomEvents {
} }
} }
/**
* Start / stop recording the streams
*/
startRecording() {
const onDataAvailable = blob => {
console.info("New record available", blob)
// = GET URL = const url = URL.createObjectURL(blob)
// Save file
saveAs(blob, new Date().getTime() + ".webm")
}
// Start recording
if(!this.recorder) {
// Determine the list of streams to save
const streams = []
if(this.mainStream)
streams.push(this.mainStream)
this.streamsEls.forEach(v => streams.push(v))
// Create & start recorder
this.recorder = new MultiStreamRecorder(streams);
this.recorder.ondataavailable = onDataAvailable
this.recorder.start(30*60*1000); // Ask for save every 30min
}
// Stop recording
else {
this.recorder.stop(onDataAvailable)
delete this.recorder
}
}
} }

View File

@ -165,6 +165,9 @@ class Dev {
// Share screen // Share screen
"3rdparty/getScreenId.js", "3rdparty/getScreenId.js",
// Record MediaStream
"3rdparty/MediaStreamRecorder.min.js"
); );
/** /**