Detect finish of embedded audio [RESOLVED]
Posted: Sun Oct 09, 2011 6:32 pm
I'm still playing with an interactive JS page that plays several .mp3 files when certain conditions occur. Most are musical pieces, from 1 to 3 minutes in duration. I would really like to trigger some other actions when the .mp3 file completes playing, since the lengths are different. I am using the function DHTMLSound(), about which I can find very little useful information (but it is working). Does anyone know if there's any kind of event triggered at the conclusion of playing an .mp3 file, that could be captured?
[Edit: I've gotten around the issue by storing the actual playing duration of each file, in an array with the filenames, so now I just pull both the filename AND the duration (and a description, as a matter of fact) and use the duration to setTimeout() whatever I want to happen when it is finished. That works just fine, although I'm still curious whether there's an "audio complete" event or something like that.]
[Edit: I've gotten around the issue by storing the actual playing duration of each file, in an array with the filenames, so now I just pull both the filename AND the duration (and a description, as a matter of fact) and use the duration to setTimeout() whatever I want to happen when it is finished. That works just fine, although I'm still curious whether there's an "audio complete" event or something like that.]