@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/host.js
CHANGED
|
@@ -1,38 +1,36 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/host.ts
|
|
2
|
+
const PLAYER = "mattebox-player";
|
|
2
3
|
/** The parent, or the host of the shadow root `node` sits in, or null at the document. */
|
|
3
4
|
function above(node) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return node instanceof ShadowRoot ? node.host : null;
|
|
5
|
+
const parent = node.parentNode;
|
|
6
|
+
if (parent !== null) return parent;
|
|
7
|
+
return node instanceof ShadowRoot ? node.host : null;
|
|
8
8
|
}
|
|
9
9
|
/** The nearest player above `node`, or null outside one. It may not be upgraded yet. */
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return null;
|
|
10
|
+
function findPlayer(node) {
|
|
11
|
+
let current = node;
|
|
12
|
+
while (current !== null) {
|
|
13
|
+
if (current instanceof HTMLElement && current.localName === "mattebox-player") return current;
|
|
14
|
+
current = above(current);
|
|
15
|
+
}
|
|
16
|
+
return null;
|
|
18
17
|
}
|
|
19
18
|
/** Runs `fn` with the player once it is defined and upgraded, unless cancelled before. */
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
void customElements.whenDefined(PLAYER).then(ready);
|
|
34
|
-
return () => {
|
|
35
|
-
waiting = false;
|
|
36
|
-
};
|
|
19
|
+
function whenPlayer(found, fn) {
|
|
20
|
+
let waiting = true;
|
|
21
|
+
const ready = () => {
|
|
22
|
+
if (!waiting) return;
|
|
23
|
+
waiting = false;
|
|
24
|
+
customElements.upgrade(found);
|
|
25
|
+
if ("video" in found) fn(found);
|
|
26
|
+
};
|
|
27
|
+
if ("video" in found) ready();
|
|
28
|
+
else customElements.whenDefined(PLAYER).then(ready);
|
|
29
|
+
return () => {
|
|
30
|
+
waiting = false;
|
|
31
|
+
};
|
|
37
32
|
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { PLAYER, findPlayer, whenPlayer };
|
|
35
|
+
|
|
38
36
|
//# sourceMappingURL=host.js.map
|
package/dist/host.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host.js","
|
|
1
|
+
{"version":3,"file":"host.js","names":[],"sources":["../src/host.ts"],"sourcesContent":["/**\n * The contract of a control of the page's own, as guide chapter 03 of the\n * player states it: the nearest <mattebox-player> above, through shadow\n * hosts, awaited until defined and upgraded, then read for `video`,\n * `engine`, `player` and `error`, with `sourcechange` and `error` heard on\n * it. This package implements the contract from outside, on purpose: the\n * player exports no base class, and a control that needs more than this\n * surface has found a gap in the player's API.\n */\nimport type { PlayerHost } from '@mattebox/player';\n\nexport type { PlayerHost };\n\n/** The core's error shape, as the player exposes it: taken from the host, so the core is not a dependency. */\nexport type PlayerError = NonNullable<PlayerHost['error']>;\n\nexport const PLAYER = 'mattebox-player';\n\n/** The parent, or the host of the shadow root `node` sits in, or null at the document. */\nfunction above(node: Node): Node | null {\n const parent = node.parentNode;\n if (parent !== null) return parent;\n return node instanceof ShadowRoot ? node.host : null;\n}\n\n/** The nearest player above `node`, or null outside one. It may not be upgraded yet. */\nexport function findPlayer(node: Node): HTMLElement | null {\n let current: Node | null = node;\n while (current !== null) {\n if (current instanceof HTMLElement && current.localName === PLAYER) return current;\n current = above(current);\n }\n return null;\n}\n\n/** Runs `fn` with the player once it is defined and upgraded, unless cancelled before. */\nexport function whenPlayer(found: HTMLElement, fn: (player: PlayerHost) => void): () => void {\n let waiting = true;\n const ready = (): void => {\n if (!waiting) return;\n waiting = false;\n customElements.upgrade(found);\n if ('video' in found) fn(found as PlayerHost);\n };\n if ('video' in found) ready();\n else void customElements.whenDefined(PLAYER).then(ready);\n return () => {\n waiting = false;\n };\n}\n"],"mappings":";AAgBA,MAAa,SAAS;;AAGtB,SAAS,MAAM,MAAyB;CACtC,MAAM,SAAS,KAAK;CACpB,IAAI,WAAW,MAAM,OAAO;CAC5B,OAAO,gBAAgB,aAAa,KAAK,OAAO;AAClD;;AAGA,SAAgB,WAAW,MAAgC;CACzD,IAAI,UAAuB;CAC3B,OAAO,YAAY,MAAM;EACvB,IAAI,mBAAmB,eAAe,QAAQ,cAAA,mBAAsB,OAAO;EAC3E,UAAU,MAAM,OAAO;CACzB;CACA,OAAO;AACT;;AAGA,SAAgB,WAAW,OAAoB,IAA8C;CAC3F,IAAI,UAAU;CACd,MAAM,cAAoB;EACxB,IAAI,CAAC,SAAS;EACd,UAAU;EACV,eAAe,QAAQ,KAAK;EAC5B,IAAI,WAAW,OAAO,GAAG,KAAmB;CAC9C;CACA,IAAI,WAAW,OAAO,MAAM;MACvB,eAAoB,YAAY,MAAM,CAAC,CAAC,KAAK,KAAK;CACvD,aAAa;EACX,UAAU;CACZ;AACF"}
|
package/dist/icon.js
CHANGED
|
@@ -1,44 +1,48 @@
|
|
|
1
|
+
//#region src/icon.ts
|
|
1
2
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
3
|
+
* The glyph, copied from Vidstack's media-icons 0.10.0
|
|
4
|
+
* (https://github.com/vidstack/media-icons), the same set the player draws
|
|
5
|
+
* its own from: filled paths on a 32-unit viewBox. Copied, not depended
|
|
6
|
+
* on; the notice ships as NOTICE in the package.
|
|
7
|
+
*
|
|
8
|
+
* MIT License
|
|
9
|
+
*
|
|
10
|
+
* Copyright (c) 2023 Rahim Alwer
|
|
11
|
+
*
|
|
12
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
14
|
+
* in the Software without restriction, including without limitation the rights
|
|
15
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
17
|
+
* furnished to do so, subject to the following conditions:
|
|
18
|
+
*
|
|
19
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
20
|
+
* copies or substantial portions of the Software.
|
|
21
|
+
*
|
|
22
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
+
* SOFTWARE.
|
|
29
|
+
*/
|
|
29
30
|
/** The "info" glyph: a ring with a dot and a bar, drawn even-odd so the ring is hollow. */
|
|
30
|
-
const INFO =
|
|
31
|
-
const SVG =
|
|
31
|
+
const INFO = "M17.534 10.6674C17.534 11.5143 16.8475 12.2008 16.0006 12.2008C15.1538 12.2008 14.4673 11.5143 14.4673 10.6674C14.4673 9.82061 15.1538 9.13411 16.0006 9.13411C16.8475 9.13411 17.534 9.82061 17.534 10.6674Z M14.6678 14.2005C14.6678 13.8323 14.9663 13.5339 15.3345 13.5339H16.6678C17.036 13.5339 17.3345 13.8323 17.3345 14.2005V22.2005C17.3345 22.5687 17.036 22.8672 16.6678 22.8672H15.3345C14.9663 22.8672 14.6678 22.5687 14.6678 22.2005V14.2005Z M28 16C28 22.6274 22.6274 28 16 28C9.37258 28 4 22.6274 4 16C4 9.37258 9.37258 4 16 4C22.6274 4 28 9.37258 28 16ZM24.9333 16C24.9333 20.9337 20.9337 24.9333 16 24.9333C11.0663 24.9333 7.06667 20.9337 7.06667 16C7.06667 11.0663 11.0663 7.06667 16 7.06667C20.9337 7.06667 24.9333 11.0663 24.9333 16Z";
|
|
32
|
+
const SVG = "http://www.w3.org/2000/svg";
|
|
32
33
|
/** The glyph, hidden from the accessibility tree: the button carries the name. */
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
34
|
+
function icon() {
|
|
35
|
+
const svg = document.createElementNS(SVG, "svg");
|
|
36
|
+
svg.setAttribute("viewBox", "0 0 32 32");
|
|
37
|
+
svg.setAttribute("aria-hidden", "true");
|
|
38
|
+
svg.setAttribute("part", "icon");
|
|
39
|
+
const path = document.createElementNS(SVG, "path");
|
|
40
|
+
path.setAttribute("fill-rule", "evenodd");
|
|
41
|
+
path.setAttribute("d", INFO);
|
|
42
|
+
svg.append(path);
|
|
43
|
+
return svg;
|
|
43
44
|
}
|
|
45
|
+
//#endregion
|
|
46
|
+
export { icon };
|
|
47
|
+
|
|
44
48
|
//# sourceMappingURL=icon.js.map
|
package/dist/icon.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon.js","
|
|
1
|
+
{"version":3,"file":"icon.js","names":[],"sources":["../src/icon.ts"],"sourcesContent":["/**\n * The glyph, copied from Vidstack's media-icons 0.10.0\n * (https://github.com/vidstack/media-icons), the same set the player draws\n * its own from: filled paths on a 32-unit viewBox. Copied, not depended\n * on; the notice ships as NOTICE in the package.\n *\n * MIT License\n *\n * Copyright (c) 2023 Rahim Alwer\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n/** The \"info\" glyph: a ring with a dot and a bar, drawn even-odd so the ring is hollow. */\nconst INFO =\n 'M17.534 10.6674C17.534 11.5143 16.8475 12.2008 16.0006 12.2008C15.1538 12.2008 14.4673 11.5143 14.4673 10.6674C14.4673 9.82061 15.1538 9.13411 16.0006 9.13411C16.8475 9.13411 17.534 9.82061 17.534 10.6674Z M14.6678 14.2005C14.6678 13.8323 14.9663 13.5339 15.3345 13.5339H16.6678C17.036 13.5339 17.3345 13.8323 17.3345 14.2005V22.2005C17.3345 22.5687 17.036 22.8672 16.6678 22.8672H15.3345C14.9663 22.8672 14.6678 22.5687 14.6678 22.2005V14.2005Z M28 16C28 22.6274 22.6274 28 16 28C9.37258 28 4 22.6274 4 16C4 9.37258 9.37258 4 16 4C22.6274 4 28 9.37258 28 16ZM24.9333 16C24.9333 20.9337 20.9337 24.9333 16 24.9333C11.0663 24.9333 7.06667 20.9337 7.06667 16C7.06667 11.0663 11.0663 7.06667 16 7.06667C20.9337 7.06667 24.9333 11.0663 24.9333 16Z';\n\nconst SVG = 'http://www.w3.org/2000/svg';\n\n/** The glyph, hidden from the accessibility tree: the button carries the name. */\nexport function icon(): SVGSVGElement {\n const svg = document.createElementNS(SVG, 'svg');\n svg.setAttribute('viewBox', '0 0 32 32');\n svg.setAttribute('aria-hidden', 'true');\n svg.setAttribute('part', 'icon');\n const path = document.createElementNS(SVG, 'path');\n path.setAttribute('fill-rule', 'evenodd');\n path.setAttribute('d', INFO);\n svg.append(path);\n return svg;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,MAAM,OACJ;AAEF,MAAM,MAAM;;AAGZ,SAAgB,OAAsB;CACpC,MAAM,MAAM,SAAS,gBAAgB,KAAK,KAAK;CAC/C,IAAI,aAAa,WAAW,WAAW;CACvC,IAAI,aAAa,eAAe,MAAM;CACtC,IAAI,aAAa,QAAQ,MAAM;CAC/B,MAAM,OAAO,SAAS,gBAAgB,KAAK,MAAM;CACjD,KAAK,aAAa,aAAa,SAAS;CACxC,KAAK,aAAa,KAAK,IAAI;CAC3B,IAAI,OAAO,IAAI;CACf,OAAO;AACT"}
|
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { MbxDiagnostics } from './element.js';
|
|
10
10
|
export { MbxDiagnostics } from './element.js';
|
|
11
|
-
export type { DiagnosticsReport, EngineReport, PlaybackReport } from './report.js';
|
|
11
|
+
export type { DiagnosticsReport, EngineReport, PlaybackReport, QoeFigures } from './report.js';
|
|
12
12
|
export type { Counters, Mark, Sample } from './sampler.js';
|
|
13
13
|
export type { CodecRow, DrmRow, PlatformRow, Support } from './support.js';
|
|
14
14
|
export { probeSupport } from './support.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,YAAY,EAAE,iBAAiB,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,YAAY,EAAE,iBAAiB,EAAE,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC/F,YAAY,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3D,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,eAAO,MAAM,WAAW,oBAAoB,CAAC;AAM7C,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,iBAAiB,EAAE,cAAc,CAAC;KACnC;CACF"}
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
+
import { probeSupport } from "./support.js";
|
|
2
|
+
import { MbxDiagnostics } from "./element.js";
|
|
3
|
+
//#region src/index.ts
|
|
1
4
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
customElements.define(DIAGNOSTICS, MbxDiagnostics);
|
|
15
|
-
}
|
|
5
|
+
* @mattebox/player-diagnostics: <mbx-diagnostics>, a control for the
|
|
6
|
+
* player's bar, or a panel under the video, that shows what the session
|
|
7
|
+
* is doing and what the browser can do, and writes a report. Importing
|
|
8
|
+
* this module registers the element; that is the package's one side
|
|
9
|
+
* effect. It reaches the player only through the contract a control of
|
|
10
|
+
* the page's own has, and the engine through its public surface.
|
|
11
|
+
*/
|
|
12
|
+
const DIAGNOSTICS = "mbx-diagnostics";
|
|
13
|
+
if (customElements.get("mbx-diagnostics") === void 0) customElements.define(DIAGNOSTICS, MbxDiagnostics);
|
|
14
|
+
//#endregion
|
|
15
|
+
export { DIAGNOSTICS, MbxDiagnostics, probeSupport };
|
|
16
|
+
|
|
16
17
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * @mattebox/player-diagnostics: <mbx-diagnostics>, a control for the\n * player's bar, or a panel under the video, that shows what the session\n * is doing and what the browser can do, and writes a report. Importing\n * this module registers the element; that is the package's one side\n * effect. It reaches the player only through the contract a control of\n * the page's own has, and the engine through its public surface.\n */\nimport { MbxDiagnostics } from './element.js';\n\nexport { MbxDiagnostics } from './element.js';\nexport type { DiagnosticsReport, EngineReport, PlaybackReport, QoeFigures } from './report.js';\nexport type { Counters, Mark, Sample } from './sampler.js';\nexport type { CodecRow, DrmRow, PlatformRow, Support } from './support.js';\nexport { probeSupport } from './support.js';\n\nexport const DIAGNOSTICS = 'mbx-diagnostics';\n\nif (customElements.get(DIAGNOSTICS) === undefined) {\n customElements.define(DIAGNOSTICS, MbxDiagnostics);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'mbx-diagnostics': MbxDiagnostics;\n }\n}\n"],"mappings":";;;;;;;;;;;AAgBA,MAAa,cAAc;AAE3B,IAAI,eAAe,IAAA,iBAAe,MAAM,KAAA,GACtC,eAAe,OAAO,aAAa,cAAc"}
|
package/dist/report.d.ts
CHANGED
|
@@ -93,6 +93,8 @@ export interface EngineReport {
|
|
|
93
93
|
readonly status: string;
|
|
94
94
|
}>;
|
|
95
95
|
} | null;
|
|
96
|
+
/** The engine's qoe stage figures for this load, or null without the stage. */
|
|
97
|
+
readonly qoe: QoeFigures | null;
|
|
96
98
|
readonly error: {
|
|
97
99
|
readonly category: string;
|
|
98
100
|
readonly code: string;
|
|
@@ -125,6 +127,16 @@ export interface DiagnosticsReport {
|
|
|
125
127
|
/** The trace entries the element kept, slimmed, oldest first, or null for a native session. */
|
|
126
128
|
readonly trace: readonly unknown[] | null;
|
|
127
129
|
}
|
|
130
|
+
/** The figures of the engine's qoe stage, as `engine.qoe` gives them. */
|
|
131
|
+
export interface QoeFigures {
|
|
132
|
+
/** Seconds from the load, or the first play if later, to the first frame playing. */
|
|
133
|
+
readonly startupTime: number | null;
|
|
134
|
+
readonly rebuffers: number;
|
|
135
|
+
/** Seconds spent rebuffering, the current wait included. */
|
|
136
|
+
readonly rebufferDuration: number;
|
|
137
|
+
/** Video quality changes after the first selection. */
|
|
138
|
+
readonly switches: number;
|
|
139
|
+
}
|
|
128
140
|
export declare function playbackFacts(video: HTMLVideoElement): PlaybackReport;
|
|
129
141
|
export declare function engineFacts(engine: Mattebox): EngineReport;
|
|
130
142
|
export interface ReportSources {
|
package/dist/report.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"report.d.ts","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AO,GAAG,IAAI,CAAC;IACjC,+FAA+F;IAC/F,QAAQ,CAAC,KAAK,EAAE,SAAS,OAAO,EAAE,GAAG,IAAI,CAAC;CAC3C;AAED,yEAAyE;AACzE,MAAM,WAAW,UAAU;IACzB,qFAAqF;IACrF,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,4DAA4D;IAC5D,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,uDAAuD;IACvD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAmBD,wBAAgB,aAAa,CAAC,KAAK,EAAE,gBAAgB,GAAG,cAAc,CAwBrE;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,QAAQ,GAAG,YAAY,CAkF1D;AAMD,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC;IAChC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,qDAAqD;IACrD,QAAQ,CAAC,OAAO,EAAE,SAAS,OAAO,EAAE,CAAC;IACrC,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;CAClC;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,aAAa,GAAG,iBAAiB,CAsBrE"}
|
package/dist/report.js
CHANGED
|
@@ -1,125 +1,141 @@
|
|
|
1
|
+
//#region src/report.ts
|
|
1
2
|
function ranges(list) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
return Array.from({ length: list.length }, (_, i) => ({
|
|
4
|
+
start: list.start(i),
|
|
5
|
+
end: list.end(i)
|
|
6
|
+
}));
|
|
6
7
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
8
|
+
function playbackFacts(video) {
|
|
9
|
+
const quality = video.getVideoPlaybackQuality?.();
|
|
10
|
+
return {
|
|
11
|
+
currentTime: video.currentTime,
|
|
12
|
+
duration: video.duration,
|
|
13
|
+
paused: video.paused,
|
|
14
|
+
ended: video.ended,
|
|
15
|
+
seeking: video.seeking,
|
|
16
|
+
readyState: video.readyState,
|
|
17
|
+
networkState: video.networkState,
|
|
18
|
+
playbackRate: video.playbackRate,
|
|
19
|
+
volume: video.volume,
|
|
20
|
+
muted: video.muted,
|
|
21
|
+
videoWidth: video.videoWidth,
|
|
22
|
+
videoHeight: video.videoHeight,
|
|
23
|
+
buffered: ranges(video.buffered),
|
|
24
|
+
seekable: ranges(video.seekable),
|
|
25
|
+
frames: quality === void 0 ? null : {
|
|
26
|
+
decoded: quality.totalVideoFrames,
|
|
27
|
+
dropped: quality.droppedVideoFrames
|
|
28
|
+
},
|
|
29
|
+
mediaError: video.error === null ? null : {
|
|
30
|
+
code: video.error.code,
|
|
31
|
+
message: video.error.message
|
|
32
|
+
}
|
|
33
|
+
};
|
|
29
34
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
35
|
+
function engineFacts(engine) {
|
|
36
|
+
const state = engine.stats.snapshot();
|
|
37
|
+
const optional = engine;
|
|
38
|
+
const error = engine.error;
|
|
39
|
+
return {
|
|
40
|
+
phase: state.lifecycle.phase,
|
|
41
|
+
capabilities: [...engine.capabilities()],
|
|
42
|
+
throughput: {
|
|
43
|
+
slow: state.stats.throughputEwma,
|
|
44
|
+
fast: state.stats.throughputFastEwma
|
|
45
|
+
},
|
|
46
|
+
bufferGoal: state.scheduling.bufferGoal,
|
|
47
|
+
buffers: [...state.buffers.entries()].map(([id, buffer]) => ({
|
|
48
|
+
id,
|
|
49
|
+
codecs: buffer.codecs,
|
|
50
|
+
ranges: buffer.ranges.map((range) => ({
|
|
51
|
+
start: range.start,
|
|
52
|
+
end: range.end
|
|
53
|
+
}))
|
|
54
|
+
})),
|
|
55
|
+
inflight: [...state.scheduling.inflight.values()].map((request) => ({
|
|
56
|
+
trackId: request.trackId,
|
|
57
|
+
seq: request.seq,
|
|
58
|
+
url: request.url
|
|
59
|
+
})),
|
|
60
|
+
live: state.live === null ? null : {
|
|
61
|
+
start: state.live.span.start,
|
|
62
|
+
end: state.live.span.end,
|
|
63
|
+
edge: state.live.edge,
|
|
64
|
+
latency: optional.live?.latency ?? null
|
|
65
|
+
},
|
|
66
|
+
tracks: {
|
|
67
|
+
active: Object.fromEntries([
|
|
68
|
+
"video",
|
|
69
|
+
"audio",
|
|
70
|
+
"text"
|
|
71
|
+
].map((type) => [type, engine.tracks.active(type)?.id ?? null])),
|
|
72
|
+
available: engine.tracks.available.map((track) => ({
|
|
73
|
+
id: track.id,
|
|
74
|
+
contentType: track.contentType,
|
|
75
|
+
mimeType: track.mimeType,
|
|
76
|
+
lang: track.lang ?? null,
|
|
77
|
+
role: track.role ?? null,
|
|
78
|
+
renditions: track.renditions.length
|
|
79
|
+
}))
|
|
80
|
+
},
|
|
81
|
+
quality: {
|
|
82
|
+
playing: engine.quality.playing?.id ?? null,
|
|
83
|
+
active: engine.quality.active?.id ?? null,
|
|
84
|
+
pinned: engine.quality.pinned,
|
|
85
|
+
allowed: engine.quality.allowed.map((r) => r.id),
|
|
86
|
+
renditions: engine.quality.renditions.map((r) => ({
|
|
87
|
+
id: r.id,
|
|
88
|
+
bitrate: r.bitrate,
|
|
89
|
+
width: r.width ?? null,
|
|
90
|
+
height: r.height ?? null,
|
|
91
|
+
frameRate: r.frameRate ?? null,
|
|
92
|
+
codecs: r.codecs
|
|
93
|
+
}))
|
|
94
|
+
},
|
|
95
|
+
drm: optional.drm === void 0 ? null : {
|
|
96
|
+
keySystem: optional.drm.keySystem,
|
|
97
|
+
sessions: [...optional.drm.sessions]
|
|
98
|
+
},
|
|
99
|
+
qoe: optional.qoe === void 0 ? null : {
|
|
100
|
+
startupTime: optional.qoe.startupTime,
|
|
101
|
+
rebuffers: optional.qoe.rebuffers,
|
|
102
|
+
rebufferDuration: optional.qoe.rebufferDuration,
|
|
103
|
+
switches: optional.qoe.switches
|
|
104
|
+
},
|
|
105
|
+
error: error === null ? null : {
|
|
106
|
+
category: error.category,
|
|
107
|
+
code: error.code,
|
|
108
|
+
fatal: error.fatal,
|
|
109
|
+
recoverable: error.recoverable,
|
|
110
|
+
context: error.context ?? null
|
|
111
|
+
}
|
|
112
|
+
};
|
|
98
113
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
trace: engine === null ? null : sources.history,
|
|
123
|
-
};
|
|
114
|
+
const KEEP_MS = 12e4;
|
|
115
|
+
function buildReport(sources) {
|
|
116
|
+
const { player } = sources;
|
|
117
|
+
const engine = player.engine;
|
|
118
|
+
const samples = sources.samples.slice(-240);
|
|
119
|
+
const since = performance.now() - KEEP_MS;
|
|
120
|
+
return {
|
|
121
|
+
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
122
|
+
userAgent: navigator.userAgent,
|
|
123
|
+
source: {
|
|
124
|
+
url: player.getAttribute("src"),
|
|
125
|
+
type: player.getAttribute("type"),
|
|
126
|
+
handler: player.player?.session?.handler ?? null
|
|
127
|
+
},
|
|
128
|
+
playback: playbackFacts(player.video),
|
|
129
|
+
error: player.error,
|
|
130
|
+
engine: engine === null ? null : engineFacts(engine),
|
|
131
|
+
counters: sources.counters,
|
|
132
|
+
samples,
|
|
133
|
+
marks: sources.marks.filter((mark) => mark.t >= since),
|
|
134
|
+
support: sources.support,
|
|
135
|
+
trace: engine === null ? null : sources.history
|
|
136
|
+
};
|
|
124
137
|
}
|
|
138
|
+
//#endregion
|
|
139
|
+
export { buildReport, engineFacts, playbackFacts };
|
|
140
|
+
|
|
125
141
|
//# sourceMappingURL=report.js.map
|
package/dist/report.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"report.js","sourceRoot":"","sources":["../src/report.ts"],"names":[],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CAAC;IAC7B,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC;IACrD,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC;IAC1C,OAAO;QACL,EAAE,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QAC5B,SAAS,EAAE,SAAS,CAAC,SAAS;QAC9B,MAAM,EAAE;YACN,GAAG,EAAE,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC;YAC/B,IAAI,EAAE,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC;YACjC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,IAAI,IAAI;SACjD;QACD,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC;QACrC,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC;QACpD,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,OAAO;QACP,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC;QACtD,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO;KAChD,CAAC;AACJ,CAAC"}
|
|
1
|
+
{"version":3,"file":"report.js","names":[],"sources":["../src/report.ts"],"sourcesContent":["/**\n * The report: everything the panel shows, as one plain object a page can\n * send when something goes wrong, and the trace the engine's guide asks\n * for with every error report (chapter 12), as the element kept it: see\n * `trace.ts` for what is kept of each entry. Every field is serializable;\n * a native session has no engine part.\n */\nimport type { Mattebox } from 'mattebox';\nimport type { PlayerError, PlayerHost } from './host.js';\nimport type { Counters, Mark, Sample } from './sampler.js';\nimport type { Support } from './support.js';\n\nexport interface RangeReport {\n readonly start: number;\n readonly end: number;\n}\n\nexport interface PlaybackReport {\n readonly currentTime: number;\n readonly duration: number;\n readonly paused: boolean;\n readonly ended: boolean;\n readonly seeking: boolean;\n readonly readyState: number;\n readonly networkState: number;\n readonly playbackRate: number;\n readonly volume: number;\n readonly muted: boolean;\n readonly videoWidth: number;\n readonly videoHeight: number;\n readonly buffered: readonly RangeReport[];\n readonly seekable: readonly RangeReport[];\n readonly frames: { readonly decoded: number; readonly dropped: number } | null;\n readonly mediaError: { readonly code: number; readonly message: string } | null;\n}\n\nexport interface EngineReport {\n readonly phase: string;\n readonly capabilities: readonly string[];\n readonly throughput: { readonly slow: number; readonly fast: number };\n readonly bufferGoal: number;\n readonly buffers: ReadonlyArray<{\n readonly id: string;\n readonly codecs: string;\n readonly ranges: readonly RangeReport[];\n }>;\n readonly inflight: ReadonlyArray<{\n readonly trackId: string;\n readonly seq: number;\n readonly url: string;\n }>;\n readonly live: {\n readonly start: number;\n readonly end: number;\n readonly edge: number;\n readonly latency: number | null;\n } | null;\n readonly tracks: {\n readonly active: Readonly<Record<string, string | null>>;\n readonly available: ReadonlyArray<{\n readonly id: string;\n readonly contentType: string;\n readonly mimeType: string;\n readonly lang: string | null;\n readonly role: string | null;\n readonly renditions: number;\n }>;\n };\n readonly quality: {\n readonly playing: string | null;\n readonly active: string | null;\n readonly pinned: string | null;\n readonly allowed: readonly string[];\n readonly renditions: ReadonlyArray<{\n readonly id: string;\n readonly bitrate: number;\n readonly width: number | null;\n readonly height: number | null;\n readonly frameRate: number | null;\n readonly codecs: string | null;\n }>;\n };\n readonly drm: {\n readonly keySystem: string | null;\n readonly sessions: ReadonlyArray<{ readonly keyId: string; readonly status: string }>;\n } | null;\n /** The engine's qoe stage figures for this load, or null without the stage. */\n readonly qoe: QoeFigures | null;\n readonly error: {\n readonly category: string;\n readonly code: string;\n readonly fatal: boolean;\n readonly recoverable: boolean;\n readonly context: Readonly<Record<string, unknown>> | null;\n } | null;\n}\n\nexport interface DiagnosticsReport {\n /** When the report was taken, ISO 8601. */\n readonly at: string;\n readonly userAgent: string;\n readonly source: {\n readonly url: string | null;\n readonly type: string | null;\n /** The name of the handler that won, or null before a session. */\n readonly handler: string | null;\n };\n readonly playback: PlaybackReport;\n /** The player's fatal error of the current load, or null. */\n readonly error: PlayerError | null;\n /** Null for a native session. */\n readonly engine: EngineReport | null;\n readonly counters: Counters;\n /** The last two minutes of samples, and the marks in them. */\n readonly samples: readonly Sample[];\n readonly marks: readonly Mark[];\n /** What the browser supports, when it was probed before the report. */\n readonly support: Support | null;\n /** The trace entries the element kept, slimmed, oldest first, or null for a native session. */\n readonly trace: readonly unknown[] | null;\n}\n\n/** The figures of the engine's qoe stage, as `engine.qoe` gives them. */\nexport interface QoeFigures {\n /** Seconds from the load, or the first play if later, to the first frame playing. */\n readonly startupTime: number | null;\n readonly rebuffers: number;\n /** Seconds spent rebuffering, the current wait included. */\n readonly rebufferDuration: number;\n /** Video quality changes after the first selection. */\n readonly switches: number;\n}\n\n/** The optional namespaces the report reads, as the player reads them: a cast, once. */\ninterface Namespaces {\n readonly live?: { readonly latency: number | null };\n readonly qoe?: QoeFigures;\n readonly drm?: {\n readonly keySystem: string | null;\n readonly sessions: ReadonlyArray<{ readonly keyId: string; readonly status: string }>;\n };\n}\n\nfunction ranges(list: TimeRanges): RangeReport[] {\n return Array.from({ length: list.length }, (_, i) => ({\n start: list.start(i),\n end: list.end(i),\n }));\n}\n\nexport function playbackFacts(video: HTMLVideoElement): PlaybackReport {\n const quality = video.getVideoPlaybackQuality?.();\n return {\n currentTime: video.currentTime,\n duration: video.duration,\n paused: video.paused,\n ended: video.ended,\n seeking: video.seeking,\n readyState: video.readyState,\n networkState: video.networkState,\n playbackRate: video.playbackRate,\n volume: video.volume,\n muted: video.muted,\n videoWidth: video.videoWidth,\n videoHeight: video.videoHeight,\n buffered: ranges(video.buffered),\n seekable: ranges(video.seekable),\n frames:\n quality === undefined\n ? null\n : { decoded: quality.totalVideoFrames, dropped: quality.droppedVideoFrames },\n mediaError:\n video.error === null ? null : { code: video.error.code, message: video.error.message },\n };\n}\n\nexport function engineFacts(engine: Mattebox): EngineReport {\n const state = engine.stats.snapshot();\n const optional = engine as Namespaces;\n const error = engine.error;\n return {\n phase: state.lifecycle.phase,\n capabilities: [...engine.capabilities()],\n throughput: { slow: state.stats.throughputEwma, fast: state.stats.throughputFastEwma },\n bufferGoal: state.scheduling.bufferGoal,\n buffers: [...state.buffers.entries()].map(([id, buffer]) => ({\n id,\n codecs: buffer.codecs,\n ranges: buffer.ranges.map((range) => ({ start: range.start, end: range.end })),\n })),\n inflight: [...state.scheduling.inflight.values()].map((request) => ({\n trackId: request.trackId,\n seq: request.seq,\n url: request.url,\n })),\n live:\n state.live === null\n ? null\n : {\n start: state.live.span.start,\n end: state.live.span.end,\n edge: state.live.edge,\n latency: optional.live?.latency ?? null,\n },\n tracks: {\n active: Object.fromEntries(\n (['video', 'audio', 'text'] as const).map((type) => [\n type,\n engine.tracks.active(type)?.id ?? null,\n ]),\n ),\n available: engine.tracks.available.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 renditions: track.renditions.length,\n })),\n },\n quality: {\n playing: engine.quality.playing?.id ?? null,\n active: engine.quality.active?.id ?? null,\n pinned: engine.quality.pinned,\n allowed: engine.quality.allowed.map((r) => r.id),\n renditions: engine.quality.renditions.map((r) => ({\n id: r.id,\n bitrate: r.bitrate,\n width: r.width ?? null,\n height: r.height ?? null,\n frameRate: r.frameRate ?? null,\n codecs: r.codecs,\n })),\n },\n drm:\n optional.drm === undefined\n ? null\n : { keySystem: optional.drm.keySystem, sessions: [...optional.drm.sessions] },\n qoe:\n optional.qoe === undefined\n ? null\n : {\n startupTime: optional.qoe.startupTime,\n rebuffers: optional.qoe.rebuffers,\n rebufferDuration: optional.qoe.rebufferDuration,\n switches: optional.qoe.switches,\n },\n error:\n error === null\n ? null\n : {\n category: error.category,\n code: error.code,\n fatal: error.fatal,\n recoverable: error.recoverable,\n context: error.context ?? null,\n },\n };\n}\n\n/** Two minutes of samples at two a second, and the marks of the same two minutes. */\nconst KEEP_SAMPLES = 240;\nconst KEEP_MS = 120_000;\n\nexport interface ReportSources {\n readonly player: PlayerHost;\n readonly samples: readonly Sample[];\n readonly marks: readonly Mark[];\n readonly counters: Counters;\n /** The trace entries kept, slimmed, oldest first. */\n readonly history: readonly unknown[];\n readonly support: Support | null;\n}\n\nexport function buildReport(sources: ReportSources): DiagnosticsReport {\n const { player } = sources;\n const engine = player.engine;\n const samples = sources.samples.slice(-KEEP_SAMPLES);\n const since = performance.now() - KEEP_MS;\n return {\n at: new Date().toISOString(),\n userAgent: navigator.userAgent,\n source: {\n url: player.getAttribute('src'),\n type: player.getAttribute('type'),\n handler: player.player?.session?.handler ?? null,\n },\n playback: playbackFacts(player.video),\n error: player.error,\n engine: engine === null ? null : engineFacts(engine),\n counters: sources.counters,\n samples,\n marks: sources.marks.filter((mark) => mark.t >= since),\n support: sources.support,\n trace: engine === null ? null : sources.history,\n };\n}\n"],"mappings":";AA+IA,SAAS,OAAO,MAAiC;CAC/C,OAAO,MAAM,KAAK,EAAE,QAAQ,KAAK,OAAO,IAAI,GAAG,OAAO;EACpD,OAAO,KAAK,MAAM,CAAC;EACnB,KAAK,KAAK,IAAI,CAAC;CACjB,EAAE;AACJ;AAEA,SAAgB,cAAc,OAAyC;CACrE,MAAM,UAAU,MAAM,0BAA0B;CAChD,OAAO;EACL,aAAa,MAAM;EACnB,UAAU,MAAM;EAChB,QAAQ,MAAM;EACd,OAAO,MAAM;EACb,SAAS,MAAM;EACf,YAAY,MAAM;EAClB,cAAc,MAAM;EACpB,cAAc,MAAM;EACpB,QAAQ,MAAM;EACd,OAAO,MAAM;EACb,YAAY,MAAM;EAClB,aAAa,MAAM;EACnB,UAAU,OAAO,MAAM,QAA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