Skip to content

Commit b4cf5a9

Browse files
committed
28 done
1 parent ebe0b39 commit b4cf5a9

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Video Speed Scrubber</title>
6+
<link rel="stylesheet" href="style.css">
7+
</head>
8+
<body>
9+
10+
<div class="wrapper">
11+
<video class="flex" width="765" height="430" src="https://www.dropbox.com/s/nf6jfkwck1glsyo/12%20-%20flex-wrapping-and-columns.mp4?dl=1" loop controls></video>
12+
<div class="speed">
13+
<div class="speed-bar"></div>
14+
</div>
15+
</div>
16+
17+
<script>
18+
const speed = document.querySelector('.speed')
19+
const bar = speed.querySelector('.speed-bar')
20+
const video = document.querySelector('.flex')
21+
22+
function handleMove(e) {
23+
const pct = (e.pageY - this.offsetTop) / this.offsetHeight
24+
const min = 0.4
25+
const max = 3
26+
const height = Math.round(pct*100) + '%'
27+
bar.style.height = height
28+
const playbackRate = (min + (max - min) * pct) .toFixed(1)
29+
bar.textContent = playbackRate + 'x'
30+
video.playbackRate = playbackRate
31+
}
32+
33+
speed.addEventListener('mousemove', handleMove)
34+
</script>
35+
</body>
36+
</html>

0 commit comments

Comments
 (0)