-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
74 lines (67 loc) · 1.97 KB
/
script.js
File metadata and controls
74 lines (67 loc) · 1.97 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
var video = document.getElementById('myved');
console.log(video);
var controls = document.getElementById('controll');
video.addEventListener('mouseover',function () {
controls.style.visibility='visible';
controls.style.transform='translateY(-25px)';
controls.style.transition='0.2s';
});
video.addEventListener('mouseout',function () {
controls.style.visibility='hidden';
controls.style.transition='5s';
});
var button_play = document.getElementById('butt');
console.log(typeof(button_play));
var playing = 'false';
button_play.addEventListener('click', function play_pause() {
if(playing =='false'){
video.play();
playing = 'true';
}
else{
video.pause();
playing = 'false';
}
});
var time = document.getElementById('time');
function gettime(){
var currentTime = Math.floor(video.currentTime/60) + ':'+ Math.floor(video.currentTime)%60 + ' / ' + Math.floor(video.duration/60) + ':'+ Math.floor(video.duration)%60;
time.innerHTML = currentTime;
console.log(currentTime);
}
setInterval(gettime,1000);
var muteb = document.getElementById('mute');
muteb.addEventListener('click',function (){
console.log("click");
if(video.muted == false){
video.muted=true;
}
else{
video.volume=0.5;
video.muted=false;
}
});
var container=document.getElementById('container');
var full = document.getElementById('fullscreen');
full.addEventListener('click',function togglefull() {
if(container.style.height=='540px'){
container.style.width='100vw';
container.style.height='100vh';
}else{
container.style.width='960px';
container.style.height='540px';
}
});
var ctvol = document.getElementById('vol-input');
ctvol.addEventListener('change',function () {
video.volume=this.value;
});
var videotime = document.getElementById('progress-input');
videotime.addEventListener('change',function () {
video.currentTime=video.duration*(this.value)/100;
});
function set() {
ctvol.value=video.volume;
videotime.value=100*(video.currentTime/video.duration);
}
setInterval(set,1000);