mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-17 02:34:38 -05:00
bwa
This commit is contained in:
parent
4a55d5c92c
commit
98f80c3ced
1 changed files with 93 additions and 93 deletions
|
@ -7,7 +7,8 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||
|
||||
const qua = new URLSearchParams(window.location.search).get("quality") || "";
|
||||
localStorage.setItem(`progress-${new URLSearchParams(window.location.search).get('v')}`, 0);
|
||||
if (qua !== "medium") {
|
||||
|
||||
if (qua !== "medium") {
|
||||
const audio = document.getElementById('aud');
|
||||
|
||||
const syncVolume = () => {
|
||||
|
@ -47,14 +48,9 @@ if (qua !== "medium") {
|
|||
video.play();
|
||||
audio.play();
|
||||
}
|
||||
}, { once: true });
|
||||
}
|
||||
};
|
||||
|
||||
const playBothIfBuffered = () => {
|
||||
if (isVideoBuffered() && checkAudioBuffer()) {
|
||||
video.play();
|
||||
audio.play();
|
||||
}, {
|
||||
once: true
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -78,17 +74,22 @@ if (qua !== "medium") {
|
|||
video.on('waiting', () => {
|
||||
video.pause();
|
||||
audio.pause();
|
||||
|
||||
// Add event listener to resume when buffering is done
|
||||
video.on('canplaythrough', playBothIfBuffered);
|
||||
});
|
||||
|
||||
video.on('canplaythrough', playBothIfBuffered);
|
||||
video.on('canplaythrough', () => {
|
||||
if (!video.paused()) {
|
||||
video.play();
|
||||
audio.play();
|
||||
}
|
||||
});
|
||||
|
||||
video.on('seeking', handleSeek);
|
||||
|
||||
video.on('seeked', () => {
|
||||
playBothIfBuffered();
|
||||
if (isVideoBuffered()) {
|
||||
video.play();
|
||||
}
|
||||
audio.play(); // Ensure audio is playing after seek
|
||||
});
|
||||
|
||||
video.on('volumechange', syncVolume);
|
||||
|
@ -104,15 +105,14 @@ if (qua !== "medium") {
|
|||
video.pause();
|
||||
audio.pause();
|
||||
});
|
||||
|
||||
document.addEventListener('fullscreenchange', () => {
|
||||
if (!document.fullscreenElement) {
|
||||
video.pause();
|
||||
audio.pause();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
window.pokePlayer = {
|
||||
ver:`16-vjs-${videojs.VERSION}`,
|
||||
|
|
Loading…
Reference in a new issue