Some files never produce a picture on some machines. The Quest decodes the
8K HEVC Main 10 files fine; a Windows desktop browser claims HEVC Main 10 up to
level 6.1 via canPlayType() (Jellyfin Web builds its device profile from that,
browserDeviceProfile.js) so the server picks Direct Play, and the desktop GPU
cannot actually decode it. Result: black screen and a spinner.
The user-visible symptom is worse than it sounds: Jellyfin Web creates the whole
player UI only after 'playbackstart', which never fires, so the OSD -- including
the quality menu -- is never built. There is literally nothing to click to lower
the bitrate. Load order, from the source:
HtmlVideoPlayer.play() htmlVideoPlayer/plugin.js:502
createMediaElement() :1802 spinner + <div.videoPlayerContainer>
+ <video>, inserted with no src yet
setCurrentSrc() :593 elem.src = url
-> loadedmetadata -> canplay -> play -> 'playbackstart'
-> OSD controller (apps/legacy/controllers/playback/video/index.js:591)
So 40-watchdog.js watches for exactly the pre-OSD state: a .videoPlayerContainer
whose <video> still has videoWidth === 0. It fires immediately on a media error,
or after 15s (45s when the src is already an HLS transcode, where the server has
to produce segments first). It stands down the moment there is a picture, and
never runs during a VR session.
The panel names the format (fetched from the Jellyfin API), explains the cause,
and offers 20/8/3 Mbps plus "keep waiting". A choice writes the same localStorage
keys Jellyfin's own menu writes and reloads: window.playbackManager is not
reachable from injected script (verified: undefined; window.Emby only has Page),
so the settings path is the only option. Note the upstream key really is
'enableautobitratebitrate-...' with "bitrate" twice; reproduced deliberately.
A 120s cooldown in sessionStorage stops it nagging a slow-but-working playback.
Verified against a local harness (3 cases, all passing): healthy playback ->
never arms; media error -> immediate; hung stream -> ~16.4s; dismiss -> hides and
persists the cooldown, and stayed hidden 20s past the threshold; bitrate choice
-> writes maxbitrate-Video-true/false=20000000 and
enableautobitratebitrate-Video-true/false=false, then reloads.
83 lines
2.5 KiB
Python
83 lines
2.5 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Concatenate src/*.js (in filename order) into dist/jfvr.js.
|
|
|
|
Each module is already a self-contained IIFE that attaches to window.__JFVR,
|
|
so the build is a straight concatenation with a banner. No minification: the
|
|
deployed file stays readable in DevTools, which matters because on-device
|
|
debugging happens over CDP.
|
|
|
|
Usage:
|
|
python3 build.py # build
|
|
python3 build.py --check # build + syntax check every module
|
|
"""
|
|
import hashlib
|
|
import os
|
|
import subprocess
|
|
import sys
|
|
|
|
HERE = os.path.dirname(os.path.abspath(__file__))
|
|
SRC = os.path.join(HERE, "src")
|
|
DIST = os.path.join(HERE, "dist")
|
|
OUT = os.path.join(DIST, "jfvr.js")
|
|
|
|
ORDER = ["00-core.js", "10-subtitles.js", "20-controls.js", "30-hands.js", "40-watchdog.js", "90-main.js"]
|
|
|
|
|
|
def sources():
|
|
"""Return (path, text) for every module, in load order."""
|
|
found = sorted(f for f in os.listdir(SRC) if f.endswith(".js"))
|
|
ordered = [f for f in ORDER if f in found]
|
|
ordered += [f for f in found if f not in ORDER]
|
|
if not ordered:
|
|
sys.exit("no sources in %s" % SRC)
|
|
return [(f, open(os.path.join(SRC, f), encoding="utf-8").read()) for f in ordered]
|
|
|
|
|
|
def syntax_check():
|
|
bad = 0
|
|
for name, _ in sources():
|
|
p = os.path.join(SRC, name)
|
|
r = subprocess.run(["node", "--check", p], capture_output=True, text=True)
|
|
status = "ok" if r.returncode == 0 else "FAIL"
|
|
print(" %-18s %s" % (name, status))
|
|
if r.returncode != 0:
|
|
print(r.stderr.strip())
|
|
bad += 1
|
|
return bad
|
|
|
|
|
|
def main():
|
|
if "--check" in sys.argv:
|
|
print("syntax check:")
|
|
sys.exit(1 if syntax_check() else 0)
|
|
|
|
mods = sources()
|
|
parts = [
|
|
"/*!",
|
|
" * JFVR (Jellyfin Web VR) — built bundle. DO NOT EDIT.",
|
|
" * Edit src/*.js and run: python3 build.py",
|
|
" * Modules: " + ", ".join(n for n, _ in mods),
|
|
" */",
|
|
]
|
|
for name, text in mods:
|
|
parts.append("\n/* ===== %s ===== */\n" % name)
|
|
parts.append(text.rstrip("\n"))
|
|
parts.append("\n")
|
|
bundle = "\n".join(parts)
|
|
|
|
os.makedirs(DIST, exist_ok=True)
|
|
with open(OUT, "w", encoding="utf-8") as fh:
|
|
fh.write(bundle)
|
|
|
|
digest = hashlib.md5(bundle.encode()).hexdigest()
|
|
print("built %s" % OUT)
|
|
print(" modules : %d (%s)" % (len(mods), ", ".join(n for n, _ in mods)))
|
|
print(" bytes : %d" % len(bundle))
|
|
print(" md5 : %s" % digest)
|
|
print(" version : %s" % digest[:6])
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|