microsoft / MixedReality-WebRTC

MixedReality-WebRTC is a collection of components to help mixed reality app developers integrate audio and video real-time communication into their application and improve their collaborative experience
https://microsoft.github.io/MixedReality-WebRTC/
MIT License
913 stars 283 forks source link

Detect mute/enabled state of remote video #681

Open AtosNicoS opened 3 years ago

AtosNicoS commented 3 years ago

Describe the problem Currently it is not possible to detect if the remote peer is sending video on a specific track or not. That is useful if you want to enable/disable video signals within a call. Inside the UI you want to hide the video, if it is not sending. Currently there is no simple way to detect that.

Describe the solution you'd like An Event for the track + a Property to read

Describe alternatives you've considered The workaround is to track the I420AVideoFrameReady event. If it fires regulary, the video is still sending. If not, the video is disabled.

Additional context As discussed with @djee-ms here: https://github.com/microsoft/MixedReality-WebRTC/issues/139

dgtvan commented 3 years ago

I just found out there is an implementation called Data Channels used to transfer generic data. It is described here https://tools.ietf.org/html/rfc8831, and the library has already implemented it.

Why don't we just use it to notify Mute/Unmute state instead of regularly checking the incomming video data? I am new to it and curious to know.

kspark-scott commented 3 years ago

@ThaiVan , that's a good suggestion. We use the data channel for exactly this purpose, signaling state changes between peers for purposes both related and unrelated to track management. In the case of track management, MR-WebRTC can notify you of track changes (i.e. track added/removed), but not the semantics associated with the track which determine what to do with it. I don't know if there are cleaner ways to manage things like selective muting, but can at least confirm that the data channel approach works well for us.