Search code examples
webrtcaudio-recordingvideo-recordingkurento

Kurento WebRTC not recording unless both audio and video streams are present


Basically subj. I am using Kurento-Utils for JS. That topic has been discussed for the case of lower-level work, but at this point in project, it is too late to go switch approach :(

When i stream webcam with audio it is recorded nicely into a .webm file. But, how do i stream audio only, or video only? An attempt results in file being of 0 size with no error messages.

Is there any sample code for Kurento-utils/js which would demonstrate that use case?


Solution

  • You need to provide the appropriate MediaType when instantiating the recorder, and connecting the elements.

    pipeline.create('RecorderEndpoint', {uri: filepath,mediaProfile:'WEBM_AUDIO_ONLY'}, 
                function (error, recorder) {
                    webrtcEp.connect(recorder,'AUDIO', function (err) {
                        recorder.record();
                        console.log("recording started ...");
                    });
                });