Created
June 29, 2012 17:05
-
-
Save chrisallick/3019246 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
onYouTubePlayerReady = function( playerId ) { | |
ytplayer = document.getElementById( "video_container" ); | |
ytplayer.addEventListener("onStateChange", "onytplayerStateChange"); | |
ytplayer.addEventListener("onError", "onytplayerError"); | |
ytplayer.playVideo(); | |
} | |
function onytplayerStateChange(newState) { | |
if( newState == 0 ) { | |
playNextVideo(); | |
} | |
} | |
// on error just go to next vid | |
function onytplayerError(error) { | |
playNextVideo() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment