|
|
@ -9,9 +9,7 @@ function moveSpeed(amount) {
|
|
|
|
if (currentIndex < 0 || currentIndex >= PLAYBACK_RATES.length) {
|
|
|
|
if (currentIndex < 0 || currentIndex >= PLAYBACK_RATES.length) {
|
|
|
|
return; // We've reached/exceeded the edge
|
|
|
|
return; // We've reached/exceeded the edge
|
|
|
|
}
|
|
|
|
}
|
|
|
|
videoElement.playbackRate = PLAYBACK_RATES[currentIndex];
|
|
|
|
setSpeed(videoElement, PLAYBACK_RATES[currentIndex]);
|
|
|
|
const playbackSelector = document.getElementById("video-controls-playback-speed");
|
|
|
|
|
|
|
|
playbackSelector.value = videoElement.playbackRate;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function increaseSpeed() {
|
|
|
|
function increaseSpeed() {
|
|
|
@ -22,6 +20,12 @@ function decreaseSpeed() {
|
|
|
|
moveSpeed(-1);
|
|
|
|
moveSpeed(-1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function setSpeed(videoElement, speed) {
|
|
|
|
|
|
|
|
videoElement.playbackRate = speed;
|
|
|
|
|
|
|
|
const playbackSelector = document.getElementById("video-controls-playback-speed");
|
|
|
|
|
|
|
|
playbackSelector.value = speed;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
document.addEventListener("keypress", (event) => {
|
|
|
|
document.addEventListener("keypress", (event) => {
|
|
|
|
if (event.target.nodeName === "INPUT" || event.target.nodeName === "TEXTAREA") {
|
|
|
|
if (event.target.nodeName === "INPUT" || event.target.nodeName === "TEXTAREA") {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
@ -79,6 +83,9 @@ document.addEventListener("keypress", (event) => {
|
|
|
|
case "L":
|
|
|
|
case "L":
|
|
|
|
videoElement.currentTime += 1;
|
|
|
|
videoElement.currentTime += 1;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "m":
|
|
|
|
|
|
|
|
videoElement.muted = !videoElement.muted;
|
|
|
|
|
|
|
|
break;
|
|
|
|
case ",":
|
|
|
|
case ",":
|
|
|
|
videoElement.currentTime -= 1 / VIDEO_FRAMES_PER_SECOND;
|
|
|
|
videoElement.currentTime -= 1 / VIDEO_FRAMES_PER_SECOND;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@ -88,9 +95,15 @@ document.addEventListener("keypress", (event) => {
|
|
|
|
case "=":
|
|
|
|
case "=":
|
|
|
|
increaseSpeed();
|
|
|
|
increaseSpeed();
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "+":
|
|
|
|
|
|
|
|
setSpeed(videoElement, PLAYBACK_RATES[PLAYBACK_RATES.length - 1]);
|
|
|
|
|
|
|
|
break;
|
|
|
|
case "-":
|
|
|
|
case "-":
|
|
|
|
decreaseSpeed();
|
|
|
|
decreaseSpeed();
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "_":
|
|
|
|
|
|
|
|
setSpeed(videoElement, PLAYBACK_RATES[0]);
|
|
|
|
|
|
|
|
break;
|
|
|
|
case "[":
|
|
|
|
case "[":
|
|
|
|
if (typeof setCurrentRangeStartToVideoTime === "function") {
|
|
|
|
if (typeof setCurrentRangeStartToVideoTime === "function") {
|
|
|
|
setCurrentRangeStartToVideoTime();
|
|
|
|
setCurrentRangeStartToVideoTime();
|
|
|
|