Thursday, 17 June 2021

How to detect when the remote peer has disabled the track in WebRTC?

I am writing a WebRTC app where peers can pause/resume sending media data by calling:

function pause() {
  sender.replaceTrack(null);
}
function resume() {
  sender.replaceTrack(track);
}

Is there a native way (other than using the signaling server) to detect when a remote peer has paused/resumed sending media data?

I tried to add handler to 'mute' and 'unmute' events on the received track but nothing happens (except onunmute got called once). I inspected the tracks in the browser dev tools, and got { muted: false, enabled: true } on the RTCRtpReceiver.track event when the other peer's RTCRtpSender.track is null.



from How to detect when the remote peer has disabled the track in WebRTC?

No comments:

Post a Comment