mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-29 15:48:41 +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,
|
||||
autoplay: false,
|
||||
preload: 'auto',
|
||||
|
||||
});
|
||||
|
||||
const qua = new URLSearchParams(window.location.search).get("quality") || "";
|
||||
|
@ -676,10 +675,28 @@ background-color: #0000;
|
|||
};
|
||||
|
||||
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();
|
||||
} else {
|
||||
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();
|
||||
});
|
||||
|
||||
|
||||
|
||||
video.on('seeking', handleSeek);
|
||||
|
||||
video.on('seeked', () => {
|
||||
|
@ -711,6 +726,7 @@ background-color: #0000;
|
|||
video.pause();
|
||||
audio.pause();
|
||||
});
|
||||
|
||||
document.addEventListener('fullscreenchange', () => {
|
||||
if (!document.fullscreenElement) {
|
||||
video.pause();
|
||||
|
@ -720,6 +736,7 @@ background-color: #0000;
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<% if(dm) { %>
|
||||
|
|
Loading…
Reference in a new issue