Home > Net >  Audio won't autoplay
Audio won't autoplay

Time:03-06

<!DOCTYPE html>
<html>
<body>
<audio controls autoplay>
  <source src="Rick Roll.mp3" type="audio/mpeg">
</audio>

</body>
</html>

For some reason, it won't play automatically.

CodePudding user response:

<!DOCTYPE html>
<html>
<body>

<audio controls>
  <source src="horse.ogg" type="audio/ogg">
  <source src="horse.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>


</body>
</html>

CodePudding user response:

media like video or audio will not play automatically anymore. this is a security thing. in order to play the media, user must interact with the page. like a click.

CodePudding user response:

There is a space in your src that is invalid.

<source src="Rick Roll.mp3" type="audio/mpeg">

Try for fix that(if is this):

<source src="RickRoll.mp3" type="audio/mpeg">
  •  Tags:  
  • html
  • Related