Skip to content Skip to sidebar Skip to footer

Audio Autoplay Not Working Html5

Something really akward is happening in my code, the autoplay for audio is not working. Basically, every website code that i put this code the music autoplays but in this one is no

Solution 1:

I had the same problem. I solved it by using jquery in the end:

$('audio').on('canplay', function() {
    this.play();
});

Edit: Nowadays I noticed a lot of browsers don't allow autoplay to work if the video sound. So a solution could be adding the muted attribute.

<video autoplay muted>

Solution 2:

Try this:

<audio class="audio" controls autoplay>
  <source src="./1.ogg" type="audio/ogg">
  <source src="./1.mp3" type="audio/mpeg">
 <!-- <embed height="50" width="100" src="./1.mp3"> NOT NECESSARY -->
</audio>

Post a Comment for "Audio Autoplay Not Working Html5"