Created
January 19, 2012 03:23
-
-
Save cole-gillespie/1637537 to your computer and use it in GitHub Desktop.
popcorn no butter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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