Skip to content Skip to sidebar Skip to footer

Audio File Not Working On Page Load

document.getElementById('audio_1').addEventListener('ended', function() { this.play(); this.currentTime = 0; }, false); In this music does not start on page load, it repe

Solution 1:

You never start the playback. You need to call .play() onload or use the autoplay attribute in your <audio> tag.

Oh, and you can achieve looping much easier without any JavaScript. Simply use the loop attribute in your <audio> tag.

Post a Comment for "Audio File Not Working On Page Load"