Re: [webrtc-pc] Differences between pc.removeTrack(sender) and sender.replaceTrack(null) (#2024)

FWIW I think the spec is [super-clear]( how to implement `pc.removeTrack(sender)`. It's just counterintuitive, a misnomer. Unsure what note will solve that except *"No, really"*. I mean it takes a *sender*...

It's there mostly for [legacy reasons]( and best ignored IMHO. Might this be better covered under examples?  I think it's fair to say that (with `transceiver.direction == "sendrecv"` as a starting point):
is a synchronous version of:
transceiver.direction = "recvonly"; await transceiver.sender.replaceTrack(null); 
Or imagine we had a synchronous setter that threw on anything but `null`:
transceiver.direction = "recvonly"; transceiver.sender.track = null; // null or TypeError 

This is possible because `sender.replaceTrack(null)` cannot fail, and *could have* been done synchronously, whereas `sender.replaceTrack(withTrack)` cannot.

> replaceTrack(null) could probably special-case to be synchronous, but it already returns a promise, so I think it would just be confusing.

It was like that before we fixed it in

GitHub Notification of comment by jan-ivar
Please view or discuss this issue at using your GitHub account

Received on Wednesday, 13 March 2019 19:12:44 UTC