0

So I have a music which only plays automatically on edge chromium. On firefox and chrome, it doesn't work. Any solution? THANKS

<audio id="music" autoplay loop style="display:none">
<source src="Music1.mp3" type="audio/mp3">
<source src="Msic1.ogg" type="audio/ogg">
</audio>
  • Can this help? "How to make audio autoplay on chrome" - https://stackoverflow.com/questions/50490304/how-to-make-audio-autoplay-on-chrome – Ihor Vyspiansky Aug 06 '20 at 07:07
  • Concerning the second solution, can you please explain me what to do? Where he says: "Solution #2: There is also another workaround for this according to @Leonard" –  Aug 06 '20 at 07:13
  • Because I don't understand if I should put the audio in the iframe. Or the opposite? –  Aug 06 '20 at 07:25

2 Answers2

0

visit this i think you should use iframe and audio tag as well for non-chrome browsers.

Huzee
  • 114
  • 7
0

Try this, it worked for me. Just need to add the preload attribute. Keep in mind the user must interact with the domain, so click something in any page of the site, once he interacts everything should work fine.

<audio id="music" autoplay loop preload>
<source src="Music1.mp3" type="audio/mp3">
<source src="Msic1.ogg" type="audio/ogg">
</audio>
Yondev
  • 1