There are 3 possible routes to solve this headache:
- When client requests for a resolution change, send a freeze frame which the client can display as a static image, client disconnects and reconnect, automatically restart the video. A potential problem here is that browsers generally block video autoplay if audio is present.
- Somehow adjust the video output from the streamer. It seems quite difficult. In 4.27 there is a Capturer, which you can call a method to change the capture resolution. This class and the capture context has been removed in 5.0, thus there is no comparable solutions.
- Create new video track with the correct resolution, make client switch to the new track, and finally destroy the old track. I have not checked how viable this it.