Fix/workaround for throttling

Скрипт: JR Mturk Panda Crazy

Have you looked into a workaround for browser throttling? If a tab is playing audio (can be pretty quiet) it won't be throttled despite being in the background.

I made a proof-of-concept here. I used the same code you use to test for throttling in PC and I got it to work in latest Chrome and Firefox (and Chrome Canary). For it to work in Canary, it needs to be setup after the user interacts with the page, but that will be an issue with all sounds anyway.

It just plays a very quiet low-pitch sound continuously to avoid the throttling.

I understand if you don't want to go this route, it's pretty hacky. My setup on Mac makes it too inconvenient to have PC in its own window so I'll be using this in my copy. Figured it would be helpful to let you know in case you want a different way to stop the tab throttling.

Keep up the good work on this awesome script!

Комментарии

  • Thanks but I'm worried that could be changed in the future with chrome wanting to disable background tabs. I am trying to educate people to use important scripts with timers in their own windows to provide it the best possible response.

    There is another way which I tested when I first started the script and ran into this problem. Using postmessage was able to get around this problem but it's messy and I got worried about tasking the system too much. I was also using postmessage for communication between scripts so didn't want things to get confusing.

    Later I will add a disable warning option when people get all settled. I'll look to see if the audio could work with the script but not sure if I really want to implement it for all. Maybe an option to allow users to use it if they want to.
  • I know the audio thing is something people use to get around throttling (at least it's brought up occasionally, I've never personally seen a site do it), so yeah they might decide that's being abused too much and throttle those too.

    In a few version Chrome will require the user to interact with the page in some way before JS can play sound. It should only affect pop ups thankfully.

    I might make a quick script that does this to avoid editing the source directly.

  • Here's the script. I'll wait and see if you add the workaround to PC before I post about it anywhere.

    I'd be happy to help out if you could use it.

  • This audio idea is genius. The tab shows audio is playing, but of course I can't hear anything.

    If non-extension websites begin abusing this audio hack, we can just mute their tabs.

  • Yes this workaround seems like it's working great. Only had one time the script complained but I believe the computer was just doing a lot of processing in the background when that happened. I'm going back to the first way of detecting an unfocused page with document.hidden now that there is an option to disable warning, warning only one time and a workaround with the audio.

    I did know that tabs with continuous audio wasn't being throttled but didn't know how to use that info so didn't even think that it could be used without hearing an annoying sound. I did lower the frequency to 30 because I still heard a low sound with headphones when it was at 100. Thanks
Войдите или Зарегистрируйтесь чтобы комментировать.