Compare commits
2
Commits
v0.5.0.0
...
08cbef83a3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
08cbef83a3 | ||
|
|
c25e40070a |
Vendored
+63
-23
@@ -320,6 +320,7 @@
|
|||||||
/* MediaCapabilities verdicts, keyed '<profile_idc>:<level>'. See below. */
|
/* MediaCapabilities verdicts, keyed '<profile_idc>:<level>'. See below. */
|
||||||
codec: {},
|
codec: {},
|
||||||
codecBlocked: [],
|
codecBlocked: [],
|
||||||
|
codecKept: [],
|
||||||
cptPatched: false,
|
cptPatched: false,
|
||||||
cptMode: null
|
cptMode: null
|
||||||
};
|
};
|
||||||
@@ -359,24 +360,32 @@
|
|||||||
* DirectPlay. Meta's browser-video docs recommend exactly this API over UA
|
* DirectPlay. Meta's browser-video docs recommend exactly this API over UA
|
||||||
* sniffing.
|
* sniffing.
|
||||||
*
|
*
|
||||||
* Only `supported === false` downgrades. `supported:true, smooth:false` is
|
* Only a definite "no" downgrades, but "no" has two shapes and both matter:
|
||||||
* recorded but does not change behaviour: it is too close to the edge to act
|
|
||||||
* on, and 40-watchdog.js already covers "it claimed to work and did not".
|
|
||||||
*
|
*
|
||||||
* Kill switch if a device reports nonsense:
|
* supported === false the decoder cannot handle the format at all
|
||||||
* localStorage['jfvr-cpt'] = 'off' then reload
|
* 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"
|
||||||
|
*
|
||||||
|
* Either one means the server should transcode. A tier that is only
|
||||||
|
* `powerEfficient:false` (software decode) is NOT acted on by itself.
|
||||||
|
*
|
||||||
|
* Escape hatches, if a device reports nonsense:
|
||||||
|
* localStorage['jfvr-cpt'] = 'off' disable the hook entirely
|
||||||
|
* localStorage['jfvr-cpt-keep'] = '2:183' never downgrade these tiers
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// decodingInfo needs real dimensions; a level string does not carry them, so
|
// decodingInfo needs real dimensions; a level string does not carry them, so
|
||||||
// each level is probed at the resolution it exists for.
|
// each level is probed at the resolution and bitrate it exists for.
|
||||||
var CODEC_PROBES = [
|
var CODEC_PROBES = [
|
||||||
{ key: '1:120', name: 'Main L4.0', w: 1920, h: 1080, fps: 30, codec: 'hvc1.1.L120' },
|
{ key: '1:120', name: 'Main L4.0', w: 1920, h: 1080, fps: 30, mbps: 8, codec: 'hvc1.1.L120' },
|
||||||
{ key: '1:123', name: 'Main L4.1', w: 1920, h: 1080, fps: 60, codec: 'hvc1.1.4.L123' },
|
{ key: '1:123', name: 'Main L4.1', w: 1920, h: 1080, fps: 60, mbps: 8, codec: 'hvc1.1.4.L123' },
|
||||||
{ key: '1:183', name: 'Main L6.1 (8K)', w: 8192, h: 4096, fps: 60, codec: 'hvc1.1.6.L183.B0' },
|
{ key: '1:183', name: 'Main L6.1 (8K)', w: 8192, h: 4096, fps: 60, mbps: 30, codec: 'hvc1.1.6.L183.B0' },
|
||||||
{ key: '2:123', name: 'Main10 L4.1', w: 1920, h: 1080, fps: 60, codec: 'hvc1.2.4.L123' },
|
{ 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, codec: 'hvc1.2.4.L153' },
|
{ 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, codec: 'hvc1.2.4.L183' },
|
{ key: '2:183', name: 'Main10 L6.1 (8K)', w: 8192, h: 4096, fps: 60, mbps: 30, codec: 'hvc1.2.4.L183' },
|
||||||
{ key: '2:186', name: 'Main10 L6.2 (8K60)', w: 8192, h: 4096, fps: 60, codec: 'hvc1.2.4.L186' }
|
{ key: '2:186', name: 'Main10 L6.2 (8K60)', w: 8192, h: 4096, fps: 60, mbps: 30, codec: 'hvc1.2.4.L186' }
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -427,11 +436,34 @@
|
|||||||
* MediaCapabilities probe + canPlayType override
|
* MediaCapabilities probe + canPlayType override
|
||||||
* ------------------------------------------------------------------ */
|
* ------------------------------------------------------------------ */
|
||||||
|
|
||||||
|
/** Tiers the user has pinned as "keep claiming this", '<key>,<key>' in localStorage. */
|
||||||
|
function readKeepList() {
|
||||||
|
try {
|
||||||
|
var raw = localStorage.getItem('jfvr-cpt-keep') || '';
|
||||||
|
return raw.split(',').map(function (s) { return s.trim(); }).filter(Boolean);
|
||||||
|
} catch (e) { return []; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Why a verdict means "do not claim this tier", or null if it is fine. */
|
||||||
|
function blockReason(v, keep) {
|
||||||
|
if (!v || v.error) return null; // unknown -> leave it to the browser
|
||||||
|
if (keep.indexOf(v.key) >= 0) return null; // user pinned it
|
||||||
|
if (v.supported === false) return 'unsupported';
|
||||||
|
if (v.smooth === false) return 'not-smooth';
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
function applyVerdicts() {
|
function applyVerdicts() {
|
||||||
NS.caps.codecBlocked = CODEC_PROBES.filter(function (p) {
|
var keep = readKeepList();
|
||||||
|
NS.caps.codecKept = [];
|
||||||
|
NS.caps.codecBlocked = [];
|
||||||
|
CODEC_PROBES.forEach(function (p) {
|
||||||
var v = NS.caps.codec[p.key];
|
var v = NS.caps.codec[p.key];
|
||||||
return v && v.supported === false;
|
if (!v) return;
|
||||||
}).map(function (p) { return p.name; });
|
var why = blockReason(v, keep);
|
||||||
|
if (why) NS.caps.codecBlocked.push(p.name + ' (' + why + ')');
|
||||||
|
else if (keep.indexOf(p.key) >= 0) NS.caps.codecKept.push(p.name);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function installCanPlayTypeOverride() {
|
function installCanPlayTypeOverride() {
|
||||||
@@ -445,7 +477,7 @@
|
|||||||
var key = hevcKey(type);
|
var key = hevcKey(type);
|
||||||
var v = key && NS.caps.codec[key];
|
var v = key && NS.caps.codec[key];
|
||||||
// Only a definite "no" is acted on. Anything else is the browser's call.
|
// Only a definite "no" is acted on. Anything else is the browser's call.
|
||||||
if (v && v.supported === false) return '';
|
if (v && blockReason(v, NS.caps.__keep || [])) return '';
|
||||||
} catch (e) { /* never break the native answer */ }
|
} catch (e) { /* never break the native answer */ }
|
||||||
return orig.apply(this, arguments);
|
return orig.apply(this, arguments);
|
||||||
};
|
};
|
||||||
@@ -461,6 +493,10 @@
|
|||||||
var mc = navigator.mediaCapabilities;
|
var mc = navigator.mediaCapabilities;
|
||||||
if (!mc || typeof mc.decodingInfo !== 'function') { NS.caps.cptMode = 'no-api'; return; }
|
if (!mc || typeof mc.decodingInfo !== 'function') { NS.caps.cptMode = 'no-api'; return; }
|
||||||
|
|
||||||
|
// Read the pin list once, up front: canPlayType is synchronous and must not
|
||||||
|
// touch localStorage on every call.
|
||||||
|
NS.caps.__keep = readKeepList();
|
||||||
|
|
||||||
// Install FIRST, synchronously, so the hook is in place before anything can
|
// Install FIRST, synchronously, so the hook is in place before anything can
|
||||||
// read canPlayType. Until a verdict lands the hook just defers to native,
|
// read canPlayType. Until a verdict lands the hook just defers to native,
|
||||||
// which is the safe default.
|
// which is the safe default.
|
||||||
@@ -472,20 +508,21 @@
|
|||||||
type: 'file',
|
type: 'file',
|
||||||
video: {
|
video: {
|
||||||
contentType: 'video/mp4; codecs="' + p.codec + '"',
|
contentType: 'video/mp4; codecs="' + p.codec + '"',
|
||||||
width: p.w, height: p.h, bitrate: 20000000, framerate: p.fps
|
width: p.w, height: p.h, bitrate: p.mbps * 1000000, framerate: p.fps
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
mc.decodingInfo(cfg).then(function (info) {
|
mc.decodingInfo(cfg).then(function (info) {
|
||||||
NS.caps.codec[p.key] = {
|
NS.caps.codec[p.key] = {
|
||||||
name: p.name, workload: p.w + 'x' + p.h + '@' + p.fps,
|
key: p.key, name: p.name, workload: p.w + 'x' + p.h + '@' + p.fps + ' ' + p.mbps + 'Mbps',
|
||||||
supported: info.supported, smooth: info.smooth, powerEfficient: info.powerEfficient
|
supported: info.supported, smooth: info.smooth, powerEfficient: info.powerEfficient
|
||||||
};
|
};
|
||||||
}).catch(function (e) {
|
}).catch(function (e) {
|
||||||
NS.caps.codec[p.key] = { name: p.name, error: String(e && e.message || e) };
|
NS.caps.codec[p.key] = { key: p.key, name: p.name, error: String(e && e.message || e) };
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
if (--pending === 0) {
|
if (--pending === 0) {
|
||||||
applyVerdicts();
|
applyVerdicts();
|
||||||
NS.log('codec probe done; blocked = ' + (NS.caps.codecBlocked.join(', ') || 'none'));
|
NS.log('codec probe done; blocked = ' + (NS.caps.codecBlocked.join(', ') || 'none') +
|
||||||
|
(NS.caps.codecKept.length ? '; pinned = ' + NS.caps.codecKept.join(', ') : ''));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -493,13 +530,16 @@
|
|||||||
|
|
||||||
NS.capsDiag = function () {
|
NS.capsDiag = function () {
|
||||||
var c = NS.caps;
|
var c = NS.caps;
|
||||||
|
var keep = readKeepList();
|
||||||
var real = CODEC_PROBES.map(function (p) {
|
var real = CODEC_PROBES.map(function (p) {
|
||||||
var v = c.codec[p.key];
|
var v = c.codec[p.key];
|
||||||
if (!v) return ' ' + p.name.padEnd(20) + ' (pending)';
|
if (!v) return ' ' + p.name.padEnd(20) + ' (pending)';
|
||||||
if (v.error) return ' ' + p.name.padEnd(20) + ' error: ' + v.error;
|
if (v.error) return ' ' + p.name.padEnd(20) + ' error: ' + v.error;
|
||||||
|
var why = blockReason(v, keep);
|
||||||
return ' ' + p.name.padEnd(20) + ' supported=' + v.supported +
|
return ' ' + p.name.padEnd(20) + ' supported=' + v.supported +
|
||||||
' smooth=' + v.smooth + ' powerEfficient=' + v.powerEfficient +
|
' smooth=' + v.smooth + ' powerEfficient=' + v.powerEfficient +
|
||||||
' [' + v.workload + ']' + (v.supported === false ? ' <-- BLOCKED' : '');
|
' [' + v.workload + ']' +
|
||||||
|
(why ? ' <-- BLOCKED (' + why + ')' : (keep.indexOf(p.key) >= 0 ? ' <-- pinned' : ''));
|
||||||
}).join('\n');
|
}).join('\n');
|
||||||
|
|
||||||
return [
|
return [
|
||||||
@@ -513,7 +553,7 @@
|
|||||||
'MAX_TEXTURE_SIZE : ' + c.maxTextureSize,
|
'MAX_TEXTURE_SIZE : ' + c.maxTextureSize,
|
||||||
'HEVC canPlayType : ' + JSON.stringify(c.hevc),
|
'HEVC canPlayType : ' + JSON.stringify(c.hevc),
|
||||||
'canPlayType hook : ' + (c.cptMode || 'pending') +
|
'canPlayType hook : ' + (c.cptMode || 'pending') +
|
||||||
(c.cptMode === 'on' ? ' (downgraded: ' + (c.codecBlocked.join(', ') || 'nothing yet') + ')' : ''),
|
(c.cptMode === 'on' ? ' (blocked: ' + (c.codecBlocked.join(', ') || 'nothing yet') + ')' : ''),
|
||||||
'HEVC real (decodingInfo):',
|
'HEVC real (decodingInfo):',
|
||||||
real
|
real
|
||||||
].join('\n');
|
].join('\n');
|
||||||
|
|||||||
@@ -7,6 +7,14 @@
|
|||||||
"owner": "cat-shark",
|
"owner": "cat-shark",
|
||||||
"category": "General",
|
"category": "General",
|
||||||
"versions": [
|
"versions": [
|
||||||
|
{
|
||||||
|
"version": "0.5.0.0",
|
||||||
|
"targetAbi": "12.0.0.0",
|
||||||
|
"changelog": "Bundle version: `72681d`\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.0.0/Jellyfin.Plugin.JFVR_12.0.0.0.zip",
|
||||||
|
"checksum": "F9773C70C9CC4858AF042E40D5CFBAA9",
|
||||||
|
"timestamp": "2026-10-17T17:34:28"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"version": "0.4.0.0",
|
"version": "0.4.0.0",
|
||||||
"targetAbi": "12.0.0.0",
|
"targetAbi": "12.0.0.0",
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@
|
|||||||
# (InstallationManager.GetAvailablePackages), so one package covers all of 12.x.
|
# (InstallationManager.GetAvailablePackages), so one package covers all of 12.x.
|
||||||
name: "Jellyfin Web VR"
|
name: "Jellyfin Web VR"
|
||||||
guid: "7d33ef59-f9b0-412b-93bd-5cd5353018de"
|
guid: "7d33ef59-f9b0-412b-93bd-5cd5353018de"
|
||||||
version: "0.4.0.0"
|
version: "0.5.0.0"
|
||||||
targetAbi: "12.0.0.0"
|
targetAbi: "12.0.0.0"
|
||||||
framework: "net10.0"
|
framework: "net10.0"
|
||||||
overview: "VR180/VR360 playback inside Jellyfin Web for Meta Quest 3."
|
overview: "VR180/VR360 playback inside Jellyfin Web for Meta Quest 3."
|
||||||
|
|||||||
+63
-23
@@ -312,6 +312,7 @@
|
|||||||
/* MediaCapabilities verdicts, keyed '<profile_idc>:<level>'. See below. */
|
/* MediaCapabilities verdicts, keyed '<profile_idc>:<level>'. See below. */
|
||||||
codec: {},
|
codec: {},
|
||||||
codecBlocked: [],
|
codecBlocked: [],
|
||||||
|
codecKept: [],
|
||||||
cptPatched: false,
|
cptPatched: false,
|
||||||
cptMode: null
|
cptMode: null
|
||||||
};
|
};
|
||||||
@@ -351,24 +352,32 @@
|
|||||||
* DirectPlay. Meta's browser-video docs recommend exactly this API over UA
|
* DirectPlay. Meta's browser-video docs recommend exactly this API over UA
|
||||||
* sniffing.
|
* sniffing.
|
||||||
*
|
*
|
||||||
* Only `supported === false` downgrades. `supported:true, smooth:false` is
|
* Only a definite "no" downgrades, but "no" has two shapes and both matter:
|
||||||
* recorded but does not change behaviour: it is too close to the edge to act
|
|
||||||
* on, and 40-watchdog.js already covers "it claimed to work and did not".
|
|
||||||
*
|
*
|
||||||
* Kill switch if a device reports nonsense:
|
* supported === false the decoder cannot handle the format at all
|
||||||
* localStorage['jfvr-cpt'] = 'off' then reload
|
* 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"
|
||||||
|
*
|
||||||
|
* Either one means the server should transcode. A tier that is only
|
||||||
|
* `powerEfficient:false` (software decode) is NOT acted on by itself.
|
||||||
|
*
|
||||||
|
* Escape hatches, if a device reports nonsense:
|
||||||
|
* localStorage['jfvr-cpt'] = 'off' disable the hook entirely
|
||||||
|
* localStorage['jfvr-cpt-keep'] = '2:183' never downgrade these tiers
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// decodingInfo needs real dimensions; a level string does not carry them, so
|
// decodingInfo needs real dimensions; a level string does not carry them, so
|
||||||
// each level is probed at the resolution it exists for.
|
// each level is probed at the resolution and bitrate it exists for.
|
||||||
var CODEC_PROBES = [
|
var CODEC_PROBES = [
|
||||||
{ key: '1:120', name: 'Main L4.0', w: 1920, h: 1080, fps: 30, codec: 'hvc1.1.L120' },
|
{ key: '1:120', name: 'Main L4.0', w: 1920, h: 1080, fps: 30, mbps: 8, codec: 'hvc1.1.L120' },
|
||||||
{ key: '1:123', name: 'Main L4.1', w: 1920, h: 1080, fps: 60, codec: 'hvc1.1.4.L123' },
|
{ key: '1:123', name: 'Main L4.1', w: 1920, h: 1080, fps: 60, mbps: 8, codec: 'hvc1.1.4.L123' },
|
||||||
{ key: '1:183', name: 'Main L6.1 (8K)', w: 8192, h: 4096, fps: 60, codec: 'hvc1.1.6.L183.B0' },
|
{ key: '1:183', name: 'Main L6.1 (8K)', w: 8192, h: 4096, fps: 60, mbps: 30, codec: 'hvc1.1.6.L183.B0' },
|
||||||
{ key: '2:123', name: 'Main10 L4.1', w: 1920, h: 1080, fps: 60, codec: 'hvc1.2.4.L123' },
|
{ 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, codec: 'hvc1.2.4.L153' },
|
{ 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, codec: 'hvc1.2.4.L183' },
|
{ key: '2:183', name: 'Main10 L6.1 (8K)', w: 8192, h: 4096, fps: 60, mbps: 30, codec: 'hvc1.2.4.L183' },
|
||||||
{ key: '2:186', name: 'Main10 L6.2 (8K60)', w: 8192, h: 4096, fps: 60, codec: 'hvc1.2.4.L186' }
|
{ key: '2:186', name: 'Main10 L6.2 (8K60)', w: 8192, h: 4096, fps: 60, mbps: 30, codec: 'hvc1.2.4.L186' }
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -419,11 +428,34 @@
|
|||||||
* MediaCapabilities probe + canPlayType override
|
* MediaCapabilities probe + canPlayType override
|
||||||
* ------------------------------------------------------------------ */
|
* ------------------------------------------------------------------ */
|
||||||
|
|
||||||
|
/** Tiers the user has pinned as "keep claiming this", '<key>,<key>' in localStorage. */
|
||||||
|
function readKeepList() {
|
||||||
|
try {
|
||||||
|
var raw = localStorage.getItem('jfvr-cpt-keep') || '';
|
||||||
|
return raw.split(',').map(function (s) { return s.trim(); }).filter(Boolean);
|
||||||
|
} catch (e) { return []; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Why a verdict means "do not claim this tier", or null if it is fine. */
|
||||||
|
function blockReason(v, keep) {
|
||||||
|
if (!v || v.error) return null; // unknown -> leave it to the browser
|
||||||
|
if (keep.indexOf(v.key) >= 0) return null; // user pinned it
|
||||||
|
if (v.supported === false) return 'unsupported';
|
||||||
|
if (v.smooth === false) return 'not-smooth';
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
function applyVerdicts() {
|
function applyVerdicts() {
|
||||||
NS.caps.codecBlocked = CODEC_PROBES.filter(function (p) {
|
var keep = readKeepList();
|
||||||
|
NS.caps.codecKept = [];
|
||||||
|
NS.caps.codecBlocked = [];
|
||||||
|
CODEC_PROBES.forEach(function (p) {
|
||||||
var v = NS.caps.codec[p.key];
|
var v = NS.caps.codec[p.key];
|
||||||
return v && v.supported === false;
|
if (!v) return;
|
||||||
}).map(function (p) { return p.name; });
|
var why = blockReason(v, keep);
|
||||||
|
if (why) NS.caps.codecBlocked.push(p.name + ' (' + why + ')');
|
||||||
|
else if (keep.indexOf(p.key) >= 0) NS.caps.codecKept.push(p.name);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function installCanPlayTypeOverride() {
|
function installCanPlayTypeOverride() {
|
||||||
@@ -437,7 +469,7 @@
|
|||||||
var key = hevcKey(type);
|
var key = hevcKey(type);
|
||||||
var v = key && NS.caps.codec[key];
|
var v = key && NS.caps.codec[key];
|
||||||
// Only a definite "no" is acted on. Anything else is the browser's call.
|
// Only a definite "no" is acted on. Anything else is the browser's call.
|
||||||
if (v && v.supported === false) return '';
|
if (v && blockReason(v, NS.caps.__keep || [])) return '';
|
||||||
} catch (e) { /* never break the native answer */ }
|
} catch (e) { /* never break the native answer */ }
|
||||||
return orig.apply(this, arguments);
|
return orig.apply(this, arguments);
|
||||||
};
|
};
|
||||||
@@ -453,6 +485,10 @@
|
|||||||
var mc = navigator.mediaCapabilities;
|
var mc = navigator.mediaCapabilities;
|
||||||
if (!mc || typeof mc.decodingInfo !== 'function') { NS.caps.cptMode = 'no-api'; return; }
|
if (!mc || typeof mc.decodingInfo !== 'function') { NS.caps.cptMode = 'no-api'; return; }
|
||||||
|
|
||||||
|
// Read the pin list once, up front: canPlayType is synchronous and must not
|
||||||
|
// touch localStorage on every call.
|
||||||
|
NS.caps.__keep = readKeepList();
|
||||||
|
|
||||||
// Install FIRST, synchronously, so the hook is in place before anything can
|
// Install FIRST, synchronously, so the hook is in place before anything can
|
||||||
// read canPlayType. Until a verdict lands the hook just defers to native,
|
// read canPlayType. Until a verdict lands the hook just defers to native,
|
||||||
// which is the safe default.
|
// which is the safe default.
|
||||||
@@ -464,20 +500,21 @@
|
|||||||
type: 'file',
|
type: 'file',
|
||||||
video: {
|
video: {
|
||||||
contentType: 'video/mp4; codecs="' + p.codec + '"',
|
contentType: 'video/mp4; codecs="' + p.codec + '"',
|
||||||
width: p.w, height: p.h, bitrate: 20000000, framerate: p.fps
|
width: p.w, height: p.h, bitrate: p.mbps * 1000000, framerate: p.fps
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
mc.decodingInfo(cfg).then(function (info) {
|
mc.decodingInfo(cfg).then(function (info) {
|
||||||
NS.caps.codec[p.key] = {
|
NS.caps.codec[p.key] = {
|
||||||
name: p.name, workload: p.w + 'x' + p.h + '@' + p.fps,
|
key: p.key, name: p.name, workload: p.w + 'x' + p.h + '@' + p.fps + ' ' + p.mbps + 'Mbps',
|
||||||
supported: info.supported, smooth: info.smooth, powerEfficient: info.powerEfficient
|
supported: info.supported, smooth: info.smooth, powerEfficient: info.powerEfficient
|
||||||
};
|
};
|
||||||
}).catch(function (e) {
|
}).catch(function (e) {
|
||||||
NS.caps.codec[p.key] = { name: p.name, error: String(e && e.message || e) };
|
NS.caps.codec[p.key] = { key: p.key, name: p.name, error: String(e && e.message || e) };
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
if (--pending === 0) {
|
if (--pending === 0) {
|
||||||
applyVerdicts();
|
applyVerdicts();
|
||||||
NS.log('codec probe done; blocked = ' + (NS.caps.codecBlocked.join(', ') || 'none'));
|
NS.log('codec probe done; blocked = ' + (NS.caps.codecBlocked.join(', ') || 'none') +
|
||||||
|
(NS.caps.codecKept.length ? '; pinned = ' + NS.caps.codecKept.join(', ') : ''));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -485,13 +522,16 @@
|
|||||||
|
|
||||||
NS.capsDiag = function () {
|
NS.capsDiag = function () {
|
||||||
var c = NS.caps;
|
var c = NS.caps;
|
||||||
|
var keep = readKeepList();
|
||||||
var real = CODEC_PROBES.map(function (p) {
|
var real = CODEC_PROBES.map(function (p) {
|
||||||
var v = c.codec[p.key];
|
var v = c.codec[p.key];
|
||||||
if (!v) return ' ' + p.name.padEnd(20) + ' (pending)';
|
if (!v) return ' ' + p.name.padEnd(20) + ' (pending)';
|
||||||
if (v.error) return ' ' + p.name.padEnd(20) + ' error: ' + v.error;
|
if (v.error) return ' ' + p.name.padEnd(20) + ' error: ' + v.error;
|
||||||
|
var why = blockReason(v, keep);
|
||||||
return ' ' + p.name.padEnd(20) + ' supported=' + v.supported +
|
return ' ' + p.name.padEnd(20) + ' supported=' + v.supported +
|
||||||
' smooth=' + v.smooth + ' powerEfficient=' + v.powerEfficient +
|
' smooth=' + v.smooth + ' powerEfficient=' + v.powerEfficient +
|
||||||
' [' + v.workload + ']' + (v.supported === false ? ' <-- BLOCKED' : '');
|
' [' + v.workload + ']' +
|
||||||
|
(why ? ' <-- BLOCKED (' + why + ')' : (keep.indexOf(p.key) >= 0 ? ' <-- pinned' : ''));
|
||||||
}).join('\n');
|
}).join('\n');
|
||||||
|
|
||||||
return [
|
return [
|
||||||
@@ -505,7 +545,7 @@
|
|||||||
'MAX_TEXTURE_SIZE : ' + c.maxTextureSize,
|
'MAX_TEXTURE_SIZE : ' + c.maxTextureSize,
|
||||||
'HEVC canPlayType : ' + JSON.stringify(c.hevc),
|
'HEVC canPlayType : ' + JSON.stringify(c.hevc),
|
||||||
'canPlayType hook : ' + (c.cptMode || 'pending') +
|
'canPlayType hook : ' + (c.cptMode || 'pending') +
|
||||||
(c.cptMode === 'on' ? ' (downgraded: ' + (c.codecBlocked.join(', ') || 'nothing yet') + ')' : ''),
|
(c.cptMode === 'on' ? ' (blocked: ' + (c.codecBlocked.join(', ') || 'nothing yet') + ')' : ''),
|
||||||
'HEVC real (decodingInfo):',
|
'HEVC real (decodingInfo):',
|
||||||
real
|
real
|
||||||
].join('\n');
|
].join('\n');
|
||||||
|
|||||||
Reference in New Issue
Block a user