Created attachment 354958 [details] Script that reproduces the issue. Just run it in Safari 12.1 console with "Unified-Plan" enabled. * Latest Safari Tech Preview 12.1 (15-Nov-2018) * "WebRTC Unified-Plan" enabled in menu "Develop / Experimental Features". Scenario: - Add a mic transceiver with "sendonly" direction. Create offer and apply it. - Remove the mic track using pc.removeTrack(transceiver.sender). Create offer and apply it. - Add again the mic track using transceiver.replaceTrack(track) and changing transceiver.direction = "sendonly". It throws "InvalidStateError: The object is in an invalid state." This should not happen. The app should be able to change transceiver.direction at any time. And in this case, the app does need to set transceiver.direction="sendonly" since it's not supposed to be automatically changed after replacing the sending track. This works in Chrome and Firefox.
UPDATE: The error does not happen when setting transceiver.direction = "sendonly" (my fault) but when calling transceiver.sender.replaceTrack(track). So it seems that, after calling pc.removeTrack(micTransceiver.sender), the transceiver or its sender component becomes unusable for handling new tracks later.
Thanks for the report Inaki. It does not repro on WebKit Tot. I believe this is a dupe of bug 191202. *** This bug has been marked as a duplicate of bug 191202 ***
Hi Youenn, yes, it is the same issue. My fault. However, according to the latest release notes[*] the issue 191202 is supposed to be fixed in latest Safari Tech Preview, but I can perfectly reproduce the bug by running the attached script. [*] https://webkit.org/blog/8496/release-notes-for-safari-technology-preview-70/
Confirmed that it's fixed in latest Safari 12.1, WebKit 14607.1.15.