Skip to content

Instantly share code, notes, and snippets.

@shuhblam
Created January 19, 2012 03:23
Show Gist options
  • Save shuhblam/1637537 to your computer and use it in GitHub Desktop.
Save shuhblam/1637537 to your computer and use it in GitHub Desktop.
popcorn no butter
document.addEventListener("DOMContentLoaded", function () {
VideoJS.setupAllWhenReady();
var p = Popcorn('#video');
p.code({
start: 0,
end: 10,
onStart: function (options) {
console.log('started')
},
onEnd: function (options) {
console.log('ended')
},
onFrame: function (options) { /*var t = this.Popcorn.instances[0].media.currentTime;*/
}
});
// listen to timeupdate and check for how much of the video is seekable
p.listen("timeupdate", function () {
if (this.seekable().end() > this.duration() / 2) {
// if over half of the video has loaded
console.log(this);
this.controls(true);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment