Skip to content

Instantly share code, notes, and snippets.

@dmolsen
Created December 19, 2011 00:42
Show Gist options
  • Save dmolsen/1494961 to your computer and use it in GitHub Desktop.
Save dmolsen/1494961 to your computer and use it in GitHub Desktop.
Initializing the YouTubePlayer object to listen to onStateChange events
var vidId = 'videoEmbed'; // the ID of the div holding the video
var vidYTId = 'XhLrlhFzAjA'; // the ID of the video from YouTube
var YTVideo = new YoutubePlayer(vidId, vidYTId,{
width: 640,
height: 360,
objparams: { allowFullscreen: "true" },
ytparams: { rel: 0, showsearch: 0, showinfo: 0, modestbranding: 1 }
});
// objparams are the parameters that might get included in the old embed code (e.g. fullscreen)
// ytparams are the youtube player parameters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment