Skip to content

Instantly share code, notes, and snippets.

@chrisallick
Created June 26, 2012 19:21
Show Gist options
  • Save chrisallick/2998206 to your computer and use it in GitHub Desktop.
Save chrisallick/2998206 to your computer and use it in GitHub Desktop.
// taken from Best in Class
onYouTubePlayerReady = function( playerId ) {
ytplayer = document.getElementById( "myytplayer" );
ytplayer.addEventListener("onStateChange", "onytplayerStateChange");
ytplayer.playVideo();
//t = setTimeout( transition, 500 );
}
function onytplayerStateChange(newState) {
if( newState == 0 ) {
// just re-embed video if there is only one video in playlist.
playNextVideo();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment