// Youtube has a JavaScript API: https://developers.google.com/youtube/js_api_reference player.addEventListener("onStateChange", function(state){ if(state === 0){ // the video is end, do something here. } });