mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-26 07:58:13 +01:00
Update html/poketube.ejs
This commit is contained in:
parent
ad28847a67
commit
4f901e602a
1 changed files with 76 additions and 87 deletions
|
@ -624,6 +624,7 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||
controls: true,
|
||||
autoplay: false,
|
||||
preload: 'auto',
|
||||
|
||||
});
|
||||
|
||||
const qua = new URLSearchParams(window.location.search).get("quality") || "";
|
||||
|
@ -675,27 +676,14 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||
};
|
||||
|
||||
video.on('play', () => {
|
||||
// Set initial sync point at 0.01 seconds
|
||||
video.currentTime(0.01);
|
||||
audio.currentTime = 0.01;
|
||||
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();
|
||||
if (isVideoBuffered()) {
|
||||
audio.play();
|
||||
} else {
|
||||
video.pause();
|
||||
audio.pause();
|
||||
|
||||
const bufferListener = () => {
|
||||
if (isVideoBuffered() && checkAudioBuffer()) {
|
||||
video.play();
|
||||
audio.play();
|
||||
audio.removeEventListener('canplay', bufferListener);
|
||||
}
|
||||
};
|
||||
|
||||
audio.addEventListener('canplay', bufferListener);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -703,6 +691,8 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||
audio.pause();
|
||||
});
|
||||
|
||||
|
||||
|
||||
video.on('seeking', handleSeek);
|
||||
|
||||
video.on('seeked', () => {
|
||||
|
@ -725,7 +715,6 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||
video.pause();
|
||||
audio.pause();
|
||||
});
|
||||
|
||||
document.addEventListener('fullscreenchange', () => {
|
||||
if (!document.fullscreenElement) {
|
||||
video.pause();
|
||||
|
|
Loading…
Reference in a new issue