Sound playground in documention is not working

In the Audio documentation, we can find this playground.

const music = new BABYLON.Sound("Music", "music.wav", scene, function () { 
  // Sound has been downloaded & decoded
  music.play();
});

This playground is not working (Firefox and Chrome), I do not hear the music even after clicking the sound icon. Is that a bug ?

However, the playground with autoplay is working as expected.

It does work for me, but I guess this is because I gave the playground permission to play audio. Does the browser show you a button to enable audio when you open it?

This didn’t happen for me on Edge, but it did on Firefox. After I click the audio play button, the sound doesn’t start immediately, and I have to re-run the playground for it to play.

Yes I click on the sound icon to enable the sound, and my browser tab is not muted : other playgrounds with autoplay option work as expected.

@carolhmj strange, even if I reload the tab, I still have no sound.

  • Ubuntu 20.04.6 LTS
  • Firefox 112.0.2
  • Chromium 112.0.5615.49

By the way, is there an option to enable sound automatically instead of clicking the icon ? I found nothing about that in documentation.

We are doing everything we can to make sure audio is working, but this limitation comes from the browsers themselves - audio is only played after the user approved it.

I didn’t reload the page, I just clicked on the Playground’s play button again.

Oh ok, indeed I also hear the sound in this case.