@mattebox/player-diagnostics 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/mattebox-player-diagnostics.min.js +1 -124
- package/dist/charts.d.ts.map +1 -1
- package/dist/charts.js +356 -392
- package/dist/charts.js.map +1 -1
- package/dist/dom.d.ts +8 -0
- package/dist/dom.d.ts.map +1 -0
- package/dist/dom.js +15 -0
- package/dist/dom.js.map +1 -0
- package/dist/element.d.ts.map +1 -1
- package/dist/element.js +631 -659
- package/dist/element.js.map +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/asyncToGenerator.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/defineProperty.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/objectSpread2.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/toPrimitive.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/toPropertyKey.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/typeof.js +1 -1
- package/dist/es2015/charts.js +2 -1
- package/dist/es2015/dom.js +13 -0
- package/dist/es2015/element.js +23 -10
- package/dist/es2015/report.js +6 -0
- package/dist/es2015/style.js +1 -133
- package/dist/es2015/support.js +2 -2
- package/dist/es2015/trace.js +1 -1
- package/dist/format.js +26 -31
- package/dist/format.js.map +1 -1
- package/dist/host.js +28 -30
- package/dist/host.js.map +1 -1
- package/dist/icon.js +43 -39
- package/dist/icon.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -14
- package/dist/index.js.map +1 -1
- package/dist/report.d.ts +12 -0
- package/dist/report.d.ts.map +1 -1
- package/dist/report.js +135 -119
- package/dist/report.js.map +1 -1
- package/dist/sampler.js +187 -199
- package/dist/sampler.js.map +1 -1
- package/dist/style.d.ts +1 -9
- package/dist/style.d.ts.map +1 -1
- package/dist/style.js +4 -132
- package/dist/style.js.map +1 -1
- package/dist/support.js +304 -215
- package/dist/support.js.map +1 -1
- package/dist/trace.js +80 -81
- package/dist/trace.js.map +1 -1
- package/package.json +5 -5
package/dist/trace.js
CHANGED
|
@@ -1,100 +1,99 @@
|
|
|
1
|
+
//#region src/trace.ts
|
|
1
2
|
/** Segments as a count, whatever their addressing. */
|
|
2
3
|
function segmentCount(segments) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
return String(segments.kind);
|
|
7
|
-
}
|
|
8
|
-
return 0;
|
|
4
|
+
if (Array.isArray(segments)) return segments.length;
|
|
5
|
+
if (typeof segments === "object" && segments !== null && "kind" in segments) return String(segments.kind);
|
|
6
|
+
return 0;
|
|
9
7
|
}
|
|
10
8
|
/** A presentation as its shape: the periods, the tracks, the renditions, and how many segments each has. */
|
|
11
9
|
function slimPresentation(presentation) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
10
|
+
return {
|
|
11
|
+
id: presentation.id,
|
|
12
|
+
isLive: presentation.isLive,
|
|
13
|
+
duration: presentation.duration ?? null,
|
|
14
|
+
live: presentation.live ?? null,
|
|
15
|
+
periods: presentation.periods.map((period) => ({
|
|
16
|
+
id: period.id,
|
|
17
|
+
start: period.start,
|
|
18
|
+
duration: period.duration ?? null,
|
|
19
|
+
tracks: period.tracks.map((track) => ({
|
|
20
|
+
id: track.id,
|
|
21
|
+
contentType: track.contentType,
|
|
22
|
+
mimeType: track.mimeType,
|
|
23
|
+
lang: track.lang ?? null,
|
|
24
|
+
role: track.role ?? null,
|
|
25
|
+
protected: track.protection !== null && track.protection.schemes.length > 0,
|
|
26
|
+
renditions: track.renditions.map((r) => ({
|
|
27
|
+
id: r.id,
|
|
28
|
+
bitrate: r.bitrate,
|
|
29
|
+
width: r.width ?? null,
|
|
30
|
+
height: r.height ?? null,
|
|
31
|
+
codecs: r.codecs,
|
|
32
|
+
segments: segmentCount(r.segments)
|
|
33
|
+
}))
|
|
34
|
+
}))
|
|
35
|
+
}))
|
|
36
|
+
};
|
|
39
37
|
}
|
|
40
38
|
function slimMessage(msg) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
39
|
+
switch (msg.type) {
|
|
40
|
+
case "MANIFEST_LOADED": return {
|
|
41
|
+
type: msg.type,
|
|
42
|
+
presentation: slimPresentation(msg.presentation)
|
|
43
|
+
};
|
|
44
|
+
case "PLAYLIST_REFRESHED": return {
|
|
45
|
+
...msg,
|
|
46
|
+
segments: segmentCount(msg.segments)
|
|
47
|
+
};
|
|
48
|
+
case "SEGMENT_LOADED": return {
|
|
49
|
+
...msg,
|
|
50
|
+
bytes: length(msg.bytes)
|
|
51
|
+
};
|
|
52
|
+
default: return msg;
|
|
53
|
+
}
|
|
51
54
|
}
|
|
52
55
|
/** A payload's length, whether it is still bytes or already the engine's `{ $bytes }` marker. */
|
|
53
56
|
function length(value) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
return value;
|
|
57
|
+
if (value instanceof ArrayBuffer || ArrayBuffer.isView(value)) return value.byteLength;
|
|
58
|
+
return value;
|
|
57
59
|
}
|
|
58
60
|
function slimEffect(effect) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
return out;
|
|
61
|
+
if (effect.kind === "emit" && effect.event === "tracks:changed") return {
|
|
62
|
+
kind: effect.kind,
|
|
63
|
+
event: effect.event
|
|
64
|
+
};
|
|
65
|
+
if (effect.kind === "schedule") return {
|
|
66
|
+
...effect,
|
|
67
|
+
then: slimMessage(effect.then)
|
|
68
|
+
};
|
|
69
|
+
const out = {};
|
|
70
|
+
for (const [key, value] of Object.entries(effect)) out[key] = length(value);
|
|
71
|
+
return out;
|
|
71
72
|
}
|
|
72
73
|
/**
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
* JSON with the values a trace carries that JSON does not: byte buffers as
|
|
75
|
+
* their length, maps as objects, sets as arrays, functions and DOM nodes
|
|
76
|
+
* as their names.
|
|
77
|
+
*/
|
|
77
78
|
function serializable(_key, value) {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
if (typeof value === 'function')
|
|
85
|
-
return '[function]';
|
|
86
|
-
if (typeof Node !== 'undefined' && value instanceof Node)
|
|
87
|
-
return `[${value.nodeName}]`;
|
|
88
|
-
return value;
|
|
79
|
+
if (value instanceof ArrayBuffer || ArrayBuffer.isView(value)) return value.byteLength;
|
|
80
|
+
if (value instanceof Map) return Object.fromEntries(value);
|
|
81
|
+
if (value instanceof Set) return [...value];
|
|
82
|
+
if (typeof value === "function") return "[function]";
|
|
83
|
+
if (typeof Node !== "undefined" && value instanceof Node) return `[${value.nodeName}]`;
|
|
84
|
+
return value;
|
|
89
85
|
}
|
|
90
86
|
/** One entry, slimmed and plain. */
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
87
|
+
function slimEntry(entry) {
|
|
88
|
+
const slim = {
|
|
89
|
+
t: entry.t,
|
|
90
|
+
msg: slimMessage(entry.msg),
|
|
91
|
+
effects: entry.effects.map(slimEffect),
|
|
92
|
+
digest: entry.digest
|
|
93
|
+
};
|
|
94
|
+
return JSON.parse(JSON.stringify(slim, serializable));
|
|
99
95
|
}
|
|
96
|
+
//#endregion
|
|
97
|
+
export { slimEntry };
|
|
98
|
+
|
|
100
99
|
//# sourceMappingURL=trace.js.map
|
package/dist/trace.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trace.js","
|
|
1
|
+
{"version":3,"file":"trace.js","names":[],"sources":["../src/trace.ts"],"sourcesContent":["/**\n * A trace entry as the element keeps it: slimmed the way the engine's\n * playground slims one before it goes anywhere, and made plain. A manifest\n * is a summary of its tracks and renditions with segment counts, a\n * playlist refresh a count, the bytes of a segment their length, a\n * scheduled message the same again, and a `tracks:changed` emit its name.\n * A raw entry references the whole presentation, so five hundred of them\n * serialize to megabytes on HLS; slimmed, a history is a few hundred\n * kilobytes at most, and holds nothing the engine does not hold anyway.\n */\nimport type { Effect, Message, Presentation, TraceEntry } from 'mattebox';\n\n/** Segments as a count, whatever their addressing. */\nfunction segmentCount(segments: unknown): number | string {\n if (Array.isArray(segments)) return segments.length;\n if (typeof segments === 'object' && segments !== null && 'kind' in segments) {\n return String((segments as { kind: unknown }).kind);\n }\n return 0;\n}\n\n/** A presentation as its shape: the periods, the tracks, the renditions, and how many segments each has. */\nfunction slimPresentation(presentation: Presentation): unknown {\n return {\n id: presentation.id,\n isLive: presentation.isLive,\n duration: presentation.duration ?? null,\n live: presentation.live ?? null,\n periods: presentation.periods.map((period) => ({\n id: period.id,\n start: period.start,\n duration: period.duration ?? null,\n tracks: period.tracks.map((track) => ({\n id: track.id,\n contentType: track.contentType,\n mimeType: track.mimeType,\n lang: track.lang ?? null,\n role: track.role ?? null,\n protected: track.protection !== null && track.protection.schemes.length > 0,\n renditions: track.renditions.map((r) => ({\n id: r.id,\n bitrate: r.bitrate,\n width: r.width ?? null,\n height: r.height ?? null,\n codecs: r.codecs,\n segments: segmentCount(r.segments),\n })),\n })),\n })),\n };\n}\n\nfunction slimMessage(msg: Message): unknown {\n switch (msg.type) {\n case 'MANIFEST_LOADED':\n return { type: msg.type, presentation: slimPresentation(msg.presentation) };\n case 'PLAYLIST_REFRESHED':\n return { ...msg, segments: segmentCount(msg.segments) };\n case 'SEGMENT_LOADED':\n return { ...msg, bytes: length(msg.bytes) };\n default:\n return msg;\n }\n}\n\n/** A payload's length, whether it is still bytes or already the engine's `{ $bytes }` marker. */\nfunction length(value: unknown): unknown {\n if (value instanceof ArrayBuffer || ArrayBuffer.isView(value)) return value.byteLength;\n return value;\n}\n\nfunction slimEffect(effect: Effect): unknown {\n if (effect.kind === 'emit' && effect.event === 'tracks:changed') {\n return { kind: effect.kind, event: effect.event };\n }\n // A scheduled message is a whole message, a manifest refresh among them.\n // biome-ignore lint/suspicious/noThenProperty: `then` is the schedule effect's field name in the engine's message taxonomy\n if (effect.kind === 'schedule') return { ...effect, then: slimMessage(effect.then) };\n const out: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(effect as unknown as Record<string, unknown>)) {\n out[key] = length(value);\n }\n return out;\n}\n\n/**\n * JSON with the values a trace carries that JSON does not: byte buffers as\n * their length, maps as objects, sets as arrays, functions and DOM nodes\n * as their names.\n */\nfunction serializable(_key: string, value: unknown): unknown {\n if (value instanceof ArrayBuffer || ArrayBuffer.isView(value)) return value.byteLength;\n if (value instanceof Map) return Object.fromEntries(value);\n if (value instanceof Set) return [...value];\n if (typeof value === 'function') return '[function]';\n if (typeof Node !== 'undefined' && value instanceof Node) return `[${value.nodeName}]`;\n return value;\n}\n\n/** One entry, slimmed and plain. */\nexport function slimEntry(entry: TraceEntry): unknown {\n const slim = {\n t: entry.t,\n msg: slimMessage(entry.msg),\n effects: entry.effects.map(slimEffect),\n digest: entry.digest,\n };\n return JSON.parse(JSON.stringify(slim, serializable)) as unknown;\n}\n"],"mappings":";;AAaA,SAAS,aAAa,UAAoC;CACxD,IAAI,MAAM,QAAQ,QAAQ,GAAG,OAAO,SAAS;CAC7C,IAAI,OAAO,aAAa,YAAY,aAAa,QAAQ,UAAU,UACjE,OAAO,OAAQ,SAA+B,IAAI;CAEpD,OAAO;AACT;;AAGA,SAAS,iBAAiB,cAAqC;CAC7D,OAAO;EACL,IAAI,aAAa;EACjB,QAAQ,aAAa;EACrB,UAAU,aAAa,YAAY;EACnC,MAAM,aAAa,QAAQ;EAC3B,SAAS,aAAa,QAAQ,KAAK,YAAY;GAC7C,IAAI,OAAO;GACX,OAAO,OAAO;GACd,UAAU,OAAO,YAAY;GAC7B,QAAQ,OAAO,OAAO,KAAK,WAAW;IACpC,IAAI,MAAM;IACV,aAAa,MAAM;IACnB,UAAU,MAAM;IAChB,MAAM,MAAM,QAAQ;IACpB,MAAM,MAAM,QAAQ;IACpB,WAAW,MAAM,eAAe,QAAQ,MAAM,WAAW,QAAQ,SAAS;IAC1E,YAAY,MAAM,WAAW,KAAK,OAAO;KACvC,IAAI,EAAE;KACN,SAAS,EAAE;KACX,OAAO,EAAE,SAAS;KAClB,QAAQ,EAAE,UAAU;KACpB,QAAQ,EAAE;KACV,UAAU,aAAa,EAAE,QAAQ;IACnC,EAAE;GACJ,EAAE;EACJ,EAAE;CACJ;AACF;AAEA,SAAS,YAAY,KAAuB;CAC1C,QAAQ,IAAI,MAAZ;EACE,KAAK,mBACH,OAAO;GAAE,MAAM,IAAI;GAAM,cAAc,iBAAiB,IAAI,YAAY;EAAE;EAC5E,KAAK,sBACH,OAAO;GAAE,GAAG;GAAK,UAAU,aAAa,IAAI,QAAQ;EAAE;EACxD,KAAK,kBACH,OAAO;GAAE,GAAG;GAAK,OAAO,OAAO,IAAI,KAAK;EAAE;EAC5C,SACE,OAAO;CACX;AACF;;AAGA,SAAS,OAAO,OAAyB;CACvC,IAAI,iBAAiB,eAAe,YAAY,OAAO,KAAK,GAAG,OAAO,MAAM;CAC5E,OAAO;AACT;AAEA,SAAS,WAAW,QAAyB;CAC3C,IAAI,OAAO,SAAS,UAAU,OAAO,UAAU,kBAC7C,OAAO;EAAE,MAAM,OAAO;EAAM,OAAO,OAAO;CAAM;CAIlD,IAAI,OAAO,SAAS,YAAY,OAAO;EAAE,GAAG;EAAQ,MAAM,YAAY,OAAO,IAAI;CAAE;CACnF,MAAM,MAA+B,CAAC;CACtC,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAA4C,GACpF,IAAI,OAAO,OAAO,KAAK;CAEzB,OAAO;AACT;;;;;;AAOA,SAAS,aAAa,MAAc,OAAyB;CAC3D,IAAI,iBAAiB,eAAe,YAAY,OAAO,KAAK,GAAG,OAAO,MAAM;CAC5E,IAAI,iBAAiB,KAAK,OAAO,OAAO,YAAY,KAAK;CACzD,IAAI,iBAAiB,KAAK,OAAO,CAAC,GAAG,KAAK;CAC1C,IAAI,OAAO,UAAU,YAAY,OAAO;CACxC,IAAI,OAAO,SAAS,eAAe,iBAAiB,MAAM,OAAO,IAAI,MAAM,SAAS;CACpF,OAAO;AACT;;AAGA,SAAgB,UAAU,OAA4B;CACpD,MAAM,OAAO;EACX,GAAG,MAAM;EACT,KAAK,YAAY,MAAM,GAAG;EAC1B,SAAS,MAAM,QAAQ,IAAI,UAAU;EACrC,QAAQ,MAAM;CAChB;CACA,OAAO,KAAK,MAAM,KAAK,UAAU,MAAM,YAAY,CAAC;AACtD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mattebox/player-diagnostics",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "<mbx-diagnostics>: playback stats, charts, engine state and browser support inside <mattebox-player>, and a report to send.",
|
|
5
5
|
"author": "Josep Boix Requesens",
|
|
6
6
|
"repository": {
|
|
@@ -43,17 +43,17 @@
|
|
|
43
43
|
"scripts": {
|
|
44
44
|
"clean": "rm -rf dist",
|
|
45
45
|
"build": "npm run clean && npm run build:modern && npm run build:es2015 && npm run build:cdn",
|
|
46
|
-
"build:modern": "tsc -p tsconfig.build.json",
|
|
46
|
+
"build:modern": "tsc -p tsconfig.build.json --emitDeclarationOnly && rolldown -c rolldown.modern.config.mjs",
|
|
47
47
|
"build:es2015": "rolldown -c rolldown.dist.config.mjs",
|
|
48
48
|
"build:cdn": "rolldown -c rolldown.cdn.config.mjs",
|
|
49
49
|
"check:package": "publint && attw --pack . --format table --no-emoji",
|
|
50
50
|
"release:ci": "semantic-release"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@mattebox/player-core": "^0.
|
|
53
|
+
"@mattebox/player-core": "^0.5.0"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@mattebox/player": ">=0.
|
|
57
|
-
"mattebox": "^0.
|
|
56
|
+
"@mattebox/player": ">=0.8.0",
|
|
57
|
+
"mattebox": "^0.12.0"
|
|
58
58
|
}
|
|
59
59
|
}
|