Reputation: 41
I tried to make a fan-website for a artist so I wanted to have start page music which automatically plays. But, when I open the start page, my audio file doesn't play.
This is my code:
<audio controls autoplay loop>
<source src="https://s3.amazonaws.com/Syntaxxx/bigger-picture.mp3" type="audio/mpeg" />
<p>If you can read this, your browser does not support the audio element.</p>
</audio>
What I need to do to make this start playing automatically?
Upvotes: 4
Views: 28519
Reputation: 1
I had the same trouble on Microsoft Edge until I got into settings -> search for audio -> then set it to Allow - then it worked:
Upvotes: 0
Reputation: 1
it depends on your browser's [here Firefox] Autoplay preferences (blocked or not) in about:preferences#privacy
Upvotes: 0
Reputation: 526
As of 2020, browser defaults mean this won't work in Firefox (all platforms) and Chrome (Android included, but not Mac it seems).
Upvotes: 1
Reputation: 1403
autoplay is a html standard. It's up to then browser to support it or not. I suspect you used Chrome, like so many others, and were surprised it didn't work. https://www.w3schools.com/tags/att_audio_autoplay.asp If you test this code, like I did, in Firefox 63, it will work fine. Google decided to break the web standard in May 2018: https://bugs.chromium.org/p/chromium/issues/detail?id=840866#c103
Upvotes: 2