Hi guys🙂 , I have an issue where i am trying to play an audio clip on button interaction using auidosource.play(). It works on desktop but not on mobile. Please help on this issue
@serializable(AudioSource)
public bgm?: AudioSource
onstartElement.addEventListener(‘click’, (e) => {
e.preventDefault(); // Prevent default anchor behavior
this.onLetsGoClick?.invoke();
this.bgm?.play();
});
Original Post on Discord
by user 1141289362336784394
What format is your audio clip and which browser does it not load on?
audio format is .mp3
browser-android-chrome
browser-ios-safari
by user 1141289362336784394
And do you get any errors in the console in the browser?
I am getting this message when i click the screen and after 2 sec it gets crashed

by user 1141289362336784394
I didn’t set any callback on click to start audio
by user 1141289362336784394
Does it play if you click the screen anywhere else before clicking your button?
Browsers require a user interaction before they can play audio so that websites can’t blast you with ads. We’re handling that internally but it seems to fail in this case
What means „it gets crashed“?
In android it crash. On Desktop it does not play if i click anywhere else. Only on button it will play.
by user 1141289362336784394
by user 1141289362336784394
On Android clicking anywhere else crashes immediately.
by user 1141289362336784394
7MB and 20min file
by user 1141289362336784394
Hm. Webpages can’t really crash the browser, there must be something else going on. Can you report a bug please?
ohh sorry i mean it crash the webpage not chrome browser.
by user 1141289362336784394
Does this sample work on the device you’re having issues on? Musical Instrument | Needle Engine
yes its working
by user 1141289362336784394
done and where can i find the bug report status
by user 1141289362336784394