Skip to content

Instantly share code, notes, and snippets.

@teimur8
Last active April 7, 2020 16:19
Show Gist options
  • Save teimur8/57c1dceb32a712253ded5a38900e98e5 to your computer and use it in GitHub Desktop.
Save teimur8/57c1dceb32a712253ded5a38900e98e5 to your computer and use it in GitHub Desktop.
var player = document.querySelector('video');
var options = {
start:0,
end: 10000000,
}
player.addEventListener('timeupdate', (e)=>{
if(player.currentTime > options.end){
player.currentTime = options.start;
}
if(Math.round(player.currentTime) % 5 === 0){
console.log(Math.round(player.currentTime));
}
});
playerSet = (_start,_end) => {
player.currentTime = _start;
options.end = _end;
options.start = _start;
player.play();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment