-
-
Notifications
You must be signed in to change notification settings - Fork 679
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
audio: browser does not play audio until refresh #3122
Comments
Thanks. Did you say the warning "The AudioContext was not allowed to start." was shown twice at the first load? I need both stacktraces. |
When I open the browser to localhost:8080 the first time I get this in the dev console
Then when I click into the wasm game I see
Then I reload the window and see
After this, I can click into the window and hear audio. |
Unfortunately I failed to reproduce this. I'll try to investigate this more. Thanks! |
My current guess is that the event handler for the user input is not invoked directly but indirectly due to the Go scheduler. |
AudioContext.resume might fail in theory. This change addresses the issue where resuming fails by ensuring the promise result. Updates hajimehoshi/ebiten#3122
@kazzmir Could you try go get github.com/hajimehoshi/ebiten/v2@fd3a253d884910359f1b2002a677002b75040c08 ? The first click might not start the audio, but multiple clicks should start. |
With that new version the audio starts on the first click. |
OK thanks! |
AudioContext.resume might fail in theory. This change addresses the issue where resuming fails by ensuring the promise result. Updates hajimehoshi/ebiten#3122
Ebitengine Version
2.8.0
Operating System
Go Version (
go version
)go version go1.23.0 linux/amd64
What steps will reproduce the problem?
Load localhost:8080 in chrome and click on the page. No audio is heard. Refresh the page and then click on the game area, now sound plays.
chrome Version 129.0.6668.58 (Official Build) (64-bit)
I also tested in firefox 130.0.1 (64-bit) with the same result.
What is the expected result?
Audio should play without having to refresh the page
What happens instead?
No audio until a page refresh is done.
Anything else you feel useful to add?
These messages appear in the chrome dev console
I can't seem to copy/paste this text, but here is an image of the longer stack trace.
The text was updated successfully, but these errors were encountered: