mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-29 18:48:45 +01:00
Update html/poketube.ejs
This commit is contained in:
parent
18785ff8c7
commit
db151c1ec2
1 changed files with 94 additions and 77 deletions
|
@ -624,7 +624,6 @@ background-color: #0000;
|
||||||
controls: true,
|
controls: true,
|
||||||
autoplay: false,
|
autoplay: false,
|
||||||
preload: 'auto',
|
preload: 'auto',
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const qua = new URLSearchParams(window.location.search).get("quality") || "";
|
const qua = new URLSearchParams(window.location.search).get("quality") || "";
|
||||||
|
@ -676,10 +675,28 @@ background-color: #0000;
|
||||||
};
|
};
|
||||||
|
|
||||||
video.on('play', () => {
|
video.on('play', () => {
|
||||||
if (isVideoBuffered()) {
|
// Sync audio with video before playing
|
||||||
|
if (Math.abs(video.currentTime() - audio.currentTime) > 0.3) {
|
||||||
|
audio.currentTime = video.currentTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wait for both video and audio to be buffered sufficiently
|
||||||
|
if (isVideoBuffered() && checkAudioBuffer()) {
|
||||||
|
video.play();
|
||||||
audio.play();
|
audio.play();
|
||||||
} else {
|
} else {
|
||||||
video.pause();
|
video.pause();
|
||||||
|
audio.pause();
|
||||||
|
|
||||||
|
const bufferListener = () => {
|
||||||
|
if (isVideoBuffered() && checkAudioBuffer()) {
|
||||||
|
video.play();
|
||||||
|
audio.play();
|
||||||
|
audio.removeEventListener('canplay', bufferListener);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
audio.addEventListener('canplay', bufferListener);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -687,8 +704,6 @@ background-color: #0000;
|
||||||
audio.pause();
|
audio.pause();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
video.on('seeking', handleSeek);
|
video.on('seeking', handleSeek);
|
||||||
|
|
||||||
video.on('seeked', () => {
|
video.on('seeked', () => {
|
||||||
|
@ -711,6 +726,7 @@ background-color: #0000;
|
||||||
video.pause();
|
video.pause();
|
||||||
audio.pause();
|
audio.pause();
|
||||||
});
|
});
|
||||||
|
|
||||||
document.addEventListener('fullscreenchange', () => {
|
document.addEventListener('fullscreenchange', () => {
|
||||||
if (!document.fullscreenElement) {
|
if (!document.fullscreenElement) {
|
||||||
video.pause();
|
video.pause();
|
||||||
|
@ -720,6 +736,7 @@ background-color: #0000;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<% if(dm) { %>
|
<% if(dm) { %>
|
||||||
|
|
Loading…
Reference in a new issue