fix stuff + add stuff
This commit is contained in:
parent
0084cbeb89
commit
59ca0e1602
@ -2,7 +2,6 @@
|
|||||||
var _yt_player = videojs;
|
var _yt_player = videojs;
|
||||||
|
|
||||||
var versionclient = "youtube.player.web_20250917_22_RC00"
|
var versionclient = "youtube.player.web_20250917_22_RC00"
|
||||||
|
|
||||||
document.addEventListener("DOMContentLoaded", () => {
|
document.addEventListener("DOMContentLoaded", () => {
|
||||||
// video.js 8 init - source can be seen in https://poketube.fun/static/vjs.min.js or the vjs.min.js file
|
// video.js 8 init - source can be seen in https://poketube.fun/static/vjs.min.js or the vjs.min.js file
|
||||||
const video = videojs('video', {
|
const video = videojs('video', {
|
||||||
@ -241,17 +240,25 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||||||
try { audio.playbackRate = video.playbackRate(); } catch {}
|
try { audio.playbackRate = video.playbackRate(); } catch {}
|
||||||
});
|
});
|
||||||
|
|
||||||
video.on('play', () => {
|
// --- core sync fix for KDE/Android media controls ---
|
||||||
if (!syncInterval) startSyncLoop();
|
// ensures both pause/play reflect on each other
|
||||||
const vt = Number(video.currentTime());
|
|
||||||
if (Math.abs(vt - Number(audio.currentTime)) > 0.3) safeSetCT(audio, vt);
|
|
||||||
if (audioReady) audio.play()?.catch(()=>{});
|
|
||||||
});
|
|
||||||
|
|
||||||
video.on('pause', () => {
|
video.on('pause', () => {
|
||||||
audio.pause();
|
if (!audio.paused) audio.pause();
|
||||||
clearSyncLoop();
|
clearSyncLoop();
|
||||||
});
|
});
|
||||||
|
audio.addEventListener('pause', () => {
|
||||||
|
if (!video.paused()) video.pause();
|
||||||
|
clearSyncLoop();
|
||||||
|
});
|
||||||
|
video.on('play', () => {
|
||||||
|
if (audio.paused) audio.play()?.catch(()=>{});
|
||||||
|
if (!syncInterval) startSyncLoop();
|
||||||
|
});
|
||||||
|
audio.addEventListener('play', () => {
|
||||||
|
if (video.paused()) video.play()?.catch(()=>{});
|
||||||
|
if (!syncInterval) startSyncLoop();
|
||||||
|
});
|
||||||
|
// -----------------------------------------------
|
||||||
|
|
||||||
// pause audio when video is buffering :3
|
// pause audio when video is buffering :3
|
||||||
video.on('waiting', () => {
|
video.on('waiting', () => {
|
||||||
@ -324,6 +331,7 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// https://codeberg.org/ashley/poke/src/branch/main/src/libpoketube/libpoketube-youtubei-objects.json
|
// https://codeberg.org/ashley/poke/src/branch/main/src/libpoketube/libpoketube-youtubei-objects.json
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user