-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path28.js
More file actions
19 lines (18 loc) · 720 Bytes
/
28.js
File metadata and controls
19 lines (18 loc) · 720 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
function speedScrubber() {
const speed = document.querySelector(".speed");
const bar = speed.querySelector(".speed-bar");
const video = document.querySelector(".flex");
function handleMove(e) {
const y = e.pageY - this.offsetTop;
const percent = y / this.offsetHeight;
const min = 0.5;
const max = 4;
const height = Math.round(percent * 100) + "%";
const playbackRate = percent * (max - min) + min;
bar.style.height = height;
bar.textContent = playbackRate.toFixed(2) + "x";
video.playbackRate = playbackRate;
}
speed.addEventListener("mousemove", handleMove);
}
window.addEventListener("DOMContentLoaded", speedScrubber);