HTML5 game is muted until canvas clicked or key pressed

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By FarbrorMartin

My exported HTML5 game is muted until I click the screen or press a key.
I have checked the option to “Focus canvas on start”.
It works fine otherwise, and the sound works fine once it’s unmuted. On desktop the game works as it should.

I’m guessing that maybe the canvas is not allowed to play audio in the browser if it doesn’t have focus.
Is there a way around this?

Currently I’m considering a start screen where the user has to press a key to continue. A simple solution, but it shouldn’t be necessary.

:bust_in_silhouette: Reply From: FarbrorMartin

As a work around I make the player press a key on the keyboard to start the game. Not ideal, but it gets the job done.

:bust_in_silhouette: Reply From: ChildLearning.Club

This is not related to Godot but to browser speculations.

Doing something like your workaround as you suggest is the only way I know to work with it.