WebGL builds and autoplaying background music

Godot Version 3.5


I’ve been porting a short game from Unity to Godot, and noticing that in WebGL builds, my background music won’t play on the title screen (until there’s some keyboard input, which gets rather messy). I have a setup similar to GDQuest’s persistent background music tutorial here, and the same issue can be reproduced by downloading the mini-project and exporting it for HTML5. Everything works as expected in the editor and other build targets.

Is there a way to preload and autoplay music in WebGL builds? Or should the game be designed not to have audio until there’s player input? I’m not seeing much documentation around this, beyond WebGL is a bit “hither be dragons” in general.


No, that’s an HTML5 limitation. Autoplay is not available until the user interacts with the site Autoplay guide for media and Web Audio APIs - Web media technologies | MDN