0

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.

Dharman
  • 30,962
  • 25
  • 85
  • 135
rac0208
  • 39
  • 1
  • 8
  • You have to add the `muted` attribute, and frankly; if that doesn't work anymore; they've removed that functionality, you'll have to look into using JS/JQuery manipulation – EGC Nov 04 '19 at 22:22
  • 2
    Possible duplicate of [How to make audio autoplay on chrome](https://stackoverflow.com/questions/50490304/how-to-make-audio-autoplay-on-chrome) – EGC Nov 04 '19 at 22:23

0 Answers0