* player now syncs on pause; fixed NaN:NaN
This commit is contained in:
parent
1071524793
commit
0079fbaf70
|
@ -67,6 +67,7 @@ window.addEventListener('DOMContentLoaded', (event) => {
|
|||
classList.add('ytp-button-play');
|
||||
video.pause();
|
||||
if (audio.src) {
|
||||
audio.currentTime = video.currentTime; // sync audio to video on pause
|
||||
audio.pause();
|
||||
}
|
||||
}
|
||||
|
@ -82,12 +83,16 @@ window.addEventListener('DOMContentLoaded', (event) => {
|
|||
Math.floor(video.currentTime % 60)
|
||||
.toString()
|
||||
.padStart(2, '0');
|
||||
document.querySelector('.ytp-time-duration').innerHTML =
|
||||
Math.floor(video.duration / 60) +
|
||||
':' +
|
||||
Math.floor(video.duration % 60)
|
||||
.toString()
|
||||
.padStart(2, '0');
|
||||
if (isNaN(video.duration)) {
|
||||
document.querySelector('.ytp-time-duration').innerHTML = '0:00';
|
||||
} else {
|
||||
document.querySelector('.ytp-time-duration').innerHTML =
|
||||
Math.floor(video.duration / 60) +
|
||||
':' +
|
||||
Math.floor(video.duration % 60)
|
||||
.toString()
|
||||
.padStart(2, '0');
|
||||
}
|
||||
document.querySelector('.ytp-play-progress').style.transform = 'scaleX(' + video.currentTime / video.duration + ')';
|
||||
document.querySelector('.html5-scrubber-button').style.left = (video.currentTime / video.duration) * 100 + '%';
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue