1

I have an application where every call starts with audio, but user have opportunity switching video chat (there is a button).

And here is problem, after the first switch all work fine but then after switch to audio and again to video remote stream don't appear for user that doesn't use Firefox it means that Firefox's peer connection has a problem with adding localstream. It looks like FireFox removeTrack() function works different then in other browsers, in FireFox removed sender stays in peerconnection object but in another browsers not.

When anyone of users dont use Firefox this problem doesn`t appear.

Below link to project (this is angular framework architecture) and additional description.
project
p.s.: main logic in 'app/src/app/app.components.ts'

My question

What can be reason of it and how fix it?

Please provide some of your suggestions and advices if you have experience in it. It will be very usefull and any help would be appreciated!

Big thanks in advance

s.koliechkin
  • 51
  • 1
  • 6
  • Firefox implements the spec. Have a read [here](https://blog.mozilla.org/webrtc/the-evolution-of-webrtc/). – jib Oct 18 '18 at 04:04
  • In short, [removeTrack](http://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-removetrack) in the spec takes *sender* as an argument, and merely sets *sender.track* to `null`, which upon renegotiation mutes the *receiver.track* on the other end, and temporarily removes it from any streams. Hard to say exactly where things go wrong without more information, but hopefully this helps. – jib Oct 18 '18 at 04:14
  • @jib Big thanks for your answer. It gives some new info for me, and as I understood FireFox have some diff with other browsers in how manage media streams/tracks. But I still can't find problem in my code and what I can change to fix my issue. Can u look on it? Here is zip with project (prototype) and some additional description: [here](https://wetransfer.com/downloads/47e6860ac7a2ecae4956647d68e878a120181019114326/6d4b64) – s.koliechkin Oct 19 '18 at 11:49
  • Sorry I don't have time. Here's a [follow-up blog](https://blog.mozilla.org/webrtc/rtcrtptransceiver-explored/) with some working examples of how to remote control the tracks on the other side. You can try this in Chrome too by specifying `new RTCPeerConnection({sdpSemantics: 'unified-plan'})`, which is needed while they're [transitioning](https://webrtc.org/web-apis/chrome/unified-plan/) to the spec (at which point you'll have your problem in Chrome as well). – jib Oct 19 '18 at 15:54
  • Thanks for information. I tested couple of methods that was in articles and figured out that no one work correctly after second iteration of switch from audio to video. So, here my decision, once video track was added (first switch audi to video) then all switchings was performing using track.enable flag. It works good but here still is one problem, in chrome/opera will swiched on indicator of camera recording after second swithching from video to audio (in FF indicator is switched off after video track.enable = false). And that is one problem that remain. – s.koliechkin Oct 28 '18 at 13:47
  • Firefox works "correctly" according to the spec FWIW. Chrome does too if you specify `new RTCPeerConnection({sdpSemantics: "unified-plan"})`, their (non-spec) [transition flag](https://groups.google.com/forum/#!topic/discuss-webrtc/x8lcqHRlWmA). Glad you got it to work, modulo the camera light. It would be great if other browsers followed suit and [turned off the camera light on mute](https://blog.mozilla.org/webrtc/better-privacy-on-camera-mute-in-firefox-60/) like Firefox does. That sounds like a new question though. – jib Oct 28 '18 at 13:58

0 Answers0