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

Bug: No sound on iPhone/IOS when set: "autoStart: true" on the startup script #345

Open
shaylevary opened this issue Sep 19, 2024 · 3 comments
Labels

Comments

@shaylevary
Copy link

Hi,

When I set 'autoStart: true' in the script,. i've encouter no sound issue when I try to run a game on an Apple/IOS phone.

@shaylevary
Copy link
Author

The thing is that when I set 'autostart: false' then the options menu appear in the opening, then after pressing the play button the game start and the sound works fine in ios/Apple.

Apparently there is a bug that, when set the option to skip the opening menu, the sound function is not activated in ios/Apple

@caiiiycuk caiiiycuk added the bug label Sep 19, 2024
@caiiiycuk
Copy link
Owner

Hmm, this is a bit strange, cause after audio-node creation it will be resumed on first pointer or keyboard event.

const resumeWebAudio = () => {
if (audioContext !== null && audioContext.state === "suspended") {
audioContext.resume();
}
};
document.addEventListener("pointerdown", resumeWebAudio, { once: true });
document.addEventListener("keydown", resumeWebAudio, { once: true });

If it silent even after you tap on screen?

@shaylevary
Copy link
Author

Indeed, even after tapping the screen it still silence.
This problem appears only on iPhone/iOS when set the autostart to true.

If you do not have an iPhone for testing this issue, you can log in through this website that allows remote connection to real iPhones for tests:
Www.browserstack.com

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

No branches or pull requests

3 participants
@caiiiycuk @shaylevary and others