Skip to content

Instantly share code, notes, and snippets.

@anveo
Created January 11, 2009 22:28
Show Gist options
  • Save anveo/45822 to your computer and use it in GitHub Desktop.
Save anveo/45822 to your computer and use it in GitHub Desktop.
/* This works when jQuery is not included */
function onYouTubePlayerReady(playerId) {
ytplayer = document.getElementById("myytplayer");
ytplayer.addEventListener("onStateChange", "onytplayerStateChange");
}
function onytplayerStateChange(newState) {
console.debug("Player's new state: " + newState);
}
onYouTubePlayerReady('myytplayer');
/* This doesn't work */
$('#myytplayer').bind('onStateChange', function(newState) {
console.debug("Player's new state: " + newState);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment