I am trying to recording audio and video from a webcam. I stumbled upon HTML5 getUserMedia and further googling led me to WebRTC [Oh! This is really cool by the way].
I implemented it and its working fine on firefox, able to record both audio and video perfectly.But On chrome either the audio or the video gets recorded depending on the configuration passed. Further googling led me to this post, which clearly says that one thread blocks the other. Now i've seen demos for chrome that demonstrate both audio video capture simultaneously.
This is what my code looks like:
// Start recording
captureUserMedia(function(stream) {
localStream = stream;
window.audioVideoRecorder = window.RecordRTC(stream, {
type : 'video/webm'
});
window.audioVideoRecorder.startRecording();
});
// Stop recording
window.audioVideoRecorder.stopRecording(function(url) {
videoElement.src = url;
videoElement.onended = function() {
videoElement.pause();
videoElement.src = URL.createObjectURL(audioVideoRecorder.getBlob());
};
});
The above code is for starting and recording the media on button click.
The blob that i get back after recording when console logged shows video/webm
for firefox and audio/wav
for Chrome.
This clearly shows that one is blocking the other. Is there any solution for recording both or any other javascript that i am missing should be added to make it work.
Update: As @mido22 suggested below that is the workaround. Link can be found here.