1 Minute HTML CSS Part 15 – Audio

HTML AUDIO

<audio
  src="MUSIC.mp3"
  controls
  loop
  autoplay
  muted>
</audio>
  • src Source file.
  • controls Show the audio controls.
  • loop Loop the audio when it ends.
  • autoplay Start the audio automatically when sufficiently loaded. But take note, this may not always work.
  • muted Mute the audio by default… Kind of beats the point.

 

NOTES ON AUTOPLAY

  • Most browsers do not allow “autoplay on page load”.
  • General rule is – User has to click on the page at least once for autoplay to engage.
  • Autoplay also depends on the user’s preference/security settings.

Leave a Comment

Your email address will not be published. Required fields are marked *