From ab36d2f25c6181797e0b0ef07f57d2c9a8bab3ce Mon Sep 17 00:00:00 2001 From: catShark <1716967236@qq.com> Date: Sun, 18 Oct 2026 01:07:44 +0800 Subject: [PATCH] caps: ask the real decoder, and stop the client from over-claiming HEVC The capability probe only ever asked canPlayType about Main profile (8-bit) codec strings, which is why the project notes said "8K HEVC: supported" right up until a Main 10 file showed up and could not be decoded at all. It now also asks about Main 10, and -- more importantly -- asks the decoder itself. The override: Jellyfin Web derives its entire HEVC claim from canPlayType (browserDeviceProfile.js): if (canPlayType('video/mp4; codecs="hvc1.2.4.L183"')) { maxHevcLevel = 183; // level 6.1 = 8K hevcProfiles = 'main|main 10'; } canPlayType answers "does this system have an HEVC decoder", not "can it do 8192x4096 Main 10 at 60fps". A desktop that merely ships an HEVC decoder therefore claims 8K Main 10, the server picks DirectPlay, and playback dies on a black screen with no player UI at all. MediaCapabilities.decodingInfo asks the actual decoder, so its verdict is fed back through canPlayType and Jellyfin's own logic lands on the right profile -- the desktop drops to what it can really do and the server transcodes, while a Quest that genuinely decodes 8K Main 10 keeps DirectPlay. Meta's browser-video docs recommend exactly this API over UA sniffing. Deliberately conservative: only supported === false downgrades. supported:true/smooth:false is recorded but changes nothing -- too close to the edge to act on, and the watchdog already covers "claimed to work, did not". Kill switch if a device reports nonsense: localStorage['jfvr-cpt'] = 'off'. Each level is probed at the resolution it exists for (L120 -> 1080p30, L153 -> 4K60, L183/L186 -> 8K60), because a level string carries no dimensions. Verified against a local harness in three modes, all passing: pc -> 8K Main10 blocked, Jellyfin caps at level 153, the 8K Main 10 file exceeds the claim and the server transcodes quest -> nothing blocked, claim stays >= 183, DirectPlay preserved off -> hook not installed, canPlayType untouched, old behaviour restored Also re-ran the playback watchdog on the new bundle: still fires on media error. Also widens the harness gitignore to _harness*.html for the new codec harness. --- .gitignore | 2 +- dist/jfvr.js | 166 +++++++++++++++++++++++++++++++++++++++++++++++-- src/00-core.js | 166 +++++++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 325 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index cb64996..f256edd 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,7 @@ secrets*.md # deploy.py --legacy actually uses), so only the legacy one is tracked. /jfvr-mvp.js # Temporary offline test page (fake