Is there an oncomplete
event for HTML5 audio? I could not find anything on this. I am trying to play a sound after it completes.
Well, specifically I am
The correct way to to this is using the addEventListener
function:
audio.addEventListener('ended', PlayNext);
There is the ended
event . . .
http://dev.w3.org/html5/spec/Overview.html#event-media-ended
Example:
var audioElement = document.getElementById("myAudio");
audioElement.addEventListener('ended', function() {
// Audio has ended when this function is executed.
},false);