Search code examples
firefoxwebrtc

How fire "mute" event on the peer in webRTC


I have implemented webRtc connection using JS (Firefox v.112).
My peer successfully gets unmute event when it gets tracks from my computer.
But if my computer disables the track, which previously was sent to peer, using: sentVideoTrack.enabled = false, then peer does not receive mute event.
I don't call removeTrack - only set enabled field.
I have performed test with 2 browser windows on localhost.

Receiving video on the peer is stopped - ok!, but should he receive mute event ? If no, which event can the peer intercept while my computer is setting track.enabled to false?


Solution

  • Setting the tracks enabled to false does not stop sending media, it only sends black frames (for video) or silence (for audio).

    The common solution is to use the signaling channel to signal the fact that you muted to the other side.