Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

window.requestAnimationFrame background throttling #1172

Open
mavericken opened this issue Apr 10, 2021 · 5 comments
Open

window.requestAnimationFrame background throttling #1172

mavericken opened this issue Apr 10, 2021 · 5 comments
Labels
feature request feature request tracked We are tracking this work internally.

Comments

@mavericken
Copy link

mavericken commented Apr 10, 2021

I need an option to ensure that window.requestAnimationFrame does not throttle when my application does not have focus. By the nature of my application, it will normally not have focus but it still needs to be able to render smooth animations. The throttling happens at unexpected times, where it will continue smooth animation for a while after I click away, but minutes later it becomes a slide show until I click the window again.

AB#32524564

@mavericken mavericken added the feature request feature request label Apr 10, 2021
@champnic
Copy link
Member

Thanks for the feature request @mavericken! I've added this scenario to our backlog.

@MatevzRopret
Copy link

MatevzRopret commented Dec 17, 2022

We have the same issue on our end, everything in javascript throttles down and it's extremely annoying as we cannot properly use this webview since eg if we do 3 requests there is a 1 second pause between them instead of just eg ~0.1ms.

Here is my reproduction case:

#3070

@bestpika
Copy link

Do we have any progress on this feature request at the moment?
I noticed that even when I minimize the browser, it is still restricted.

@terrybrash
Copy link

I'm distributing a video game using Tauri. I'd like the option to continue simulating the game (running in requestAnimationFrame) even when the window is minimized.

@bastiankistner
Copy link

I'd kindly like to ask if there has been made any progress to this problem? Webkit meanwhile supports this (see https://developer.apple.com/documentation/webkit/wkpreferences/inactiveschedulingpolicy-swift.enum?language=objc) and tauri will be providing a flag soon to set this for each window (which will sadly only work on iOS and macOS, yet).

I am experiencing a quite severe issue where websocket connections won't be re-established once a window runs in background (e.g. after minimizing) and the machine goes into sleep mode for a while.

Since we're leveraging the mentioned flag on macOS we haven't seen any problems. Solutions like pending WebLock transactions or similar did not help, but I still need to test on windows. Anyways, it should be possible to let developers decide how to handle resources when they're building their apps around browsers that come shipped with the operating system. Otherwise, long running, browser base apps will become extremely hard to manage without ugly workarounds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request feature request tracked We are tracking this work internally.
Projects
None yet
Development

No branches or pull requests

6 participants