I am using Opentok JavaScript WebRTC to host a 1 to 1 video chat (peer-to-peer). I see my video video and hear the sound impeccably.
My desire is to record audio / video of other chats (deleted). For this purpose I use RecordRTC . I managed to record the video of another chat participant (the video is output to the HTML video element), but so far I have not been able to record the sound (WAV file with dead silence as far as I could get). Using Chrome Canary (30.0.1554.0). This is my method:
var clientVideo = $('#peerdiv video')[0];//peer video (html element) var serverVideo = $('#myselfdiv video')[0];//my video (html element) var context = new webkitAudioContext(); var clientStream = context.createMediaStreamSource(clientVideo.webRTCStream); var serverStream = context.createMediaStreamSource(serverVideo.webRTCStream);
webRTCStream is a custom property assigned to the HTMLVideoElement object by changing the source of the opentok js library. It contains the MediaStream object associated with the corresponding <video>.
var recorder = RecordRTC({ video: clientVideo, stream: clientStream }); recorder.recordAudio(); recorder.recordVideo();
The video is being recorded. An audio file is also created, the length of which is close to the length of the video, however it is completely silent (and yes, during recording there was a lot of noise on the other side)
I tested this with a video element that displays the video stream (and audio) of the webcam, and it worked: both audio and video were recorded:
... var recorder = RecordRTC({ video: serverVideo, stream: serverStream }); ...
Is there anything special about streams originating from a remote location? Any advice on this would be very helpful.
webrtc web-audio opentok
skiedrius
source share