Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a7b097a344 | ||
|
|
4f82de9ffa |
Vendored
+73
-20
@@ -394,8 +394,11 @@
|
||||
* 10-bit will still claim 10-bit at that level and can black-screen on such a
|
||||
* file. 40-watchdog.js covers exactly that, which is why it stays.
|
||||
*
|
||||
* Escape hatches, if a device reports nonsense:
|
||||
* localStorage['jfvr-cpt'] = 'off' disable the hook entirely
|
||||
* THE HOOK IS OFF BY DEFAULT. The plugin no longer influences Jellyfin's
|
||||
* direct-play / transcode decision at all -- Jellyfin uses its native device
|
||||
* profile, and when playback cannot keep up the 40-watchdog.js prompt lets the
|
||||
* user pick a bitrate. The override is kept only as an opt-in experiment:
|
||||
* localStorage['jfvr-cpt'] = 'on' enable the canPlayType hook
|
||||
* localStorage['jfvr-cpt-keep'] = '2:183' never downgrade these tiers
|
||||
*/
|
||||
|
||||
@@ -571,10 +574,15 @@
|
||||
}
|
||||
|
||||
(function probeCodecs() {
|
||||
// Kill switch, and the escape hatch if this ever misbehaves on a device.
|
||||
try {
|
||||
if (localStorage.getItem('jfvr-cpt') === 'off') { NS.caps.cptMode = 'off'; return; }
|
||||
} catch (e) {}
|
||||
// Native behavior is the default: do NOT install the canPlayType override,
|
||||
// so Jellyfin builds its own device profile exactly as it would without this
|
||||
// plugin. Opt back in with localStorage['jfvr-cpt'] = 'on' when diagnosing.
|
||||
// The decodingInfo probe still runs so the diagnostics panel can report what
|
||||
// the device really supports -- it just no longer changes any decision.
|
||||
var hookOn = false;
|
||||
try { hookOn = localStorage.getItem('jfvr-cpt') === 'on'; } catch (e) {}
|
||||
NS.caps.cptMode = hookOn ? null : 'off';
|
||||
|
||||
var mc = navigator.mediaCapabilities;
|
||||
if (!mc || typeof mc.decodingInfo !== 'function') { NS.caps.cptMode = 'no-api'; return; }
|
||||
|
||||
@@ -585,7 +593,7 @@
|
||||
// Install FIRST, synchronously, so the hook is in place before anything can
|
||||
// read canPlayType. Until a verdict lands the hook just defers to native,
|
||||
// which is the safe default.
|
||||
installCanPlayTypeOverride();
|
||||
if (hookOn) installCanPlayTypeOverride();
|
||||
|
||||
var pending = CODEC_PROBES.length;
|
||||
CODEC_PROBES.forEach(function (p) {
|
||||
@@ -606,7 +614,8 @@
|
||||
}).then(function () {
|
||||
if (--pending === 0) {
|
||||
applyVerdicts();
|
||||
NS.log('codec probe done; blocked = ' + (NS.caps.codecBlocked.join(', ') || 'none') +
|
||||
NS.log('codec probe done (hook ' + NS.caps.cptMode + '); would block = ' +
|
||||
(NS.caps.codecBlocked.join(', ') || 'none') +
|
||||
(NS.caps.codecKept.length ? '; pinned = ' + NS.caps.codecKept.join(', ') : ''));
|
||||
}
|
||||
});
|
||||
@@ -4745,6 +4754,15 @@
|
||||
var DEAD_MS = 15000;
|
||||
var DEAD_TRANSCODE_MS = 45000;
|
||||
|
||||
// Metadata parsed but the playhead is not moving. This is the silent stall: a
|
||||
// decoder that reads the header and then cannot keep up (8K HEVC Main 10 on a
|
||||
// broken VAAPI driver is the motivating case). The old "has picture" check
|
||||
// only looked at videoWidth/readyState, which are both already set here, so
|
||||
// playback that never advances stood the watchdog down forever and the user
|
||||
// got a frozen picture with no prompt. Give it a little longer than a clean
|
||||
// start, since a heavy 8K stream legitimately buffers early.
|
||||
var STALL_MS = 20000;
|
||||
|
||||
// After the user answers (either way) stay quiet, so a slow-but-working
|
||||
// playback does not get nagged at.
|
||||
var QUIET_MS = 120000;
|
||||
@@ -4765,7 +4783,9 @@
|
||||
lastReason: '',
|
||||
applied: null,
|
||||
codec: null, // filled in best-effort from the Jellyfin API
|
||||
panel: null
|
||||
panel: null,
|
||||
lastTime: -1, // playhead seen on the previous poll
|
||||
progressAt: 0 // when the playhead last moved
|
||||
};
|
||||
NS.Watchdog = W;
|
||||
|
||||
@@ -4791,7 +4811,7 @@
|
||||
return src.indexOf('/hls') >= 0 || src.indexOf('.m3u8') >= 0;
|
||||
}
|
||||
|
||||
/** Metadata parsed AND a frame available. False means "no picture". */
|
||||
/** Metadata parsed AND a frame available. False means "no picture at all". */
|
||||
function hasPicture(v) {
|
||||
return v.videoWidth > 0 && v.readyState >= 2;
|
||||
}
|
||||
@@ -4933,17 +4953,25 @@
|
||||
|
||||
var p = NS.makeEl('div', 'jfvr-wd');
|
||||
p.id = 'jfvr-wd';
|
||||
p.appendChild(NS.makeEl('h3', null, '视频没能开始播放'));
|
||||
p.appendChild(NS.makeEl('h3', null,
|
||||
reason === 'stalled' ? '视频播放卡住了' : '视频没能开始播放'));
|
||||
|
||||
var body = NS.makeEl('div', 'jfvr-wd-body');
|
||||
|
||||
var msg = NS.makeEl('p');
|
||||
var waited = Math.round(timeoutMs(v) / 1000);
|
||||
var intro;
|
||||
if (reason === 'error') {
|
||||
intro = '播放器报错了,一个画面都没解出来。';
|
||||
} else if (reason === 'stalled') {
|
||||
intro = '画面已经出来了,但播放进度停住不动了(<code>currentTime</code> 不再前进)—— ' +
|
||||
'解码器跟不上这个文件。';
|
||||
} else {
|
||||
intro = '等了 ' + waited + ' 秒都没拿到任何画面(<code>videoWidth = 0</code>),' +
|
||||
'所以播放器界面也没有被创建出来。';
|
||||
}
|
||||
msg.innerHTML =
|
||||
(reason === 'error'
|
||||
? '播放器报错了,一个画面都没解出来。'
|
||||
: '等了 ' + waited + ' 秒都没拿到任何画面(<code>videoWidth = 0</code>),' +
|
||||
'所以播放器界面也没有被创建出来。') +
|
||||
intro +
|
||||
'最常见的原因是<strong>这台设备解不动这个格式</strong>:' +
|
||||
'<span class="jfvr-wd-fmt">' + (W.codec || '该格式') + '</span>。<br>' +
|
||||
'让服务器转码成 H.264 再播就能看到画面,代价是画质下降(这台 NAS 的转码上限约 4K)。';
|
||||
@@ -4985,7 +5013,7 @@
|
||||
W.panel = p;
|
||||
|
||||
NS.recordError('watchdog', new Error('playback never started: ' + reason));
|
||||
log('watchdog: playback never started, reason =', reason, 'codec =', W.codec);
|
||||
log('watchdog: prompt shown, reason =', reason, 'codec =', W.codec);
|
||||
}
|
||||
|
||||
function hide() {
|
||||
@@ -4995,6 +5023,8 @@
|
||||
|
||||
function reset() {
|
||||
W.seenAt = 0;
|
||||
W.lastTime = -1;
|
||||
W.progressAt = 0;
|
||||
W.codec = null;
|
||||
if (W.shown) hide();
|
||||
}
|
||||
@@ -5015,9 +5045,6 @@
|
||||
var v = playerVideo();
|
||||
if (!v) { reset(); return; }
|
||||
|
||||
// Playback is fine (or at least has a picture): stand down.
|
||||
if (hasPicture(v)) { reset(); return; }
|
||||
|
||||
// A media error is unambiguous — no need to wait out the timer.
|
||||
if (v.error) {
|
||||
describeCodec(v);
|
||||
@@ -5026,6 +5053,31 @@
|
||||
return;
|
||||
}
|
||||
|
||||
// Metadata is parsed and a frame exists. That is NOT enough to call it
|
||||
// healthy: a decoder that read the header and then cannot keep up leaves
|
||||
// videoWidth/readyState set while currentTime never moves. Only a moving
|
||||
// playhead counts as playback.
|
||||
if (hasPicture(v)) {
|
||||
if (!W.progressAt) W.progressAt = now();
|
||||
|
||||
// Paused / seeking is the user's doing, not a stall.
|
||||
if (v.paused || v.seeking) { W.progressAt = now(); W.lastTime = v.currentTime; return; }
|
||||
|
||||
if (v.currentTime !== W.lastTime) {
|
||||
W.lastTime = v.currentTime;
|
||||
W.progressAt = now();
|
||||
if (W.shown) hide(); // it recovered (e.g. after a transcode switch)
|
||||
return;
|
||||
}
|
||||
|
||||
if (now() - W.progressAt < STALL_MS) return;
|
||||
if (W.quietUntil && now() < W.quietUntil) return;
|
||||
describeCodec(v);
|
||||
show(v, 'stalled');
|
||||
return;
|
||||
}
|
||||
|
||||
// No picture at all yet: the original "never started" case.
|
||||
if (!W.seenAt) W.seenAt = now();
|
||||
if (now() - W.seenAt < timeoutMs(v)) return;
|
||||
|
||||
@@ -5038,7 +5090,8 @@
|
||||
NS.Watchdog.init = function () {
|
||||
W.quietUntil = readQuiet();
|
||||
setInterval(poll, POLL_MS);
|
||||
log('watchdog armed (dead=' + DEAD_MS + 'ms, transcode=' + DEAD_TRANSCODE_MS + 'ms)');
|
||||
log('watchdog armed (dead=' + DEAD_MS + 'ms, transcode=' + DEAD_TRANSCODE_MS +
|
||||
'ms, stall=' + STALL_MS + 'ms)');
|
||||
};
|
||||
})();
|
||||
|
||||
|
||||
@@ -7,6 +7,14 @@
|
||||
"owner": "cat-shark",
|
||||
"category": "General",
|
||||
"versions": [
|
||||
{
|
||||
"version": "0.5.3.0",
|
||||
"targetAbi": "12.0.0.0",
|
||||
"changelog": "Bundle version: `99e506`\n\nFirst plugin build. The web bundle is embedded in the DLL and served from /JFVR/jfvr.js; index.html is rewritten at request time, so nothing is written to the jellyfin-web folder on disk.",
|
||||
"sourceUrl": "https://git.cat-shark.xyz/cat-shark/jellyfin_vr_web_plugin/releases/download/v0.5.3.0/Jellyfin.Plugin.JFVR_12.0.0.0.zip",
|
||||
"checksum": "657AA20A07471AAE96AD5B36E5875A18",
|
||||
"timestamp": "2026-10-19T15:51:07"
|
||||
},
|
||||
{
|
||||
"version": "0.5.2.0",
|
||||
"targetAbi": "12.0.0.0",
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
# (InstallationManager.GetAvailablePackages), so one package covers all of 12.x.
|
||||
name: "Jellyfin Web VR"
|
||||
guid: "7d33ef59-f9b0-412b-93bd-5cd5353018de"
|
||||
version: "0.5.2.0"
|
||||
version: "0.5.3.0"
|
||||
targetAbi: "12.0.0.0"
|
||||
framework: "net10.0"
|
||||
overview: "VR180/VR360 playback inside Jellyfin Web for Meta Quest 3."
|
||||
|
||||
+17
-8
@@ -386,8 +386,11 @@
|
||||
* 10-bit will still claim 10-bit at that level and can black-screen on such a
|
||||
* file. 40-watchdog.js covers exactly that, which is why it stays.
|
||||
*
|
||||
* Escape hatches, if a device reports nonsense:
|
||||
* localStorage['jfvr-cpt'] = 'off' disable the hook entirely
|
||||
* THE HOOK IS OFF BY DEFAULT. The plugin no longer influences Jellyfin's
|
||||
* direct-play / transcode decision at all -- Jellyfin uses its native device
|
||||
* profile, and when playback cannot keep up the 40-watchdog.js prompt lets the
|
||||
* user pick a bitrate. The override is kept only as an opt-in experiment:
|
||||
* localStorage['jfvr-cpt'] = 'on' enable the canPlayType hook
|
||||
* localStorage['jfvr-cpt-keep'] = '2:183' never downgrade these tiers
|
||||
*/
|
||||
|
||||
@@ -563,10 +566,15 @@
|
||||
}
|
||||
|
||||
(function probeCodecs() {
|
||||
// Kill switch, and the escape hatch if this ever misbehaves on a device.
|
||||
try {
|
||||
if (localStorage.getItem('jfvr-cpt') === 'off') { NS.caps.cptMode = 'off'; return; }
|
||||
} catch (e) {}
|
||||
// Native behavior is the default: do NOT install the canPlayType override,
|
||||
// so Jellyfin builds its own device profile exactly as it would without this
|
||||
// plugin. Opt back in with localStorage['jfvr-cpt'] = 'on' when diagnosing.
|
||||
// The decodingInfo probe still runs so the diagnostics panel can report what
|
||||
// the device really supports -- it just no longer changes any decision.
|
||||
var hookOn = false;
|
||||
try { hookOn = localStorage.getItem('jfvr-cpt') === 'on'; } catch (e) {}
|
||||
NS.caps.cptMode = hookOn ? null : 'off';
|
||||
|
||||
var mc = navigator.mediaCapabilities;
|
||||
if (!mc || typeof mc.decodingInfo !== 'function') { NS.caps.cptMode = 'no-api'; return; }
|
||||
|
||||
@@ -577,7 +585,7 @@
|
||||
// Install FIRST, synchronously, so the hook is in place before anything can
|
||||
// read canPlayType. Until a verdict lands the hook just defers to native,
|
||||
// which is the safe default.
|
||||
installCanPlayTypeOverride();
|
||||
if (hookOn) installCanPlayTypeOverride();
|
||||
|
||||
var pending = CODEC_PROBES.length;
|
||||
CODEC_PROBES.forEach(function (p) {
|
||||
@@ -598,7 +606,8 @@
|
||||
}).then(function () {
|
||||
if (--pending === 0) {
|
||||
applyVerdicts();
|
||||
NS.log('codec probe done; blocked = ' + (NS.caps.codecBlocked.join(', ') || 'none') +
|
||||
NS.log('codec probe done (hook ' + NS.caps.cptMode + '); would block = ' +
|
||||
(NS.caps.codecBlocked.join(', ') || 'none') +
|
||||
(NS.caps.codecKept.length ? '; pinned = ' + NS.caps.codecKept.join(', ') : ''));
|
||||
}
|
||||
});
|
||||
|
||||
+56
-12
@@ -59,6 +59,15 @@
|
||||
var DEAD_MS = 15000;
|
||||
var DEAD_TRANSCODE_MS = 45000;
|
||||
|
||||
// Metadata parsed but the playhead is not moving. This is the silent stall: a
|
||||
// decoder that reads the header and then cannot keep up (8K HEVC Main 10 on a
|
||||
// broken VAAPI driver is the motivating case). The old "has picture" check
|
||||
// only looked at videoWidth/readyState, which are both already set here, so
|
||||
// playback that never advances stood the watchdog down forever and the user
|
||||
// got a frozen picture with no prompt. Give it a little longer than a clean
|
||||
// start, since a heavy 8K stream legitimately buffers early.
|
||||
var STALL_MS = 20000;
|
||||
|
||||
// After the user answers (either way) stay quiet, so a slow-but-working
|
||||
// playback does not get nagged at.
|
||||
var QUIET_MS = 120000;
|
||||
@@ -79,7 +88,9 @@
|
||||
lastReason: '',
|
||||
applied: null,
|
||||
codec: null, // filled in best-effort from the Jellyfin API
|
||||
panel: null
|
||||
panel: null,
|
||||
lastTime: -1, // playhead seen on the previous poll
|
||||
progressAt: 0 // when the playhead last moved
|
||||
};
|
||||
NS.Watchdog = W;
|
||||
|
||||
@@ -105,7 +116,7 @@
|
||||
return src.indexOf('/hls') >= 0 || src.indexOf('.m3u8') >= 0;
|
||||
}
|
||||
|
||||
/** Metadata parsed AND a frame available. False means "no picture". */
|
||||
/** Metadata parsed AND a frame available. False means "no picture at all". */
|
||||
function hasPicture(v) {
|
||||
return v.videoWidth > 0 && v.readyState >= 2;
|
||||
}
|
||||
@@ -247,17 +258,25 @@
|
||||
|
||||
var p = NS.makeEl('div', 'jfvr-wd');
|
||||
p.id = 'jfvr-wd';
|
||||
p.appendChild(NS.makeEl('h3', null, '视频没能开始播放'));
|
||||
p.appendChild(NS.makeEl('h3', null,
|
||||
reason === 'stalled' ? '视频播放卡住了' : '视频没能开始播放'));
|
||||
|
||||
var body = NS.makeEl('div', 'jfvr-wd-body');
|
||||
|
||||
var msg = NS.makeEl('p');
|
||||
var waited = Math.round(timeoutMs(v) / 1000);
|
||||
var intro;
|
||||
if (reason === 'error') {
|
||||
intro = '播放器报错了,一个画面都没解出来。';
|
||||
} else if (reason === 'stalled') {
|
||||
intro = '画面已经出来了,但播放进度停住不动了(<code>currentTime</code> 不再前进)—— ' +
|
||||
'解码器跟不上这个文件。';
|
||||
} else {
|
||||
intro = '等了 ' + waited + ' 秒都没拿到任何画面(<code>videoWidth = 0</code>),' +
|
||||
'所以播放器界面也没有被创建出来。';
|
||||
}
|
||||
msg.innerHTML =
|
||||
(reason === 'error'
|
||||
? '播放器报错了,一个画面都没解出来。'
|
||||
: '等了 ' + waited + ' 秒都没拿到任何画面(<code>videoWidth = 0</code>),' +
|
||||
'所以播放器界面也没有被创建出来。') +
|
||||
intro +
|
||||
'最常见的原因是<strong>这台设备解不动这个格式</strong>:' +
|
||||
'<span class="jfvr-wd-fmt">' + (W.codec || '该格式') + '</span>。<br>' +
|
||||
'让服务器转码成 H.264 再播就能看到画面,代价是画质下降(这台 NAS 的转码上限约 4K)。';
|
||||
@@ -299,7 +318,7 @@
|
||||
W.panel = p;
|
||||
|
||||
NS.recordError('watchdog', new Error('playback never started: ' + reason));
|
||||
log('watchdog: playback never started, reason =', reason, 'codec =', W.codec);
|
||||
log('watchdog: prompt shown, reason =', reason, 'codec =', W.codec);
|
||||
}
|
||||
|
||||
function hide() {
|
||||
@@ -309,6 +328,8 @@
|
||||
|
||||
function reset() {
|
||||
W.seenAt = 0;
|
||||
W.lastTime = -1;
|
||||
W.progressAt = 0;
|
||||
W.codec = null;
|
||||
if (W.shown) hide();
|
||||
}
|
||||
@@ -329,9 +350,6 @@
|
||||
var v = playerVideo();
|
||||
if (!v) { reset(); return; }
|
||||
|
||||
// Playback is fine (or at least has a picture): stand down.
|
||||
if (hasPicture(v)) { reset(); return; }
|
||||
|
||||
// A media error is unambiguous — no need to wait out the timer.
|
||||
if (v.error) {
|
||||
describeCodec(v);
|
||||
@@ -340,6 +358,31 @@
|
||||
return;
|
||||
}
|
||||
|
||||
// Metadata is parsed and a frame exists. That is NOT enough to call it
|
||||
// healthy: a decoder that read the header and then cannot keep up leaves
|
||||
// videoWidth/readyState set while currentTime never moves. Only a moving
|
||||
// playhead counts as playback.
|
||||
if (hasPicture(v)) {
|
||||
if (!W.progressAt) W.progressAt = now();
|
||||
|
||||
// Paused / seeking is the user's doing, not a stall.
|
||||
if (v.paused || v.seeking) { W.progressAt = now(); W.lastTime = v.currentTime; return; }
|
||||
|
||||
if (v.currentTime !== W.lastTime) {
|
||||
W.lastTime = v.currentTime;
|
||||
W.progressAt = now();
|
||||
if (W.shown) hide(); // it recovered (e.g. after a transcode switch)
|
||||
return;
|
||||
}
|
||||
|
||||
if (now() - W.progressAt < STALL_MS) return;
|
||||
if (W.quietUntil && now() < W.quietUntil) return;
|
||||
describeCodec(v);
|
||||
show(v, 'stalled');
|
||||
return;
|
||||
}
|
||||
|
||||
// No picture at all yet: the original "never started" case.
|
||||
if (!W.seenAt) W.seenAt = now();
|
||||
if (now() - W.seenAt < timeoutMs(v)) return;
|
||||
|
||||
@@ -352,6 +395,7 @@
|
||||
NS.Watchdog.init = function () {
|
||||
W.quietUntil = readQuiet();
|
||||
setInterval(poll, POLL_MS);
|
||||
log('watchdog armed (dead=' + DEAD_MS + 'ms, transcode=' + DEAD_TRANSCODE_MS + 'ms)');
|
||||
log('watchdog armed (dead=' + DEAD_MS + 'ms, transcode=' + DEAD_TRANSCODE_MS +
|
||||
'ms, stall=' + STALL_MS + 'ms)');
|
||||
};
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user