mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-10 08:18:29 +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,
|
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") || "";
|
||||||
|
@ -675,27 +676,14 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
video.on('play', () => {
|
video.on('play', () => {
|
||||||
// Set initial sync point at 0.01 seconds
|
if (Math.abs(video.currentTime() - audio.currentTime) > 0.3) {
|
||||||
video.currentTime(0.01);
|
audio.currentTime = video.currentTime();
|
||||||
audio.currentTime = 0.01;
|
}
|
||||||
|
|
||||||
// Wait for both video and audio to be buffered sufficiently
|
if (isVideoBuffered()) {
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -703,6 +691,8 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||||
audio.pause();
|
audio.pause();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
video.on('seeking', handleSeek);
|
video.on('seeking', handleSeek);
|
||||||
|
|
||||||
video.on('seeked', () => {
|
video.on('seeked', () => {
|
||||||
|
@ -725,7 +715,6 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||||
video.pause();
|
video.pause();
|
||||||
audio.pause();
|
audio.pause();
|
||||||
});
|
});
|
||||||
|
|
||||||
document.addEventListener('fullscreenchange', () => {
|
document.addEventListener('fullscreenchange', () => {
|
||||||
if (!document.fullscreenElement) {
|
if (!document.fullscreenElement) {
|
||||||
video.pause();
|
video.pause();
|
||||||
|
|
Loading…
Reference in a new issue