mikeyaworski / Twitch-Lurker

Always support your favorite streamer by automatically pulling up their stream when they go live.
17 stars 1 forks source link

Improve tab replacement algorithm #22

Open mikeyaworski opened 5 months ago

mikeyaworski commented 5 months ago

Scenario:

  1. You have tabs opening in the background with a max stream of 1
  2. Your second-highest favorited streamer goes live, so it opens their tab
  3. You open a random, unfavorited stream as a second tab that you want to watch
  4. Your first-highest favorited streamer goes live, so it replaces on of your tabs with that new stream
  5. 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:

  1. Track which streams were opened manually vs opened automatically and prioritize replacing ones opened automatically (this is very bug prone)
  2. 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