let web-decker scripts play audio in the background#86
let web-decker scripts play audio in the background#86easrng wants to merge 2 commits intoJohnEarnest:mainfrom
Conversation
|
this isn't perfect, there's one delay when you tab out as the pending animationframe gets delayed before it switches to timeouts for new frames until the user comes back |
|
Hm. I tried this patch out in several versions of Safari, Chrome, and Firefox, and while it doesn't cause any harm it doesn't actually appear to make any difference on Safari or Chrome. |
|
Oh, I see the problem! |
|
I did some experiments with both the above patch and a simplified version which entirely dispenses with In Chrome, I'm not really thrilled about implementing features which work on Chrome but perform worse or not at all on other browsers. |
|
hmm, it occurs to me that it might be a better idea to check how long a tick took and subtract that from the setTimeout delay, since i'm pretty sure that's effectively what requestanimationframe does (but with a variable refresh rate) |
when a tab is in the background, requestAnimationFrame gets seriously throttled
if a script in a deck like jankytunes is playing sound that messes it up
so we should use setTimeout instead, which isn't throttled if audio is playing