How to make music autoplay and loop in background

  • The loop attribute makes the audio file loop.
  • The autoplay attribute makes the file start playing without the user needing to play the file.
  • The controls attribute shows the controls, omitting it will hide the controls.
<audio loop autoplay>
    <source src="path/to/file" type="audio/filetype">
</audio>

Audio filetype can be: .mp3, .wav, .ogg

tech