public
Created

Examples of two onStateChange events

  • Download Gist
gistfile1.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14
// 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');
});

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.