Search code examples
javawebrtckurento

remote media stream not available, webrtc and kurento media stream


I have started with https://doc-kurento.readthedocs.io/en/6.13.2/tutorials/java/tutorial-groupcall.html

Currently, in UI i give user option to decide whether they want only audio or audio+video call. Based on the selection, the constraints for getUserMedia() are passed and this works fine if all the user select same kind of call type.

But, say user 1 select only audio and user 2 selects audio+video, then user 1 receives audio from user 2 while on user 2 end, the html video element keeps loading.

Findings: I believe this is SDP offer issue, since offer from user 1 and respective SDP answer from user2 does not contain m=video since user 1 has opted only for audio call (this works fine)

But, offer from user 2 and respective SDP answer from user 1 does contain m=video.

So, what i want is, user 2 receive audio from 1, even though user 2 selected video call.


Solution

  • Your stream has both Audio and Video tracks. for some reason, html video element doesn't play audio in this case because it's not getting video and just audio (because the other guy disabled the video). There's two ways you fix it.

    1. Fixing by manipulating mediaStream. You can create a mediaStream that has only audio tracks when the user has disabled the video.

      const audioStream = new MediaStream(); mediaStream.addTrack(originalStream.getAudioTracks()[0]); /* display audioStream in video element*/

    2. Fixing by generating sdp to right mediaConstraints You can generate the sdp by passing mediaConstraints as {audio:true,video:false} when creating WebRtcPeer using kurentoUtils. That'll just get you the audio track.