-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
49 lines (39 loc) · 1.28 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
const $video = document.querySelector('#video');
const $play = document.querySelector('#play');
const $pause = document.querySelector('#pause');
const $backward = document.querySelector('#backward');
const $forward = document.querySelector('#forward');
const $progress = document.querySelector('#progress')
$pause.hidden = true;
$play.addEventListener('click', () => {
$video.play();
$play.hidden = true;
$pause.hidden = false;
console.log('PLAY!');
});
$pause.addEventListener('click', () => {
$video.pause();
$play.hidden = false;
$pause.hidden = true;
console.log('PAUSE!!');
});
$backward.addEventListener('click', () => {
$video.currentTime -= 10
console.log('para atras 10 seg', $video.currentTime)
});
$forward.addEventListener('click', () => {
$video.currentTime += 10
console.log('para adelante 10 seg', $video.currentTime)
});
$video.addEventListener('loadedmetadata', () => {
$progress.max = $video.duration
console.log('Ha cargado mi video', $video.duration);
});
$video.addEventListener('timeupdate', () => {
$progress.value = $video.currentTime
// console.log('tiempo actual', $video.currentTime)
});
$progress.addEventListener('input', () => {
$video.currentTime = $progress.value
console.log($progress.value)
});