From df6f0e7345ff417394a4104856dc996e239fa2a6 Mon Sep 17 00:00:00 2001 From: ashley Date: Sun, 5 Oct 2025 18:28:26 +0200 Subject: [PATCH] Update css/player-base.js --- css/player-base.js | 974 +++++++++++++++------------------------------ 1 file changed, 324 insertions(+), 650 deletions(-) diff --git a/css/player-base.js b/css/player-base.js index 9ed5c6f5..2ff38d07 100644 --- a/css/player-base.js +++ b/css/player-base.js @@ -4,687 +4,361 @@ var _yt_player = videojs; var versionclient = "youtube.player.web_20250917_22_RC00" + document.addEventListener("DOMContentLoaded", () => { + const player = videojs('video', { + controls: true, + autoplay: false, + preload: 'auto', + errorDisplay: false, + }); + // --- Params / seed a progress key (best-effort) --- + const qs = new URLSearchParams(location.search); + const qua = qs.get("quality") || ""; + const vidKey = qs.get("v"); + try { if (vidKey) localStorage.setItem(`progress-${vidKey}`, 0); } catch {} + // --- Raw elements --- + const videoEl = document.getElementById('video'); + const audioEl = document.getElementById('aud'); -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 - const video = videojs('video', { - controls: true, - autoplay: false, - preload: 'auto', - errorDisplay: false, - }); + // keep hidden audio truly hidden/quiet + try { + audioEl.controls = false; + audioEl.setAttribute('aria-hidden', 'true'); + audioEl.setAttribute('tabindex', '-1'); + audioEl.setAttribute('controlslist', 'noplaybackrate nodownload noremoteplayback'); + audioEl.disableRemotePlayback = true; + videoEl.setAttribute('playsinline', ''); + audioEl.setAttribute('playsinline', ''); + } catch {} - // todo : remove this code lol - const qs = new URLSearchParams(window.location.search); - const qua = qs.get("quality") || ""; - const vidKey = qs.get('v'); - try { localStorage.setItem(`progress-${vidKey}`, 0); } catch {} + // --- Source helpers --- + const pickAudioSrc = () => { + const s = audioEl?.getAttribute?.('src'); + if (s) return s; + const child = audioEl?.querySelector?.('source'); + if (child?.getAttribute?.('src')) return child.getAttribute('src'); + if (audioEl?.currentSrc) return audioEl.currentSrc; + return null; + }; - // raw media elements - const videoEl = document.getElementById('video'); - const audio = document.getElementById('aud'); - const audioEl = document.getElementById('aud'); - let volGuard = false; - - // resolve initial sources robustly (works whether