Skip to content

Instantly share code, notes, and snippets.

@dmolsen
Created December 19, 2011 01:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmolsen/1495027 to your computer and use it in GitHub Desktop.
Save dmolsen/1495027 to your computer and use it in GitHub Desktop.
Examples of two onStateChange events
// listen for when the viewer decides to start playing the video
// hide the intro & outro text divs as well as "lower the lights"
YTVideo.on('playing', function() {
document.getElementById('intro').setAttribute('class', 'text hide');
document.getElementById('outro').setAttribute('class', 'text hide');
document.getElementById('lights').setAttribute('class', 'darken');
});
// listen for when the video ends
// show the outro text div as well as "bring up the lights"
YTVideo.on('ended', function() {
document.getElementById('outro').setAttribute('class', 'text show');
document.getElementById('lights').setAttribute('class', 'lighten');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment