By default, the left and right arrow move the time of the video by 0.01*video duration. So, for a 14400 seconds video, a right arrow press would move the time 144 seconds forward. I want the left and right arrows to move the video by 5 second increments instead.
Here is my code to try to override the left and right arrows, but it doesn't seem to be working as intended. It simply changes the 144 second leap forward to a 149 second leap forward.
vid.onkeydown = function (event) {
let preventDefault = true;
switch (event.code) {
case "ArrowLeft": // left
event.preventDefault();
vid_currentTime = vid.currentTime;
vid.currentTime = vid_currentTime -5;
break;
case "ArrowRight": // right
event.preventDefault();
vid_currentTime = vid.currentTime;
vid.currentTime = vid_currentTime +5;
break;
}
if (preventDefault) {
event.preventDefault();
}
};