Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a7b097a344 | ||
|
|
4f82de9ffa | ||
|
|
d6734e505c | ||
|
|
d20482d5dd | ||
|
|
cf731c16c2 | ||
|
|
03919dab98 | ||
|
|
beba1e66f0 |
+98
@@ -935,3 +935,101 @@ window.__JFVR.capsDiag()
|
||||
- [ ] 探测目前只覆盖 HEVC。AV1 / VP9 走同一套机制,但库里没有这类片源,先不做。
|
||||
- [ ] 网络带宽那一维不在设备档案范围内(档案是在播放开始时判一次的)。Jellyfin 自带的 Auto 码率探测管这个。
|
||||
- [ ] 看门狗(§1.2)现在退居为纯兜底:如果检测结果准了,它就不应该再触发。它仍然保留,作为「声称能播结果没播出来」的最后一道。
|
||||
|
||||
---
|
||||
|
||||
## 19. ADDENDUM 13 — 真机根因:`nvidia-vaapi-driver` 0.0.14 的自引用初始化器
|
||||
|
||||
### 19.1 结论(先看这个)
|
||||
|
||||
本机(Kubuntu / NVIDIA TU116M GTX 1660 Ti Mobile / Chrome 152)播不了 8K Main 10,
|
||||
**根因不在 Jellyfin、不在插件、也不在显卡硬件**,而在 `nvidia-vaapi-driver` 的版本:
|
||||
|
||||
```
|
||||
已安装: nvidia-vaapi-driver 0.0.14-1 (2025-06-08,Ubuntu 26.04 仓库里只有这个)
|
||||
已修复: 0.0.18 (2026-08-31)
|
||||
```
|
||||
|
||||
**升级到 0.0.18 即可,不需要转码、不需要插件做任何补偿。**
|
||||
|
||||
### 19.2 证据链
|
||||
|
||||
**1) 硬件能做,中间层不行** —— 同一文件、同一台机器:
|
||||
|
||||
| 路径 | 结果 |
|
||||
|---|---|
|
||||
| `ffmpeg -hwaccel vaapi`(走 nvidia-vaapi-driver) | ❌ `Failed to create decode context: 2 (resource allocation failed)` |
|
||||
| `ffmpeg -hwaccel cuda`(直连 NVDEC) | ✅ 正常 |
|
||||
| VAAPI 解 8K **Main(8-bit)** | ✅ 正常 |
|
||||
| VAAPI 解 1080p **Main 10** | ✅ 正常 |
|
||||
|
||||
→ 只有 **8K + 10-bit** 这个组合失败;硬件本身没问题。
|
||||
|
||||
**2) Chrome 侧的配置是对的** —— `chrome://gpu` 实测:
|
||||
|
||||
```
|
||||
Graphics Feature Status
|
||||
* Video Decode: Hardware accelerated ← VAAPI 生效中
|
||||
Video Acceleration Information
|
||||
Decode hevc main : 144x144 to 8192x8192 pixels
|
||||
Decode hevc main 10 : 144x144 to 8192x8192 pixels ← 驱动"声称"支持
|
||||
```
|
||||
|
||||
**驱动声称支持 8K Main 10,实际建不出解码器。** 于是:
|
||||
|
||||
```
|
||||
canPlayType('hvc1.2.4.L183') → truthy
|
||||
→ Jellyfin Web 声明 maxHevcLevel=183 / main|main 10
|
||||
→ 服务器选 DirectPlay(日志里没有任何 ffmpeg)
|
||||
→ Chrome 真正解码时 cuvidCreateDecoder 失败
|
||||
→ 黑屏 / 一直转圈(而 OSD 只在 playbackstart 之后创建,所以连码率菜单都没有)
|
||||
```
|
||||
|
||||
**3) 上游 bug** —— 0.0.14 的 `src/vabackend.c`:
|
||||
|
||||
```c
|
||||
CUVIDDECODECREATEINFO vdci = {
|
||||
.ulWidth = vdci.ulMaxWidth = vdci.ulTargetWidth = picture_width, // ← 在自身初始化器里引用自己
|
||||
.ulHeight = vdci.ulMaxHeight = vdci.ulTargetHeight = picture_height, // C 里这是未定义行为
|
||||
```
|
||||
|
||||
修复提交 `a565237`(2026-07-09)标题即 **"fix: drop self-referential CUVIDDECODECREATEINFO initializer"**,
|
||||
把赋值移出初始化器;`#449`(2026-07-17 合入)把同样的修复镜像到另一个函数。**0.0.17 仍有问题,0.0.18 已修复。**
|
||||
|
||||
### 19.3 Kubuntu 上正确让 Chrome 用显卡
|
||||
|
||||
用户现有的启动参数**是对的**(`chrome://gpu` 已确认 `Video Decode: Hardware accelerated`):
|
||||
|
||||
```
|
||||
--enable-features=VaapiOnNvidiaGPUs,VaapiVideoDecodeLinuxGL,VaapiVideoDecoder
|
||||
--disable-features=UseChromeOSDirectVideoDecoder
|
||||
```
|
||||
|
||||
配套条件:
|
||||
|
||||
- `nvidia-vaapi-driver` **≥ 0.0.18**(当前 0.0.14 → 这是要补的一环)
|
||||
- 驱动 README 要求内核参数 `nvidia-drm.modeset=1`(**本机当前未设置**,`/proc/cmdline` 里没有)
|
||||
- `LIBVA_DRIVER_NAME=nvidia`
|
||||
- 注意:驱动 README 明说 *"specifically designed to be used by Firefox … may not operate correctly in other applications"*、*"Chrome is currently unsupported"*。Chrome 能用但不受官方支持。
|
||||
|
||||
升级(Ubuntu 仓库只有 0.0.14,需从源码构建):
|
||||
|
||||
```bash
|
||||
sudo apt install meson ninja-build libva-dev libegl-dev gstreamer1.0-plugins-bad libffmpeg-nvenc-dev
|
||||
git clone --branch v0.0.18 https://github.com/elFarto/nvidia-vaapi-driver
|
||||
cd nvidia-vaapi-driver && meson setup build && sudo meson install -C build
|
||||
```
|
||||
|
||||
### 19.4 这对插件意味着什么
|
||||
|
||||
升级驱动后:Chrome 能真正解 8K Main 10 → `decodingInfo` 报 `smooth:true` → 插件不拦任何档
|
||||
→ 直连 8K → 看门狗也不会触发。**插件侧不需要做任何补偿。**
|
||||
|
||||
但 **0.5.0.0 的判定逻辑本身有个缺陷,已在 0.5.1.0 修掉**:它在 `smooth === false` 时就压低
|
||||
level 上限,而 Jellyfin 的档案**无法表达「Main 支持到 8K,Main 10 只到 4K」**(level 上限和
|
||||
profile 列表来自同一条 Main 10 判断链)。所以在那台「8-bit 8K 正常、10-bit 8K 失败」的机器上,
|
||||
拦掉 `2:183` 会把**整库 61 个 8-bit 8K 文件**一起拖进转码 —— 而 NAS 转 8K 只能出 1280×640。
|
||||
|
||||
0.5.1.0 改成:**只有当同位深的 Main(8-bit)档也不可用时,才压低 level 上限**(为此补测了
|
||||
Main L5.1 / L6.1 / L6.2 作为对照)。代价是「8-bit 能解、10-bit 不能」的设备仍会声称 10-bit 并在
|
||||
那种文件上黑屏 —— 那正是 `40-watchdog.js` 存在的意义。
|
||||
|
||||
Vendored
+178
-37
@@ -360,28 +360,73 @@
|
||||
* DirectPlay. Meta's browser-video docs recommend exactly this API over UA
|
||||
* sniffing.
|
||||
*
|
||||
* Only a definite "no" downgrades, but "no" has two shapes and both matter:
|
||||
* A tier is blocked when:
|
||||
*
|
||||
* supported === false the decoder cannot handle the format at all
|
||||
* smooth === false it can, but not in real time at that resolution and
|
||||
* frame rate -- the case a desktop with a small HEVC
|
||||
* decoder hits on 8K, where the picture never appears
|
||||
* even though the codec is "supported"
|
||||
* supported === false the decoder cannot handle the format at all
|
||||
* smooth === false it can, but not in real time at that resolution and
|
||||
* frame rate -- the "decoder exists, 8K does not work"
|
||||
* case
|
||||
*
|
||||
* Either one means the server should transcode. A tier that is only
|
||||
* `powerEfficient:false` (software decode) is NOT acted on by itself.
|
||||
* AND, for a Main 10 tier, only when the SAME LEVEL IS ALSO UNUSABLE IN MAIN
|
||||
* (8-bit). That second condition is not cosmetic; it is forced by a real
|
||||
* limitation in Jellyfin's device profile.
|
||||
*
|
||||
* Escape hatches, if a device reports nonsense:
|
||||
* localStorage['jfvr-cpt'] = 'off' disable the hook entirely
|
||||
* browserDeviceProfile.js derives the level ceiling and the profile list from
|
||||
* ONE chain of Main 10 probes -- the only Main (8-bit) probes are L4.0 and
|
||||
* L4.1. So the reachable states are only:
|
||||
*
|
||||
* (120, main) (123, main) (123, main|main 10) (153, main|main 10)
|
||||
* (183, main|main 10) (186, main|main 10)
|
||||
*
|
||||
* "Main up to 8K, Main 10 only up to 4K" is NOT expressible. So blocking
|
||||
* 2:183 on a device that decodes 8-bit 8K but not 10-bit 8K does not just
|
||||
* spare the 10-bit file -- it drags every 8-bit 8K file down to level 153 and
|
||||
* transcodes them too. On a server that cannot transcode 8K in real time
|
||||
* (measured: 8192x4096 -> 1280x640), that trades one broken file for sixty.
|
||||
*
|
||||
* Verified on the machine this was written for: NVIDIA VAAPI decodes
|
||||
* 8192x4096 Main 8-bit fine and fails to create a decoder for 8192x4096
|
||||
* Main 10 (nvidia-vaapi-driver passes the surface bit depth straight to
|
||||
* cuvidCreateDecoder). Its whole library is 8-bit 8K, so lowering the ceiling
|
||||
* would have broken all of it.
|
||||
*
|
||||
* The cost of this rule: a device that decodes 8-bit at a level but not
|
||||
* 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.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
// decodingInfo needs real dimensions; a level string does not carry them, so
|
||||
// each level is probed at the resolution and bitrate it exists for.
|
||||
// each level is probed at the resolution and bitrate it exists for. Main
|
||||
// (8-bit) is probed at the same levels as Main 10 because it is the control
|
||||
// that decides whether a level is really out of reach.
|
||||
//
|
||||
// NOTE on the codec strings: they MUST carry a constraint byte. Chrome's
|
||||
// MediaCapabilities.decodingInfo does not recognise the bare 'hvc1.1.L120'
|
||||
// spelling and answers supported:false for it even on a machine that decodes
|
||||
// HEVC perfectly, while 'hvc1.1.0.L120' is answered correctly. That one
|
||||
// character used to matter far more than it looks: browserDeviceProfile.js
|
||||
// gates the WHOLE hevc entry on supportsHevc(), which is exactly
|
||||
//
|
||||
// canPlayType('...codecs="hvc1.1.L120"') ||
|
||||
// canPlayType('...codecs="hev1.1.L120"') ||
|
||||
// canPlayType('...codecs="hvc1.1.0.L120"') || ...
|
||||
//
|
||||
// so a spurious block of tier 1:120 (all spellings map to it) removes hevc
|
||||
// from every DirectPlayProfile and transcode every HEVC file in the library.
|
||||
// 1:120 is NOT part of Jellyfin's level chain; it is only that gate.
|
||||
var CODEC_PROBES = [
|
||||
{ key: '1:120', name: 'Main L4.0', w: 1920, h: 1080, fps: 30, mbps: 8, codec: 'hvc1.1.L120' },
|
||||
{ key: '1:120', name: 'Main L4.0', w: 1920, h: 1080, fps: 30, mbps: 8, codec: 'hvc1.1.0.L120' },
|
||||
{ key: '1:123', name: 'Main L4.1', w: 1920, h: 1080, fps: 60, mbps: 8, codec: 'hvc1.1.4.L123' },
|
||||
{ key: '1:153', name: 'Main L5.1 (4K)', w: 3840, h: 2160, fps: 60, mbps: 20, codec: 'hvc1.1.5.L153.B0' },
|
||||
{ key: '1:183', name: 'Main L6.1 (8K)', w: 8192, h: 4096, fps: 60, mbps: 30, codec: 'hvc1.1.6.L183.B0' },
|
||||
{ key: '1:186', name: 'Main L6.2 (8K60)', w: 8192, h: 4096, fps: 60, mbps: 30, codec: 'hvc1.1.6.L186.B0' },
|
||||
{ key: '2:123', name: 'Main10 L4.1', w: 1920, h: 1080, fps: 60, mbps: 8, codec: 'hvc1.2.4.L123' },
|
||||
{ key: '2:153', name: 'Main10 L5.1 (4K)', w: 3840, h: 2160, fps: 60, mbps: 20, codec: 'hvc1.2.4.L153' },
|
||||
{ key: '2:183', name: 'Main10 L6.1 (8K)', w: 8192, h: 4096, fps: 60, mbps: 30, codec: 'hvc1.2.4.L183' },
|
||||
@@ -453,14 +498,58 @@
|
||||
return null;
|
||||
}
|
||||
|
||||
/** True when this tier is not usable on its own terms. */
|
||||
function tierUnusable(key) {
|
||||
var v = NS.caps.codec[key];
|
||||
return !!v && !v.error && (v.supported === false || v.smooth === false);
|
||||
}
|
||||
|
||||
/**
|
||||
* The decision the canPlayType hook uses.
|
||||
*
|
||||
* A Main 10 tier is only blocked when the SAME LEVEL is also unusable in Main
|
||||
* (8-bit). See the long comment above CODEC_PROBES: Jellyfin's profile cannot
|
||||
* express "Main up to 8K, Main 10 up to 4K", so blocking 2:183 on a device
|
||||
* that handles 8-bit 8K would drag all of its 8-bit 8K files into transcoding.
|
||||
*/
|
||||
function shouldBlock(key, keep) {
|
||||
var v = NS.caps.codec[key];
|
||||
if (!v || v.error) return null;
|
||||
if (keep.indexOf(key) >= 0) return null;
|
||||
var own = blockReason(v, keep);
|
||||
if (!own) return null;
|
||||
var parts = key.split(':');
|
||||
|
||||
// Base tier. 1:120 is not in Jellyfin's level chain -- it is only the
|
||||
// coarse "does this client have HEVC at all" gate (supportsHevc() in
|
||||
// browserDeviceProfile.js, which probes exactly this level). Blocking it
|
||||
// drops hevc from every DirectPlayProfile, i.e. transcodes the entire
|
||||
// HEVC library. Never act on it unless the device is unusable at EVERY
|
||||
// Main tier, so one flaky/early probe cannot do that.
|
||||
if (key === '1:120') {
|
||||
var anyMainUsable = CODEC_PROBES.some(function (p) {
|
||||
if (p.key === '1:120' || p.key.charAt(0) !== '1') return false;
|
||||
var m = NS.caps.codec[p.key];
|
||||
return !!m && !m.error && m.supported !== false && m.smooth !== false;
|
||||
});
|
||||
if (anyMainUsable) return null;
|
||||
}
|
||||
|
||||
if (parts[0] === '2') {
|
||||
// Control: the same level in Main (8-bit).
|
||||
if (!tierUnusable('1:' + parts[1])) return null;
|
||||
}
|
||||
return own;
|
||||
}
|
||||
|
||||
function applyVerdicts() {
|
||||
var keep = readKeepList();
|
||||
var keep = NS.caps.__keep || [];
|
||||
NS.caps.codecKept = [];
|
||||
NS.caps.codecBlocked = [];
|
||||
CODEC_PROBES.forEach(function (p) {
|
||||
var v = NS.caps.codec[p.key];
|
||||
if (!v) return;
|
||||
var why = blockReason(v, keep);
|
||||
var why = shouldBlock(p.key, keep);
|
||||
if (why) NS.caps.codecBlocked.push(p.name + ' (' + why + ')');
|
||||
else if (keep.indexOf(p.key) >= 0) NS.caps.codecKept.push(p.name);
|
||||
});
|
||||
@@ -475,9 +564,8 @@
|
||||
proto.canPlayType = function (type) {
|
||||
try {
|
||||
var key = hevcKey(type);
|
||||
var v = key && NS.caps.codec[key];
|
||||
// Only a definite "no" is acted on. Anything else is the browser's call.
|
||||
if (v && blockReason(v, NS.caps.__keep || [])) return '';
|
||||
if (key && shouldBlock(key, NS.caps.__keep || [])) return '';
|
||||
} catch (e) { /* never break the native answer */ }
|
||||
return orig.apply(this, arguments);
|
||||
};
|
||||
@@ -486,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; }
|
||||
|
||||
@@ -500,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) {
|
||||
@@ -521,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(', ') : ''));
|
||||
}
|
||||
});
|
||||
@@ -535,11 +629,14 @@
|
||||
var v = c.codec[p.key];
|
||||
if (!v) return ' ' + p.name.padEnd(20) + ' (pending)';
|
||||
if (v.error) return ' ' + p.name.padEnd(20) + ' error: ' + v.error;
|
||||
var why = blockReason(v, keep);
|
||||
var why = shouldBlock(p.key, keep);
|
||||
var own = blockReason(v, keep);
|
||||
var note = why ? ' <-- BLOCKED (' + why + ')' :
|
||||
(own ? ' (unusable, but kept: 8-bit at this level works)' :
|
||||
(keep.indexOf(p.key) >= 0 ? ' <-- pinned' : ''));
|
||||
return ' ' + p.name.padEnd(20) + ' supported=' + v.supported +
|
||||
' smooth=' + v.smooth + ' powerEfficient=' + v.powerEfficient +
|
||||
' [' + v.workload + ']' +
|
||||
(why ? ' <-- BLOCKED (' + why + ')' : (keep.indexOf(p.key) >= 0 ? ' <-- pinned' : ''));
|
||||
' [' + v.workload + ']' + note;
|
||||
}).join('\n');
|
||||
|
||||
return [
|
||||
@@ -4657,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;
|
||||
@@ -4677,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;
|
||||
|
||||
@@ -4703,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;
|
||||
}
|
||||
@@ -4845,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)。';
|
||||
@@ -4897,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() {
|
||||
@@ -4907,6 +5023,8 @@
|
||||
|
||||
function reset() {
|
||||
W.seenAt = 0;
|
||||
W.lastTime = -1;
|
||||
W.progressAt = 0;
|
||||
W.codec = null;
|
||||
if (W.shown) hide();
|
||||
}
|
||||
@@ -4927,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);
|
||||
@@ -4938,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;
|
||||
|
||||
@@ -4950,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,30 @@
|
||||
"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",
|
||||
"changelog": "Bundle version: `16ae94`\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.2.0/Jellyfin.Plugin.JFVR_12.0.0.0.zip",
|
||||
"checksum": "C5BD8E8C384642D4502BE1A0F80B8E68",
|
||||
"timestamp": "2026-10-19T15:01:57"
|
||||
},
|
||||
{
|
||||
"version": "0.5.1.0",
|
||||
"targetAbi": "12.0.0.0",
|
||||
"changelog": "Bundle version: `3e611e`\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.1.0/Jellyfin.Plugin.JFVR_12.0.0.0.zip",
|
||||
"checksum": "54AB6541A1BFD7A62636A435350821E0",
|
||||
"timestamp": "2026-10-18T03:57:47"
|
||||
},
|
||||
{
|
||||
"version": "0.5.0.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.0.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."
|
||||
|
||||
+122
-25
@@ -352,28 +352,73 @@
|
||||
* DirectPlay. Meta's browser-video docs recommend exactly this API over UA
|
||||
* sniffing.
|
||||
*
|
||||
* Only a definite "no" downgrades, but "no" has two shapes and both matter:
|
||||
* A tier is blocked when:
|
||||
*
|
||||
* supported === false the decoder cannot handle the format at all
|
||||
* smooth === false it can, but not in real time at that resolution and
|
||||
* frame rate -- the case a desktop with a small HEVC
|
||||
* decoder hits on 8K, where the picture never appears
|
||||
* even though the codec is "supported"
|
||||
* supported === false the decoder cannot handle the format at all
|
||||
* smooth === false it can, but not in real time at that resolution and
|
||||
* frame rate -- the "decoder exists, 8K does not work"
|
||||
* case
|
||||
*
|
||||
* Either one means the server should transcode. A tier that is only
|
||||
* `powerEfficient:false` (software decode) is NOT acted on by itself.
|
||||
* AND, for a Main 10 tier, only when the SAME LEVEL IS ALSO UNUSABLE IN MAIN
|
||||
* (8-bit). That second condition is not cosmetic; it is forced by a real
|
||||
* limitation in Jellyfin's device profile.
|
||||
*
|
||||
* Escape hatches, if a device reports nonsense:
|
||||
* localStorage['jfvr-cpt'] = 'off' disable the hook entirely
|
||||
* browserDeviceProfile.js derives the level ceiling and the profile list from
|
||||
* ONE chain of Main 10 probes -- the only Main (8-bit) probes are L4.0 and
|
||||
* L4.1. So the reachable states are only:
|
||||
*
|
||||
* (120, main) (123, main) (123, main|main 10) (153, main|main 10)
|
||||
* (183, main|main 10) (186, main|main 10)
|
||||
*
|
||||
* "Main up to 8K, Main 10 only up to 4K" is NOT expressible. So blocking
|
||||
* 2:183 on a device that decodes 8-bit 8K but not 10-bit 8K does not just
|
||||
* spare the 10-bit file -- it drags every 8-bit 8K file down to level 153 and
|
||||
* transcodes them too. On a server that cannot transcode 8K in real time
|
||||
* (measured: 8192x4096 -> 1280x640), that trades one broken file for sixty.
|
||||
*
|
||||
* Verified on the machine this was written for: NVIDIA VAAPI decodes
|
||||
* 8192x4096 Main 8-bit fine and fails to create a decoder for 8192x4096
|
||||
* Main 10 (nvidia-vaapi-driver passes the surface bit depth straight to
|
||||
* cuvidCreateDecoder). Its whole library is 8-bit 8K, so lowering the ceiling
|
||||
* would have broken all of it.
|
||||
*
|
||||
* The cost of this rule: a device that decodes 8-bit at a level but not
|
||||
* 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.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
// decodingInfo needs real dimensions; a level string does not carry them, so
|
||||
// each level is probed at the resolution and bitrate it exists for.
|
||||
// each level is probed at the resolution and bitrate it exists for. Main
|
||||
// (8-bit) is probed at the same levels as Main 10 because it is the control
|
||||
// that decides whether a level is really out of reach.
|
||||
//
|
||||
// NOTE on the codec strings: they MUST carry a constraint byte. Chrome's
|
||||
// MediaCapabilities.decodingInfo does not recognise the bare 'hvc1.1.L120'
|
||||
// spelling and answers supported:false for it even on a machine that decodes
|
||||
// HEVC perfectly, while 'hvc1.1.0.L120' is answered correctly. That one
|
||||
// character used to matter far more than it looks: browserDeviceProfile.js
|
||||
// gates the WHOLE hevc entry on supportsHevc(), which is exactly
|
||||
//
|
||||
// canPlayType('...codecs="hvc1.1.L120"') ||
|
||||
// canPlayType('...codecs="hev1.1.L120"') ||
|
||||
// canPlayType('...codecs="hvc1.1.0.L120"') || ...
|
||||
//
|
||||
// so a spurious block of tier 1:120 (all spellings map to it) removes hevc
|
||||
// from every DirectPlayProfile and transcode every HEVC file in the library.
|
||||
// 1:120 is NOT part of Jellyfin's level chain; it is only that gate.
|
||||
var CODEC_PROBES = [
|
||||
{ key: '1:120', name: 'Main L4.0', w: 1920, h: 1080, fps: 30, mbps: 8, codec: 'hvc1.1.L120' },
|
||||
{ key: '1:120', name: 'Main L4.0', w: 1920, h: 1080, fps: 30, mbps: 8, codec: 'hvc1.1.0.L120' },
|
||||
{ key: '1:123', name: 'Main L4.1', w: 1920, h: 1080, fps: 60, mbps: 8, codec: 'hvc1.1.4.L123' },
|
||||
{ key: '1:153', name: 'Main L5.1 (4K)', w: 3840, h: 2160, fps: 60, mbps: 20, codec: 'hvc1.1.5.L153.B0' },
|
||||
{ key: '1:183', name: 'Main L6.1 (8K)', w: 8192, h: 4096, fps: 60, mbps: 30, codec: 'hvc1.1.6.L183.B0' },
|
||||
{ key: '1:186', name: 'Main L6.2 (8K60)', w: 8192, h: 4096, fps: 60, mbps: 30, codec: 'hvc1.1.6.L186.B0' },
|
||||
{ key: '2:123', name: 'Main10 L4.1', w: 1920, h: 1080, fps: 60, mbps: 8, codec: 'hvc1.2.4.L123' },
|
||||
{ key: '2:153', name: 'Main10 L5.1 (4K)', w: 3840, h: 2160, fps: 60, mbps: 20, codec: 'hvc1.2.4.L153' },
|
||||
{ key: '2:183', name: 'Main10 L6.1 (8K)', w: 8192, h: 4096, fps: 60, mbps: 30, codec: 'hvc1.2.4.L183' },
|
||||
@@ -445,14 +490,58 @@
|
||||
return null;
|
||||
}
|
||||
|
||||
/** True when this tier is not usable on its own terms. */
|
||||
function tierUnusable(key) {
|
||||
var v = NS.caps.codec[key];
|
||||
return !!v && !v.error && (v.supported === false || v.smooth === false);
|
||||
}
|
||||
|
||||
/**
|
||||
* The decision the canPlayType hook uses.
|
||||
*
|
||||
* A Main 10 tier is only blocked when the SAME LEVEL is also unusable in Main
|
||||
* (8-bit). See the long comment above CODEC_PROBES: Jellyfin's profile cannot
|
||||
* express "Main up to 8K, Main 10 up to 4K", so blocking 2:183 on a device
|
||||
* that handles 8-bit 8K would drag all of its 8-bit 8K files into transcoding.
|
||||
*/
|
||||
function shouldBlock(key, keep) {
|
||||
var v = NS.caps.codec[key];
|
||||
if (!v || v.error) return null;
|
||||
if (keep.indexOf(key) >= 0) return null;
|
||||
var own = blockReason(v, keep);
|
||||
if (!own) return null;
|
||||
var parts = key.split(':');
|
||||
|
||||
// Base tier. 1:120 is not in Jellyfin's level chain -- it is only the
|
||||
// coarse "does this client have HEVC at all" gate (supportsHevc() in
|
||||
// browserDeviceProfile.js, which probes exactly this level). Blocking it
|
||||
// drops hevc from every DirectPlayProfile, i.e. transcodes the entire
|
||||
// HEVC library. Never act on it unless the device is unusable at EVERY
|
||||
// Main tier, so one flaky/early probe cannot do that.
|
||||
if (key === '1:120') {
|
||||
var anyMainUsable = CODEC_PROBES.some(function (p) {
|
||||
if (p.key === '1:120' || p.key.charAt(0) !== '1') return false;
|
||||
var m = NS.caps.codec[p.key];
|
||||
return !!m && !m.error && m.supported !== false && m.smooth !== false;
|
||||
});
|
||||
if (anyMainUsable) return null;
|
||||
}
|
||||
|
||||
if (parts[0] === '2') {
|
||||
// Control: the same level in Main (8-bit).
|
||||
if (!tierUnusable('1:' + parts[1])) return null;
|
||||
}
|
||||
return own;
|
||||
}
|
||||
|
||||
function applyVerdicts() {
|
||||
var keep = readKeepList();
|
||||
var keep = NS.caps.__keep || [];
|
||||
NS.caps.codecKept = [];
|
||||
NS.caps.codecBlocked = [];
|
||||
CODEC_PROBES.forEach(function (p) {
|
||||
var v = NS.caps.codec[p.key];
|
||||
if (!v) return;
|
||||
var why = blockReason(v, keep);
|
||||
var why = shouldBlock(p.key, keep);
|
||||
if (why) NS.caps.codecBlocked.push(p.name + ' (' + why + ')');
|
||||
else if (keep.indexOf(p.key) >= 0) NS.caps.codecKept.push(p.name);
|
||||
});
|
||||
@@ -467,9 +556,8 @@
|
||||
proto.canPlayType = function (type) {
|
||||
try {
|
||||
var key = hevcKey(type);
|
||||
var v = key && NS.caps.codec[key];
|
||||
// Only a definite "no" is acted on. Anything else is the browser's call.
|
||||
if (v && blockReason(v, NS.caps.__keep || [])) return '';
|
||||
if (key && shouldBlock(key, NS.caps.__keep || [])) return '';
|
||||
} catch (e) { /* never break the native answer */ }
|
||||
return orig.apply(this, arguments);
|
||||
};
|
||||
@@ -478,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; }
|
||||
|
||||
@@ -492,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) {
|
||||
@@ -513,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(', ') : ''));
|
||||
}
|
||||
});
|
||||
@@ -527,11 +621,14 @@
|
||||
var v = c.codec[p.key];
|
||||
if (!v) return ' ' + p.name.padEnd(20) + ' (pending)';
|
||||
if (v.error) return ' ' + p.name.padEnd(20) + ' error: ' + v.error;
|
||||
var why = blockReason(v, keep);
|
||||
var why = shouldBlock(p.key, keep);
|
||||
var own = blockReason(v, keep);
|
||||
var note = why ? ' <-- BLOCKED (' + why + ')' :
|
||||
(own ? ' (unusable, but kept: 8-bit at this level works)' :
|
||||
(keep.indexOf(p.key) >= 0 ? ' <-- pinned' : ''));
|
||||
return ' ' + p.name.padEnd(20) + ' supported=' + v.supported +
|
||||
' smooth=' + v.smooth + ' powerEfficient=' + v.powerEfficient +
|
||||
' [' + v.workload + ']' +
|
||||
(why ? ' <-- BLOCKED (' + why + ')' : (keep.indexOf(p.key) >= 0 ? ' <-- pinned' : ''));
|
||||
' [' + v.workload + ']' + note;
|
||||
}).join('\n');
|
||||
|
||||
return [
|
||||
|
||||
+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