+ 1
JS | NEED YOU HELP PLZ !!
How do I do in javascript to give an alert if it reaches a certain minute of a video ?
4 ответов
+ 4
Calm down, I got you covered, buddy. :)
Let's say you want to pause the video using the Js alert.
Check the currentTime in the timeupdateevent callback:
var pausetime = 2; // stop at 2 seconds var myPlayer = videojs('example_video_1'); myPlayer.on('timeupdate', function(e) { if (myPlayer.currentTime() >= pausetime) { myPlayer.pause(); } }); myPlayer.play();
Dr.
+ 2
Oh man thanks :D
+ 2
It is not every day you only spend 2 mins of your time just to make someone happy. I'd say it was an investment well used of my time for later, don't you think? ;-)
Let me know if you encounter something else in the future.
Cheers!
Dr.
+ 1
Sure like to see what you are working on and whether you are including any vtt files