-
-
Notifications
You must be signed in to change notification settings - Fork 839
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
Background playback #7289
Comments
Unfortunately, this is not possible due to the restrictions of modern web browsers. Browsers suspend canvas/WebGL elements in the background automatically, and all Ruffle can do is try to cooperate with that. |
is this still open by accident? |
Well, I've noticed that the swf2js Flash emulator is able to keep playing background music of games while the execution is otherwise suspended. I think this could be cool feature for Ruffle in the future, if it's possible. |
Flash player and SWF2js make it work, so try using JS and Ruffle to do the same! |
Any update on this? |
We could probably offer a config option to disable Ruffle's auto-suspend functionality, with the big caveat that Ruffle is still subject to the browser's own auto-suspension as I explained before. So background audio could keep playing, but the game wouldn't otherwise continue running for the most part, which could have strange effects sometimes. I've also been told that a lot of multiplayer Flash games were coded to exchange data with the server at regular intervals, and no matter what we do, this is probably going to be broken for the foreseeable future. |
I think that config option would be sufficient. Would that also keep flash video animations playing as well? It wouldn't be good to have the audio and video desync. |
I think it would cause desync, unfortunately. |
There should be a workaround given that there's code that explicitly shuts off the video when it goes into the background. ruffle/web/packages/core/src/ruffle-player.ts Line 435 in 695c2ff
For example browsers often have options to shut off the feature that causes the issue this code tries to "fix" against. |
I already explained that Ruffle pauses itself because otherwise the browser would try to pause it anyway, leading to desyncs and other problems. And I don't believe there are any browser settings to change this, and even if there were, it wouldn't be realistic to expect users to change them. |
When I switch to a different tab on Newgrounds, Ruffle suspends the flash elements, whereas the original flash kept playing in background. Please bring background playback to Ruffle. Thanks in advance.
The text was updated successfully, but these errors were encountered: