Is there a load event that fires when an audio has finished loading? I am creating an audio element like so.
var myAudio = new Audio("mySound.mp3");
myAudio.load();
Tried adding an eventListener like so but it does not seem to fire.
myAudio.addEventListener("load",soundLoaded,false);
It sounds like you want the "canplaythrough" event. This fires when the browser thinks it can play the whole audio file without stopping.
Try:
myAudio.addEventListener('canplaythrough', soundLoaded, false);
There are 7 events that fire in this order when an audio file is loaded:
Please note this is not supported in Internet Explorer versions before 9.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With