You have tabs opening in the background with a max stream of 1
Your second-highest favorited streamer goes live, so it opens their tab
You open a random, unfavorited stream as a second tab that you want to watch
Your first-highest favorited streamer goes live, so it replaces on of your tabs with that new stream
It chooses the random, unfavorited stream to replace since that is lowest priority, but this is also the one you are watching / listening to
Potential solutions:
Track which streams were opened manually vs opened automatically and prioritize replacing ones opened automatically (this is very bug prone)
Check if the tab has a muted video player and if the tab is not active. Lower the priority of the tab based on those attributes. In this scenario, the second-highest favorited stream would've been either muted and/or the other stream would have been the active tab, so the priority would change
Scenario:
Potential solutions: