How do you detect when a HTML5 element has finished playing?
Have a look at this Everything You Need to Know About HTML5 Video and Audio post at the Opera Dev site under the "I want to roll my own controls" section.
This is the pertinent section:
then you can use:
onended
is a HTML5 standard event on all media elements, see the HTML5 media element (video/audio) events documentation.