…and this works great; two separate tracks are available.
When a user (a) changes their video input or (b) turns the camera off & on, I call sfu_camVideoProducer.replaceTrack({track}), but this seems to only produce 1 track (at the lower encoding/maxBitrate).
Is this the expected behavior? If so, what is the recommended action when changing the video input device? Do you need to destroy the producer and re-create it from scratch?
Simulcast is about 2 different encodings of the same exact track.
When you replace it everything should work just fine, there should be still 2 encodings, but with a new track’s contents.
Also unless you have specific setup, usually one of the encodings has scaleResolutionDownBy: 1, so you’d be better off requesting lower resolution video in the first place.
Yes, you can check that in dev tools. The only thing I can think of is if new video track is significantly smaller and browser decided to disable larger layer.
I mean if you request smaller video resolution from the browser you can use 2 and 1 coefficient instead of 4 and 2.
Thank you guys, the problem was indeed with my code.
I forgot that when I startCamera for mediasoup, I don’t pass any constraints (other than deviceId) to getUserMedia, otherwise it tends to not work properly (for P2P, I pass constraints such as ideal resolution, echo, aspectRatio, etc.).
When changing cameras, I was still passing these constraints to getUserMedia. I updated my code and now all is well