Skip to content Skip to sidebar Skip to footer

Html Audio Element Not Playing On First Time?

I'm using the html audio element in one of my projects where I load the src of the element dynamically using VueJS once the play button is pressed. Everything seems to work fine, b

Solution 1:

This should help

var player= document.getElementById('player');

player.addEventListener('canplaythrough', function() { 
   player.play();
}, false);

Also make sure is event triggered when you press the button.

Post a Comment for "Html Audio Element Not Playing On First Time?"