muaz-khan / WebRTC-Experiment

WebRTC, WebRTC and WebRTC. Everything here is all about WebRTC!!
https://www.webrtc-experiment.com/
MIT License
11.71k stars 3.95k forks source link

Unable to run two recorders on a stream #205

Open SumitBisht opened 10 years ago

SumitBisht commented 10 years ago

I am trying to record a video with audio through WebRTC but am not able to get the audio in the recorder. Here's how I am attempting to call the recorder

                navigator.getUserMedia({
                    video: true,
                    audio: true 
                  },

                  function(stream) {
                    videoStream = stream;
                    // Stream the data
                    video.src = URL.createObjectURL(stream);

                    video.width = videoWidth_input.value || 320;
                    video.height = videoHeight_input.value || 240;

                    var options = {
                        type: 'video',
                        video: {
                            width: videoWidth_input.value,
                            height: videoHeight_input.value
                        },
                        canvas: {
                            width: canvasWidth_input.value,
                            height: canvasHeight_input.value
                        }
                    };

                    recorder = window.RecordRTC(stream, options);
                    recorder.startRecording();

I am able to get both the audio and video to play on browser simultaneously and able to get the recorders for audio and video separately and joining the files on server. However, joining audio and video files on server is difficult due to time differences of these two recordings. What I am trying is to record the file with sound inserted properly. Is this possible in WebRTC after making changes in the RecordRTC (for a separate recorder - which is giving the same video file itself)?

muaz-khan commented 10 years ago

It is possible to return synced wav/webm files from RecordRTC; so you'll simply upload both files and merge; and everything will be synced and recordings length will be identical.

I'm working on same thing; and hope you'll see a working demo very soon.

I just need to remove audio latency if shared mode is used. It is hardest part to detect whether shared or exclusive mode is available on the target system. According to chromium team, shared mode causes about 100ms latency; however I think it varies.