Popcorn Unlisten Example
HTML
<script src="http://popcornjs.org/code/dist/popcorn-complete.min.js"></script>
<video height="180" width="300" id="video" controls>
<source src="http://videos.mozilla.org/serv/webmademovies/popcornplug.mp4"></source>
<source src="http://videos.mozilla.org/serv/webmademovies/popcornplug.ogv"></source>
<source src="http://videos.mozilla.org/serv/webmademovies/popcornplug.webm"></source>
</video>
<div id="footnotediv"></div>
CSS
html{font-family:arial;}
JavaScript
// create instance
var $pop = Popcorn("#video");
// listen to timeupdate, logging as long as video plays
$pop.on( "timeupdate", function() {
console.log("WERE PLAYING");
});
// stop listening at 2 seconds
$pop.cue( 2 , function() {
this.off( "timeupdate" );
});
$pop.cue( 3, function() {
console.log( "THIS WILL BE THE LAST LOG" );
});
$pop.play();