-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscripts.js
More file actions
55 lines (42 loc) · 1.43 KB
/
scripts.js
File metadata and controls
55 lines (42 loc) · 1.43 KB
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
50
51
52
53
54
55
const $video = document.querySelector('video');
const $play = document.querySelector('#play');
const $pause = document.querySelector('#pause');
const $forward = document.querySelector('#forward10');
const $backward = document.querySelector('#backward10');
const $progress = document.querySelector('#progress');
$play.addEventListener('click', reproducir);
$pause.addEventListener('click', pausar);
$forward.addEventListener('click', adelantar10);
$backward.addEventListener('click', retroceder10);
function reproducir(event){
$video.play();
$play.hidden = true;
$pause.hidden = false;
$forward.hidden = false;
$backward.hidden = false;
// $rangoVolumen.max;// = $video.duration;
}
function pausar(){
$video.pause();
$play.hidden = false;
$pause.hidden = true;
}
function adelantar10(){
$video.currentTime += 10;
}
function retroceder10(){
$video.currentTime -= 10;
}
$video.addEventListener('loadedmetadata', cargarVideo);
$video.addEventListener('timeupdate', actualizaTiempo);
function cargarVideo(){
$progress.max = $video.duration;
}
function actualizaTiempo(){
$progress.value = $video.currentTime;
// console.log(' tiempo actual ', $video.currentTime );
}
$progress.addEventListener('input', handleInput);
function handleInput() {
$video.currentTime = $progress.value;
}