xpenatan/gdx-teavm

The AudioContext was not allowed to start

Quillraven opened this issue · 2 comments

Hi,

I have again an issue with playing audio in the Browser Link to the game.

According to the browser console:
image
image

It seems like calling Music.play() fails if it is called at the application startup? If I control the player (WASD, SPACE) then e.g. I can here the sound for the jump effect and also the jingle when I get in contact with the finish flag.
But the normal background music of the map is not played.

Can I somehow force a gesture to also play music immediately without an interaction of the user first? Or is there another solution to this issue?

edit: by the way, I use Edge as a browser.

Thanks for responding. I actually did a similar solution now. After preloading some resources I show a text to the user "click to continue" and only after that touch event, I go to the real game and from there music playing is working.

Thank you xpenatan :)