'WebRTC: Any sample for "degrade a call and turn video off"?
Description
The sample upgrade a call and turn video on is very intuitive. However, is there any reverse sample of "degrade a call and turn video off"?
Scenario
We are going to implement a toggle of a bi-directional audio/video call. At the beginning, the call is only for audio. After we click "upgrade to video call", then the bi-directional video tracks are added. Then we click "downgrade to audio call", it recovers to the audio call as the one in the beginning. Note that the video/audio toggle should be done in unlimited times.
Investigation
I think I should invoke "removeTrack" from the caller and start to renegotiate. But on the callee side, how could we remove the video track from the H5 video player?
Solution 1:[1]
Finally, I find a solution. The bi-directional dummy audio tracks are added in the beginning. Then we can call replaceTrack() of the transceiver to switch audio. No re-negotiation is necessary.
Thanks this blog, I can't do it without this blog. And this blog is also helpful.
But the solution is still imperfect. A dummy audio track is still created for both sides, which means a little bit network traffic is wasted. A perfect solution should shun down the transmission when there is no real audio track.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Jim Jin |
