Hide audio button while keeping the audio


I’m currently facing an issue with the audio. At the moment, I need to click on the small mute/unmute button in the top left corner of the scene to mute/unmute the audio of my game.

Screenshot 2022-12-21 091354

The issue is that I would my audio to play when it is ready without having to enable/disable the button. At the moment, I’m able to remove the audio button via this line of code

Engine.audioEngine.useCustomUnlockedButton = true;

but then, no sound is playing even if I do


What line of code should I add to make that possible?


There’s no line that makes that possible, as every browser requires an user interaction to start audio :sweat_smile: Which is a good thing if you think about it, imagine if ads could just start blaring audio at full volume :slight_smile:

1 Like

Yes I understand that …:sweat_smile:

However, can we hide the button and enable the audio when the player click on the screen?

Ooooh, my bad, I understood you were asking something different :sweat_smile: I dug a bit more in the audio engine, and I could get it to play on click by calling unlock on pointer down: Sounds not ready to play | Babylon.js Playground (babylonjs.com) (it looks like that doesn’t work if the unlock isn’t inside a user interaction, which makes sense)

1 Like

Thanks for the quick reply! However, the audio button is still there and I still have to click on it to enable the audio…

Huh, weird, which browser are you using? :open_mouth: I tested on Edge, Chrome and Firefox but the behavior can be browser dependent :thinking:

1 Like

I tested on Chrome and Edge.

Hey @Rangerz132 just checking in if you’re still having this issue?

Hi! I find out that this issue was only occurring when I was reloading the page which is strange but it’s ok! Thanks