fix playbar
This commit is contained in:
parent
d4ed9e48cf
commit
ca6b399dce
1 changed files with 4 additions and 4 deletions
|
@ -36,7 +36,9 @@ function moveBar(e, bar, vid) {
|
|||
vid.currentTime = prog * vid.duration;
|
||||
}
|
||||
|
||||
function prog(vid, bar) {
|
||||
function prog(vid, bar, play) {
|
||||
play.querySelector('img').src = vid.paused ? '/static/img/play.svg' : '/static/img/stop.svg';
|
||||
|
||||
bar.querySelector('div').style.width = `${vid.currentTime / vid.duration * 100}%`;
|
||||
}
|
||||
|
||||
|
@ -48,8 +50,6 @@ function controls(vid) {
|
|||
let h = document.querySelector('.header');
|
||||
|
||||
video.onclick = play.onclick = () => {
|
||||
play.querySelector('img').src = !video.paused ? '/static/img/play.svg' : '/static/img/stop.svg';
|
||||
|
||||
if (video.paused) {
|
||||
video.play();
|
||||
return;
|
||||
|
@ -71,7 +71,7 @@ function controls(vid) {
|
|||
|
||||
bar.onclick = (e) => moveBar(e, bar, video);
|
||||
|
||||
video.addEventListener('timeupdate', () => prog(video,bar));
|
||||
video.addEventListener('timeupdate', () => prog(video, bar, play));
|
||||
}
|
||||
|
||||
window.onload = function () {
|
||||
|
|
Loading…
Reference in a new issue