I have a simple game I’ve put together, initially based on “Making your first Phaser 3 game”: https://apbiologygame.netlify.com/ (I’m a teacher, this may get used as a recruitment piece for my AP class). When it initially opens, the audio does not start playing on Chrome or Edge (it seems to work on Firefox). However, it does play after a return to the intro scene (after playing the game or going to the instructions/credits scenes). It behaves as expected once it starts.
Here’s the code setting up the audio in the initial scene:
I don’t see any difference in Chrome between the focus and blur ‘try it yourself’.
I noticed that while https://apbiologygame.netlify.com/ is still loading if you click the canvas before it appears the music plays normally.
Perhaps include a intro scene just to load all assets, and request a click to start. This will focus the page, begin the next scene where the music is started, and I expect play normally.
Could this have something to do with Chrome’s audio autoplay policies? Recent versions of Chrome require the user to interact with the page in some way before they allow it to play audio. These new policies were introduced quite recently (maybe even in the latest version), so I haven’t had the chance to experiment with them and see how they behave, but your explanation makes it sound likely it’s related to that.