0 votes

Hi
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.

Godot version 3.4.2
in Engine by (28 points)

2 Answers

0 votes

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.

by (28 points)
0 votes

This is not related to Godot but to browser speculations.
https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide
Doing something like your workaround as you suggest is the only way I know to work with it.

by (56 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.