Starting audio

I think it has to do with the document not being focused. I tried solving the focus problem, but window.focus doesn’t seem to do anything in Chrome.

https://www.w3schools.com/jsref/met_win_focus.asp

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.

1 Like