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

[iOS/Android] Music Playback Issue After Resuming Inactive Pyxel Web Page #596

Open
shiromofufactory opened this issue Jan 7, 2025 · 2 comments

Comments

@shiromofufactory
Copy link

On the web version of Pyxel on iOS (and possibly on Android as well), when music is playing and the user switches to another app or leaves the page inactive for a while, the music may not resume playback when returning to the Pyxel page.

The conditions for reproducing this issue are not entirely clear. Sometimes the music resumes correctly, especially if the user returns to the page shortly after leaving it.

It seems challenging to address this issue solely on the application side. Would it be possible to investigate and address this behavior within the Pyxel engine itself?

@kitao
Copy link
Owner

kitao commented Jan 7, 2025

Regarding the sound playback on Web, Pyxel just uses SDL2 embedded in Emscripten and there's no difference from other platforms from the viewpoint of code for sound-related feature. So it would be the issue about SDL2 on Web.

@shiromofufactory
Copy link
Author

Thank you for your response. I understand that the issue is caused by the behavior of Web SDL2.

As a non-expert suggestion, I wonder if it might be possible to forcibly resume audio playback by calling the SDL_PauseAudioDevice() method, which is also used in audio.rs, when the page becomes active again (e.g., triggered by the JavaScript 'visibilitychange' event).

Would such an approach be feasible?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants