+ 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 ?

21st Dec 2016, 9:24 PM
Carlos Castro
Carlos Castro - avatar
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.
21st Dec 2016, 9:29 PM
Tristan McCullen
Tristan McCullen - avatar
+ 2
Oh man thanks :D
21st Dec 2016, 9:31 PM
Carlos Castro
Carlos Castro - avatar
+ 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.
21st Dec 2016, 9:40 PM
Tristan McCullen
Tristan McCullen - avatar
+ 1
Sure like to see what you are working on and whether you are including any vtt files
23rd Dec 2016, 12:09 AM
Online Student