I have a div containing a video. The background of the div features a fake \"play\" button, which I\'ve designed to use as the play button instead of Youtube\'s standard video
Here's what you're looking for:
http://jsfiddle.net/7Gznb/
// when video ends
function onPlayerStateChange(event) {
if(event.data === 0) {
alert('done');
//do something here
}
That's the Youtube API by the way
Take a look in the API, it seems there is events.
player.addEventListener('onStateChange', function(e) {
if (e.data === 0) {
// If state is 0 (ended), do something
}
});
Also, on the side note:
It looks like your YouTube video needs to be embed via JavaScript for events. To do so,