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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With