HTML5 Video Within Time Frame
So I am working on an interactive HTML5 video player, and currently have everything working while using popcorn.js, but I am now trying to go back and make my player work without b
Solution 1:
You could check fewer than the while
loop would.
var check = setInterval(function() {
if (myVideo.currentTime >= 5) {
clearInterval(check);
console.log("5 seconds reached");
}
}, 500);
You than can start this again when the user pauses and starts over or if he jumps to another time within the timeline.
Solution 2:
Try using the following so your function will run only once every second.
setInterval(function(){
if(myVideo.currentTime >= 0 && myVideo.currentTime <= 5){
console.log(myVideo.currentTime);
}
},1000);
Good luck!
Post a Comment for "HTML5 Video Within Time Frame"