Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebRTC: How to determine if remote user has disabled their video track?

Tags:

webrtc

I have a button for disabling the local video track:

button.onclick = function(){
    mediaStream.getVideoTracks()[0].enabled =
     !(mediaStream.getVideoTracks()[0].enabled);
}

I want to be able to detect this on the remote side, so that I can switch out the view with a user friendly image instead of showing a black screen.

Are there any events fired or any properties of the stream that the remote user can check on its local stream object that indicate that the other user shut off their video?

like image 344
bigpotato Avatar asked May 10 '17 11:05

bigpotato


1 Answers

No, there is no direct way to identify the remote video muted state.
You need to pass the video disabled event to remote user with signalling(over ws) or you can use data channel to relay the video disabled/enabled events.

You can predict remote video states based peerConnection stats, but they depends on bandwidth/network fluctuations.
And moreover browser will send some video data (empty/black frames) when we disable(mediaStream.getVideoTracks()[0].enabled = 0) the video track.

like image 62
Ajay Avatar answered Nov 05 '22 08:11

Ajay