Reputation: 406
I'm working on an application where an extension will record a tab and save it. The tab recording part worked pretty easily but for some reason the tab record didn't save the remote audio I got from webrtc (it did record the other noises the tab was making).
Here is how I start the tab recording:
chrome.tabCapture.capture({audio: true, video: true}, function(stream) {
if (!stream) {
console.error('Couldn\'t obtain stream.');
}
mediaRecorder = new MediaRecorder(stream, {mimeType: 'video/webm'});
mediaRecorder.start();
mediaRecorder.ondataavailable = function(event) {
if (event.data.size > 0) {
recordedChuncks.push(event.data);
}
}
});
The audio item that is missing in the recording is set up as follows:
<audio
id="remoteAudio"
ref={el => {
this._remoteAudio = el;
}}
autoPlay
playsInline
/>
And this audio elemet is given it's source from a remote video stream (this._remoteAudio.srcObject = remoteMediaStream
).
I'm not sure if I'm missing something or maybe this isn't currently possible.
Upvotes: 2
Views: 1871
Reputation: 17613
There's a blog post written by Google Chrome Devs in this post on how to do this using MediaStream Recording API:
Record Audio and Video with MediaRecorder
The MediaRecorder API enables you to record audio and video from a web app. It's available now in Firefox and in Chrome for Android and desktop. • Audio recording work in Firefox and in Chrome 49 and above; Chrome 47 and 48 only support video recording.
This SO post might also provide additional insight.
Upvotes: 1