Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an oncomplete event for HTML5 audio?

Tags:

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 trying to play through an array of sounds one after the other.

Thanks.

like image 486
james Avatar asked Feb 23 '11 14:02

james


1 Answers

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); 
like image 161
the JinX Avatar answered Oct 02 '22 12:10

the JinX