Audio doesn't play until user clicks on page

Please see the example PG (https://playground.babylonjs.com/#1BZK59#10) provided by the official documentation

If you refresh the PG (maybe twice), the mute icon (shown in image below) stays until the user clicks on the page. Only after the user clicks on the page does the audio play.

Is there a way to have the audio engine load and play a sound without the user having the click the page?

Thank you for your help!

My understanding is that this is a policy of Chrome (and other browsers) not to autoplay audio or video with sound until a user interaction on the page.

There may be fancy hacks/workarounds but you might be better off waiting for the first user interaction or soliciting an interaction.

2 Likes

Ah thank you, Inteja!

This might be useful: Playing Sounds and Music | Babylon.js Documentation

@docEdub will know more if there are more questions.

1 Like

Thanks! This is correct. Browsers do this to avoid annoying ads spamming audio.

1 Like

Thank you all so much :grinning_face_with_smiling_eyes: