lundi 4 novembre 2019

How to make autoplay audio work on chrome

I'm creating a game and I need to add background music to it. I tried adding an audio tag in HTML and and adding autoplay and loop to it. It loops, but the audio won't play when I load the page.

I've tried using iframe, which I've found in many solutions, but none of them worked.

<audio autoplay loop controls>
<source src="bgmusic.mp3">
</audio>

I'm hoping that when I open the page, the music starts automatically, but instead, it stays paused.




Aucun commentaire:

Enregistrer un commentaire