Search code examples
javascripthtmlhtml5-audio

How to make HTML audio tag work in Opera?


i'm trying to add autoplay audio in my html page and i already tried embed and audio with and without controls and optional attributes, and absolute path. Tried different formats, though i know that Opera supports .ogg. My last try is here:

<audio controls id="music1">
    <source src="./models/laughing.ogg" type="audio/ogg"/>
</audio>

html page and audio file are located like this:

image of problem

if i press play button audio is played, but when i start my entire project the button is covered (as should be). And anyway i want it to be autoplay so My Opera is the last version, Windows


Solution

  • Autoplay doesn't typically work. You need some sort of user interaction, like a click.

    There is nothing you can really do about this. It's a browser "feature" to prevent ads from playing audio in the background.