@mattebox/player 0.6.0 → 0.8.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.min.js +3 -435
- package/dist/controls/airplay.js +28 -44
- package/dist/controls/airplay.js.map +1 -1
- package/dist/controls/chapters.d.ts +22 -11
- package/dist/controls/chapters.d.ts.map +1 -1
- package/dist/controls/chapters.js +87 -73
- package/dist/controls/chapters.js.map +1 -1
- package/dist/controls/cues.d.ts +0 -22
- package/dist/controls/cues.d.ts.map +1 -1
- package/dist/controls/cues.js +161 -191
- package/dist/controls/cues.js.map +1 -1
- package/dist/controls/fullscreen.js +52 -70
- package/dist/controls/fullscreen.js.map +1 -1
- package/dist/controls/icons.d.ts +4 -2
- package/dist/controls/icons.d.ts.map +1 -1
- package/dist/controls/icons.js +46 -70
- package/dist/controls/icons.js.map +1 -1
- package/dist/controls/markers.d.ts +39 -0
- package/dist/controls/markers.d.ts.map +1 -0
- package/dist/controls/markers.js +38 -0
- package/dist/controls/markers.js.map +1 -0
- package/dist/controls/menu.d.ts +8 -4
- package/dist/controls/menu.d.ts.map +1 -1
- package/dist/controls/menu.js +261 -223
- package/dist/controls/menu.js.map +1 -1
- package/dist/controls/native-tracks.d.ts +28 -0
- package/dist/controls/native-tracks.d.ts.map +1 -0
- package/dist/controls/native-tracks.js +30 -0
- package/dist/controls/native-tracks.js.map +1 -0
- package/dist/controls/pip.js +35 -49
- package/dist/controls/pip.js.map +1 -1
- package/dist/controls/quality-names.d.ts +15 -0
- package/dist/controls/quality-names.d.ts.map +1 -0
- package/dist/controls/quality-names.js +62 -0
- package/dist/controls/quality-names.js.map +1 -0
- package/dist/controls/ranges.js +42 -37
- package/dist/controls/ranges.js.map +1 -1
- package/dist/controls/session.d.ts +6 -1
- package/dist/controls/session.d.ts.map +1 -1
- package/dist/controls/session.js +41 -26
- package/dist/controls/session.js.map +1 -1
- package/dist/controls/slider.d.ts +2 -2
- package/dist/controls/slider.d.ts.map +1 -1
- package/dist/controls/slider.js +151 -159
- package/dist/controls/slider.js.map +1 -1
- package/dist/controls/time.js +17 -17
- package/dist/controls/time.js.map +1 -1
- package/dist/controls/track-names.d.ts +40 -0
- package/dist/controls/track-names.d.ts.map +1 -0
- package/dist/controls/track-names.js +59 -0
- package/dist/controls/track-names.js.map +1 -0
- package/dist/dom.d.ts +6 -0
- package/dist/dom.d.ts.map +1 -1
- package/dist/dom.js +28 -19
- package/dist/dom.js.map +1 -1
- package/dist/element-entry.js +9 -6
- package/dist/element-entry.js.map +1 -1
- package/dist/element.d.ts +28 -2
- package/dist/element.d.ts.map +1 -1
- package/dist/element.js +426 -442
- package/dist/element.js.map +1 -1
- package/dist/elements/airplay-button.js +51 -53
- package/dist/elements/airplay-button.js.map +1 -1
- package/dist/elements/audio-menu.d.ts +19 -8
- package/dist/elements/audio-menu.d.ts.map +1 -1
- package/dist/elements/audio-menu.js +103 -65
- package/dist/elements/audio-menu.js.map +1 -1
- package/dist/elements/chapters-menu.d.ts.map +1 -1
- package/dist/elements/chapters-menu.js +75 -65
- package/dist/elements/chapters-menu.js.map +1 -1
- package/dist/elements/component.d.ts +1 -1
- package/dist/elements/component.d.ts.map +1 -1
- package/dist/elements/component.js +86 -89
- package/dist/elements/component.js.map +1 -1
- package/dist/elements/control-bar.d.ts +18 -5
- package/dist/elements/control-bar.d.ts.map +1 -1
- package/dist/elements/control-bar.js +282 -319
- package/dist/elements/control-bar.js.map +1 -1
- package/dist/elements/current-time.js +26 -25
- package/dist/elements/current-time.js.map +1 -1
- package/dist/elements/drm-badge.d.ts +3 -2
- package/dist/elements/drm-badge.d.ts.map +1 -1
- package/dist/elements/drm-badge.js +109 -141
- package/dist/elements/drm-badge.js.map +1 -1
- package/dist/elements/duration.d.ts.map +1 -1
- package/dist/elements/duration.js +24 -21
- package/dist/elements/duration.js.map +1 -1
- package/dist/elements/error-screen.d.ts.map +1 -1
- package/dist/elements/error-screen.js +68 -102
- package/dist/elements/error-screen.js.map +1 -1
- package/dist/elements/fullscreen-button.js +48 -54
- package/dist/elements/fullscreen-button.js.map +1 -1
- package/dist/elements/live-button.d.ts.map +1 -1
- package/dist/elements/live-button.js +67 -94
- package/dist/elements/live-button.js.map +1 -1
- package/dist/elements/marker-button.d.ts +22 -0
- package/dist/elements/marker-button.d.ts.map +1 -0
- package/dist/elements/marker-button.js +99 -0
- package/dist/elements/marker-button.js.map +1 -0
- package/dist/elements/menu-element.js +31 -28
- package/dist/elements/menu-element.js.map +1 -1
- package/dist/elements/mute-button.js +58 -59
- package/dist/elements/mute-button.js.map +1 -1
- package/dist/elements/pip-button.js +54 -54
- package/dist/elements/pip-button.js.map +1 -1
- package/dist/elements/play-button.d.ts.map +1 -1
- package/dist/elements/play-button.js +73 -58
- package/dist/elements/play-button.js.map +1 -1
- package/dist/elements/quality-menu.d.ts +4 -0
- package/dist/elements/quality-menu.d.ts.map +1 -1
- package/dist/elements/quality-menu.js +82 -71
- package/dist/elements/quality-menu.js.map +1 -1
- package/dist/elements/remaining-time.d.ts.map +1 -1
- package/dist/elements/remaining-time.js +27 -24
- package/dist/elements/remaining-time.js.map +1 -1
- package/dist/elements/scan-button.d.ts +17 -0
- package/dist/elements/scan-button.d.ts.map +1 -0
- package/dist/elements/scan-button.js +117 -0
- package/dist/elements/scan-button.js.map +1 -0
- package/dist/elements/seek-bar.d.ts +99 -15
- package/dist/elements/seek-bar.d.ts.map +1 -1
- package/dist/elements/seek-bar.js +487 -336
- package/dist/elements/seek-bar.js.map +1 -1
- package/dist/elements/shared.d.ts +3 -11
- package/dist/elements/shared.d.ts.map +1 -1
- package/dist/elements/shared.js +44 -144
- package/dist/elements/shared.js.map +1 -1
- package/dist/elements/skip-button.d.ts.map +1 -1
- package/dist/elements/skip-button.js +54 -55
- package/dist/elements/skip-button.js.map +1 -1
- package/dist/elements/spacer.d.ts.map +1 -1
- package/dist/elements/spacer.js +12 -7
- package/dist/elements/spacer.js.map +1 -1
- package/dist/elements/speed-menu.js +60 -55
- package/dist/elements/speed-menu.js.map +1 -1
- package/dist/elements/spinner.d.ts.map +1 -1
- package/dist/elements/spinner.js +52 -78
- package/dist/elements/spinner.js.map +1 -1
- package/dist/elements/start-button.d.ts.map +1 -1
- package/dist/elements/start-button.js +107 -120
- package/dist/elements/start-button.js.map +1 -1
- package/dist/elements/subtitles-menu.d.ts +2 -0
- package/dist/elements/subtitles-menu.d.ts.map +1 -1
- package/dist/elements/subtitles-menu.js +119 -103
- package/dist/elements/subtitles-menu.js.map +1 -1
- package/dist/elements/time-element.d.ts.map +1 -1
- package/dist/elements/time-element.js +36 -28
- package/dist/elements/time-element.js.map +1 -1
- package/dist/elements/title.d.ts.map +1 -1
- package/dist/elements/title.js +105 -137
- package/dist/elements/title.js.map +1 -1
- package/dist/elements/volume-slider.d.ts.map +1 -1
- package/dist/elements/volume-slider.js +47 -45
- package/dist/elements/volume-slider.js.map +1 -1
- package/dist/elements/volume.d.ts.map +1 -1
- package/dist/elements/volume.js +42 -50
- package/dist/elements/volume.js.map +1 -1
- package/dist/entries/airplay-button.js +7 -7
- package/dist/entries/airplay-button.js.map +1 -1
- package/dist/entries/audio-menu.js +7 -6
- package/dist/entries/audio-menu.js.map +1 -1
- package/dist/entries/chapters-menu.js +7 -7
- package/dist/entries/chapters-menu.js.map +1 -1
- package/dist/entries/control-bar.js +7 -6
- package/dist/entries/control-bar.js.map +1 -1
- package/dist/entries/current-time.js +7 -6
- package/dist/entries/current-time.js.map +1 -1
- package/dist/entries/drm-badge.js +7 -6
- package/dist/entries/drm-badge.js.map +1 -1
- package/dist/entries/duration.js +7 -6
- package/dist/entries/duration.js.map +1 -1
- package/dist/entries/error-screen.js +7 -6
- package/dist/entries/error-screen.js.map +1 -1
- package/dist/entries/fullscreen-button.js +7 -6
- package/dist/entries/fullscreen-button.js.map +1 -1
- package/dist/entries/live-button.js +7 -6
- package/dist/entries/live-button.js.map +1 -1
- package/dist/entries/marker-button.d.ts +5 -0
- package/dist/entries/marker-button.d.ts.map +1 -0
- package/dist/entries/marker-button.js +9 -0
- package/dist/entries/marker-button.js.map +1 -0
- package/dist/entries/mute-button.js +7 -6
- package/dist/entries/mute-button.js.map +1 -1
- package/dist/entries/pip-button.js +7 -6
- package/dist/entries/pip-button.js.map +1 -1
- package/dist/entries/play-button.js +7 -6
- package/dist/entries/play-button.js.map +1 -1
- package/dist/entries/quality-menu.js +7 -6
- package/dist/entries/quality-menu.js.map +1 -1
- package/dist/entries/remaining-time.js +7 -7
- package/dist/entries/remaining-time.js.map +1 -1
- package/dist/entries/scan-button.d.ts +5 -0
- package/dist/entries/scan-button.d.ts.map +1 -0
- package/dist/entries/scan-button.js +9 -0
- package/dist/entries/scan-button.js.map +1 -0
- package/dist/entries/seek-bar.js +7 -6
- package/dist/entries/seek-bar.js.map +1 -1
- package/dist/entries/skip-button.js +7 -6
- package/dist/entries/skip-button.js.map +1 -1
- package/dist/entries/spacer.js +7 -6
- package/dist/entries/spacer.js.map +1 -1
- package/dist/entries/speed-menu.js +7 -6
- package/dist/entries/speed-menu.js.map +1 -1
- package/dist/entries/spinner.js +7 -7
- package/dist/entries/spinner.js.map +1 -1
- package/dist/entries/start-button.js +7 -6
- package/dist/entries/start-button.js.map +1 -1
- package/dist/entries/subtitles-menu.js +7 -6
- package/dist/entries/subtitles-menu.js.map +1 -1
- package/dist/entries/title.js +7 -7
- package/dist/entries/title.js.map +1 -1
- package/dist/entries/volume-slider.js +7 -6
- package/dist/entries/volume-slider.js.map +1 -1
- package/dist/entries/volume.js +9 -8
- package/dist/entries/volume.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/controls/chapters.js +40 -7
- package/dist/es2015/controls/cues.js +1 -8
- package/dist/es2015/controls/icons.js +27 -25
- package/dist/es2015/controls/markers.js +36 -0
- package/dist/es2015/controls/menu.js +49 -10
- package/dist/es2015/controls/native-tracks.js +29 -0
- package/dist/es2015/controls/quality-names.js +67 -0
- package/dist/es2015/controls/session.js +16 -4
- package/dist/es2015/controls/slider.js +5 -4
- package/dist/es2015/controls/track-names.js +57 -0
- package/dist/es2015/dom.js +10 -1
- package/dist/es2015/element.js +71 -13
- package/dist/es2015/elements/audio-menu.js +62 -19
- package/dist/es2015/elements/chapters-menu.js +18 -10
- package/dist/es2015/elements/control-bar.js +41 -35
- package/dist/es2015/elements/drm-badge.js +12 -33
- package/dist/es2015/elements/duration.js +2 -1
- package/dist/es2015/elements/error-screen.js +1 -30
- package/dist/es2015/elements/live-button.js +1 -29
- package/dist/es2015/elements/marker-button.js +100 -0
- package/dist/es2015/elements/menu-element.js +2 -2
- package/dist/es2015/elements/play-button.js +10 -3
- package/dist/es2015/elements/quality-menu.js +22 -7
- package/dist/es2015/elements/remaining-time.js +2 -1
- package/dist/es2015/elements/scan-button.js +118 -0
- package/dist/es2015/elements/seek-bar.js +295 -90
- package/dist/es2015/elements/shared.js +5 -106
- package/dist/es2015/elements/skip-button.js +2 -1
- package/dist/es2015/elements/spacer.js +2 -1
- package/dist/es2015/elements/spinner.js +1 -32
- package/dist/es2015/elements/start-button.js +8 -26
- package/dist/es2015/elements/subtitles-menu.js +39 -11
- package/dist/es2015/elements/time-element.js +1 -4
- package/dist/es2015/elements/title.js +1 -45
- package/dist/es2015/elements/volume-slider.js +2 -1
- package/dist/es2015/elements/volume.js +1 -11
- package/dist/es2015/entries/marker-button.js +7 -0
- package/dist/es2015/entries/scan-button.js +7 -0
- package/dist/es2015/index.js +5 -1
- package/dist/es2015/presets.js +1 -1
- package/dist/es2015/style.js +1 -101
- package/dist/es2015/tags.js +3 -1
- package/dist/host.d.ts +3 -0
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +19 -17
- package/dist/host.js.map +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +57 -27
- package/dist/labels.js +13 -9
- package/dist/labels.js.map +1 -1
- package/dist/namespaces.d.ts +9 -26
- package/dist/namespaces.d.ts.map +1 -1
- package/dist/namespaces.js +6 -2
- package/dist/namespaces.js.map +1 -1
- package/dist/presets.js +33 -28
- package/dist/presets.js.map +1 -1
- package/dist/style.d.ts +1 -20
- package/dist/style.d.ts.map +1 -1
- package/dist/style.js +4 -100
- package/dist/style.js.map +1 -1
- package/dist/surface.js +25 -21
- package/dist/surface.js.map +1 -1
- package/dist/tags.d.ts +2 -0
- package/dist/tags.d.ts.map +1 -1
- package/dist/tags.js +32 -26
- package/dist/tags.js.map +1 -1
- package/package.json +4 -4
- package/dist/index.js.map +0 -1
|
@@ -5,31 +5,7 @@ import { Component } from "./component.js";
|
|
|
5
5
|
import { style } from "./shared.js";
|
|
6
6
|
import { fill } from "../labels.js";
|
|
7
7
|
//#region src/elements/drm-badge.ts
|
|
8
|
-
const STYLE =
|
|
9
|
-
:host { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; color: var(--mbx-muted); border-radius: var(--mbx-radius); cursor: default; }
|
|
10
|
-
:host([hidden]) { display: none; }
|
|
11
|
-
:host(:focus-visible) { outline: 2px solid var(--mbx-accent); outline-offset: -2px; }
|
|
12
|
-
[part~="icon"], ::slotted(*) { width: 1.75em; height: 1.75em; fill: currentColor; }
|
|
13
|
-
[part~="tooltip"] {
|
|
14
|
-
position: absolute;
|
|
15
|
-
right: 0;
|
|
16
|
-
bottom: 100%;
|
|
17
|
-
margin-bottom: 8px;
|
|
18
|
-
padding: 8px 10px;
|
|
19
|
-
background: rgba(16, 17, 20, 0.95);
|
|
20
|
-
border-radius: var(--mbx-radius);
|
|
21
|
-
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
|
|
22
|
-
color: var(--mbx-text);
|
|
23
|
-
font-size: 13px;
|
|
24
|
-
line-height: 1.4;
|
|
25
|
-
text-align: left;
|
|
26
|
-
white-space: nowrap;
|
|
27
|
-
pointer-events: none;
|
|
28
|
-
}
|
|
29
|
-
[part~="tooltip"][hidden] { display: none; }
|
|
30
|
-
[part~="tooltip-title"] { font-weight: 600; }
|
|
31
|
-
[part~="tooltip-text"] { color: var(--mbx-muted); }
|
|
32
|
-
`;
|
|
8
|
+
const STYLE = ":host{width:40px;height:40px;color:var(--mbx-muted);border-radius:var(--mbx-radius);cursor:default;justify-content:center;align-items:center;display:inline-flex;position:relative}:host([hidden]){display:none}:host(:focus){outline:2px solid var(--mbx-accent);outline-offset:-2px}:host(:focus:not(:focus-visible)){outline:none}[part~=icon],::slotted(*){fill:currentColor;width:1.75em;height:1.75em}[part~=tooltip]{border-radius:var(--mbx-radius);color:var(--mbx-text);text-align:left;white-space:nowrap;pointer-events:none;background:#101114f2;margin-bottom:8px;padding:8px 10px;font-size:13px;line-height:1.4;position:absolute;bottom:100%;right:0;box-shadow:0 4px 16px #00000080}[part~=tooltip][hidden]{display:none}[part~=tooltip-title]{font-weight:600}[part~=tooltip-text]{color:var(--mbx-muted)}";
|
|
33
9
|
/** The name a viewer knows a key system by. */
|
|
34
10
|
function keySystemName(id) {
|
|
35
11
|
if (id.startsWith("com.widevine")) return "Widevine";
|
|
@@ -48,7 +24,7 @@ var MbxDrmBadge = class extends Component {
|
|
|
48
24
|
}
|
|
49
25
|
constructor() {
|
|
50
26
|
super();
|
|
51
|
-
this.
|
|
27
|
+
this.drm = void 0;
|
|
52
28
|
const root = this.attachShadow({ mode: "open" });
|
|
53
29
|
const slot = document.createElement("slot");
|
|
54
30
|
slot.name = "icon";
|
|
@@ -98,17 +74,20 @@ var MbxDrmBadge = class extends Component {
|
|
|
98
74
|
}
|
|
99
75
|
attach(player) {
|
|
100
76
|
this.follow(player, (engine) => {
|
|
101
|
-
|
|
77
|
+
var _player$player;
|
|
78
|
+
const eme = (_player$player = player.player) === null || _player$player === void 0 || (_player$player = _player$player.session) === null || _player$player === void 0 ? void 0 : _player$player.eme;
|
|
79
|
+
const source = engine !== null && engine !== void 0 ? engine : eme;
|
|
80
|
+
this.drm = engine === null ? eme === null || eme === void 0 ? void 0 : eme.drm : namespaces(engine).drm;
|
|
102
81
|
this.render();
|
|
103
|
-
if (
|
|
82
|
+
if (source === void 0 || this.drm === void 0) return void 0;
|
|
104
83
|
const tick = () => {
|
|
105
84
|
this.render();
|
|
106
85
|
};
|
|
107
86
|
const offs = [
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
];
|
|
87
|
+
"drm:keysystem",
|
|
88
|
+
"drm:keystatus",
|
|
89
|
+
"drm:encrypted"
|
|
90
|
+
].map((event) => source.on(event, tick));
|
|
112
91
|
return () => {
|
|
113
92
|
for (const off of offs) off();
|
|
114
93
|
};
|
|
@@ -119,7 +98,7 @@ var MbxDrmBadge = class extends Component {
|
|
|
119
98
|
}
|
|
120
99
|
render() {
|
|
121
100
|
var _drm$keySystem, _this$getAttribute4;
|
|
122
|
-
const drm = this.
|
|
101
|
+
const drm = this.drm;
|
|
123
102
|
const name = (_drm$keySystem = drm === null || drm === void 0 ? void 0 : drm.keySystem) !== null && _drm$keySystem !== void 0 ? _drm$keySystem : null;
|
|
124
103
|
this.hidden = name === null;
|
|
125
104
|
if (drm === void 0 || name === null) return;
|
|
@@ -6,9 +6,10 @@ import { TimeElement } from "./time-element.js";
|
|
|
6
6
|
* <mbx-duration>: the duration, "4:56", once the metadata is in. A live
|
|
7
7
|
* stream has none, so the element hides while the stream is live.
|
|
8
8
|
*/
|
|
9
|
+
const TRAILING = ":host{text-align:right}";
|
|
9
10
|
var MbxDuration = class extends TimeElement {
|
|
10
11
|
constructor() {
|
|
11
|
-
super(
|
|
12
|
+
super(TRAILING);
|
|
12
13
|
}
|
|
13
14
|
render() {
|
|
14
15
|
const player = this.player;
|
|
@@ -2,36 +2,7 @@ import { el } from "../dom.js";
|
|
|
2
2
|
import { Component } from "./component.js";
|
|
3
3
|
import { style } from "./shared.js";
|
|
4
4
|
//#region src/elements/error-screen.ts
|
|
5
|
-
const STYLE =
|
|
6
|
-
:host {
|
|
7
|
-
position: absolute;
|
|
8
|
-
inset: 0;
|
|
9
|
-
display: flex;
|
|
10
|
-
align-items: center;
|
|
11
|
-
justify-content: center;
|
|
12
|
-
padding: 16px;
|
|
13
|
-
background: rgba(0, 0, 0, 0.75);
|
|
14
|
-
color: var(--mbx-text);
|
|
15
|
-
font: 400 15px/1.4 var(--mbx-font);
|
|
16
|
-
text-align: center;
|
|
17
|
-
}
|
|
18
|
-
:host([hidden]) { display: none; }
|
|
19
|
-
[part~="box"] { display: flex; flex-direction: column; align-items: center; gap: 8px; }
|
|
20
|
-
[part~="title"] { font-size: 18px; font-weight: 600; }
|
|
21
|
-
[part~="detail"] { font-family: monospace; font-size: 13px; color: var(--mbx-error); }
|
|
22
|
-
[part~="retry"] {
|
|
23
|
-
height: 36px;
|
|
24
|
-
padding: 0 16px;
|
|
25
|
-
font: inherit;
|
|
26
|
-
font-weight: 600;
|
|
27
|
-
color: inherit;
|
|
28
|
-
background: transparent;
|
|
29
|
-
border: 1px solid currentColor;
|
|
30
|
-
border-radius: var(--mbx-radius);
|
|
31
|
-
cursor: pointer;
|
|
32
|
-
}
|
|
33
|
-
[part~="retry"]:focus-visible { outline: 2px solid var(--mbx-accent); outline-offset: -2px; }
|
|
34
|
-
`;
|
|
5
|
+
const STYLE = ":host{color:var(--mbx-text);font:400 15px / 1.4 var(--mbx-font);text-align:center;background:#000000bf;justify-content:center;align-items:center;padding:16px;display:flex;position:absolute;top:0;bottom:0;left:0;right:0}:host([hidden]){display:none}[part~=box]{flex-direction:column;align-items:center;display:flex}[part~=box]>:not([hidden])~:not([hidden]){margin-top:8px}[part~=title]{font-size:18px;font-weight:600}[part~=detail]{color:var(--mbx-error);font-family:monospace;font-size:13px}[part~=retry]{height:36px;font:inherit;color:inherit;border-radius:var(--mbx-radius);cursor:pointer;background:0 0;border:1px solid;padding:0 16px;font-weight:600}[part~=retry]:focus{outline:2px solid var(--mbx-accent);outline-offset:-2px}[part~=retry]:focus:not(:focus-visible){outline:none}";
|
|
35
6
|
var MbxErrorScreen = class extends Component {
|
|
36
7
|
static get observedAttributes() {
|
|
37
8
|
return ["label-title", "label-retry"];
|
|
@@ -16,35 +16,7 @@ import { live } from "../controls/session.js";
|
|
|
16
16
|
* `text`, the name from `label-live` and `label-at-edge`. It sits in the
|
|
17
17
|
* bar's seek row unless the page says otherwise.
|
|
18
18
|
*/
|
|
19
|
-
const STYLE =
|
|
20
|
-
:host { display: inline-flex; }
|
|
21
|
-
:host([hidden]) { display: none; }
|
|
22
|
-
[part~="button"] {
|
|
23
|
-
display: inline-flex;
|
|
24
|
-
align-items: center;
|
|
25
|
-
gap: 6px;
|
|
26
|
-
height: 40px;
|
|
27
|
-
padding: 0 8px;
|
|
28
|
-
font: inherit;
|
|
29
|
-
font-size: 12px;
|
|
30
|
-
font-weight: 700;
|
|
31
|
-
letter-spacing: 0.06em;
|
|
32
|
-
color: inherit;
|
|
33
|
-
background: transparent;
|
|
34
|
-
border: 0;
|
|
35
|
-
border-radius: var(--mbx-radius);
|
|
36
|
-
cursor: pointer;
|
|
37
|
-
opacity: 0.9;
|
|
38
|
-
}
|
|
39
|
-
[part~="button"]:hover { opacity: 1; }
|
|
40
|
-
[part~="button"]:disabled { cursor: default; opacity: 1; }
|
|
41
|
-
[part~="button"]:focus-visible { outline: 2px solid var(--mbx-accent); outline-offset: -2px; }
|
|
42
|
-
[part~="dot"] { width: 10px; height: 10px; border-radius: 50%; background: var(--mbx-muted); transition: background 0.2s; }
|
|
43
|
-
:host([at-edge]) [part~="dot"] { background: var(--mbx-live); box-shadow: 0 0 6px var(--mbx-live); }
|
|
44
|
-
@media (prefers-reduced-motion: reduce) {
|
|
45
|
-
[part~="dot"] { transition: none; }
|
|
46
|
-
}
|
|
47
|
-
`;
|
|
19
|
+
const STYLE = ":host{display:inline-flex}:host([hidden]){display:none}[part~=button]{height:40px;font:inherit;letter-spacing:.06em;color:inherit;border-radius:var(--mbx-radius);cursor:pointer;opacity:.9;background:0 0;border:0;align-items:center;padding:0 8px;font-size:12px;font-weight:700;display:inline-flex}[part~=button]:hover{opacity:1}[part~=button]:disabled{cursor:default;opacity:1}[part~=button]:focus{outline:2px solid var(--mbx-accent);outline-offset:-2px}[part~=button]:focus:not(:focus-visible){outline:none}[part~=dot]{background:var(--mbx-muted);border-radius:50%;width:10px;height:10px;margin-right:6px;transition:background .2s}:host([at-edge]) [part~=dot]{background:var(--mbx-live);box-shadow:0 0 6px var(--mbx-live)}@media (prefers-reduced-motion:reduce){[part~=dot]{transition:none}}";
|
|
48
20
|
var MbxLiveButton = class extends Component {
|
|
49
21
|
static get observedAttributes() {
|
|
50
22
|
return [
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { Component } from "./component.js";
|
|
2
|
+
import { BUTTON_STYLE, style } from "./shared.js";
|
|
3
|
+
//#region src/elements/marker-button.ts
|
|
4
|
+
const STYLE_CSS = ":host{right:calc(var(--mbx-pad,8px) + 8px);bottom:calc(var(--mbx-marker-lift,56px) + 12px);z-index:1;position:absolute}:host([hidden]){display:none}[part~=button]{width:auto;height:40px;color:var(--mbx-text);font:inherit;white-space:nowrap;background:#0009;border:1px solid #ffffff80;padding:0 18px;font-weight:600}[part~=button]:hover{background:#000c}";
|
|
5
|
+
const WORDS = {
|
|
6
|
+
"opening-credits": "Skip intro",
|
|
7
|
+
"closing-credits": "Skip credits"
|
|
8
|
+
};
|
|
9
|
+
var MbxMarkerButton = class extends Component {
|
|
10
|
+
static get observedAttributes() {
|
|
11
|
+
return [
|
|
12
|
+
"label-opening-credits",
|
|
13
|
+
"label-closing-credits",
|
|
14
|
+
"label-skip"
|
|
15
|
+
];
|
|
16
|
+
}
|
|
17
|
+
constructor() {
|
|
18
|
+
super();
|
|
19
|
+
this.marker = null;
|
|
20
|
+
this.resizer = null;
|
|
21
|
+
const root = this.attachShadow({ mode: "open" });
|
|
22
|
+
this.button = document.createElement("button");
|
|
23
|
+
this.button.type = "button";
|
|
24
|
+
this.button.setAttribute("part", "button");
|
|
25
|
+
this.button.textContent = "Skip";
|
|
26
|
+
this.button.addEventListener("click", () => {
|
|
27
|
+
var _this$player;
|
|
28
|
+
const video = (_this$player = this.player) === null || _this$player === void 0 ? void 0 : _this$player.video;
|
|
29
|
+
if (video !== void 0 && this.marker !== null) video.currentTime = this.marker.end;
|
|
30
|
+
});
|
|
31
|
+
root.append(style(BUTTON_STYLE + STYLE_CSS), this.button);
|
|
32
|
+
}
|
|
33
|
+
connectedCallback() {
|
|
34
|
+
this.hidden = true;
|
|
35
|
+
super.connectedCallback();
|
|
36
|
+
}
|
|
37
|
+
attach(player) {
|
|
38
|
+
this.listen(player.video, [
|
|
39
|
+
"timeupdate",
|
|
40
|
+
"seeking",
|
|
41
|
+
"emptied"
|
|
42
|
+
], () => {
|
|
43
|
+
this.render();
|
|
44
|
+
});
|
|
45
|
+
this.listen(player, ["markerschange"], () => {
|
|
46
|
+
this.render();
|
|
47
|
+
});
|
|
48
|
+
this.listen(player.video, [
|
|
49
|
+
"play",
|
|
50
|
+
"pause",
|
|
51
|
+
"ended"
|
|
52
|
+
], () => {
|
|
53
|
+
this.fit(player);
|
|
54
|
+
});
|
|
55
|
+
if (typeof ResizeObserver !== "undefined") {
|
|
56
|
+
this.resizer = new ResizeObserver(() => {
|
|
57
|
+
this.fit(player);
|
|
58
|
+
});
|
|
59
|
+
this.resizer.observe(player);
|
|
60
|
+
for (const tag of ["mbx-control-bar", "mbx-title"]) {
|
|
61
|
+
const node = player.querySelector(tag);
|
|
62
|
+
if (node !== null) this.resizer.observe(node);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
this.fit(player);
|
|
66
|
+
this.render();
|
|
67
|
+
}
|
|
68
|
+
detach() {
|
|
69
|
+
var _this$resizer;
|
|
70
|
+
(_this$resizer = this.resizer) === null || _this$resizer === void 0 || _this$resizer.disconnect();
|
|
71
|
+
this.resizer = null;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Lifts the button above the bar's rows, or above the title's text while
|
|
75
|
+
* it shows: each one's box less the padding over its content, which is
|
|
76
|
+
* its fade. A hidden title has no box.
|
|
77
|
+
*/
|
|
78
|
+
fit(player) {
|
|
79
|
+
let lift = 0;
|
|
80
|
+
for (const tag of ["mbx-control-bar", "mbx-title"]) {
|
|
81
|
+
const node = player.querySelector(tag);
|
|
82
|
+
if (node === null) continue;
|
|
83
|
+
const fade = Number.parseFloat(getComputedStyle(node).paddingTop) || 0;
|
|
84
|
+
lift = Math.max(lift, node.getBoundingClientRect().height - fade);
|
|
85
|
+
}
|
|
86
|
+
this.style.setProperty("--mbx-marker-lift", `${lift}px`);
|
|
87
|
+
}
|
|
88
|
+
render() {
|
|
89
|
+
var _player$markers$withi, _this$getAttribute, _ref, _this$getAttribute2;
|
|
90
|
+
const player = this.player;
|
|
91
|
+
this.marker = (_player$markers$withi = player === null || player === void 0 ? void 0 : player.markers.within(player.video.currentTime).find((marker) => marker.kind !== "blocked")) !== null && _player$markers$withi !== void 0 ? _player$markers$withi : null;
|
|
92
|
+
this.hidden = this.marker === null;
|
|
93
|
+
if (this.marker === null) return;
|
|
94
|
+
const kind = this.marker.kind;
|
|
95
|
+
const skip = (_this$getAttribute = this.getAttribute("label-skip")) !== null && _this$getAttribute !== void 0 ? _this$getAttribute : "Skip";
|
|
96
|
+
this.button.textContent = (_ref = (_this$getAttribute2 = this.getAttribute(`label-${kind}`)) !== null && _this$getAttribute2 !== void 0 ? _this$getAttribute2 : WORDS[kind]) !== null && _ref !== void 0 ? _ref : this.marker.label === void 0 ? skip : `${skip} ${this.marker.label}`;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
//#endregion
|
|
100
|
+
export { MbxMarkerButton };
|
|
@@ -10,9 +10,9 @@ var MenuElement = class extends Component {
|
|
|
10
10
|
const root = this.attachShadow({ mode: "open" });
|
|
11
11
|
this.menu = menu({
|
|
12
12
|
host: this,
|
|
13
|
-
|
|
13
|
+
picture: () => {
|
|
14
14
|
var _this$player$video$ge, _this$player;
|
|
15
|
-
return (_this$player$video$ge = (_this$player = this.player) === null || _this$player === void 0 ? void 0 : _this$player.video.getBoundingClientRect()
|
|
15
|
+
return (_this$player$video$ge = (_this$player = this.player) === null || _this$player === void 0 ? void 0 : _this$player.video.getBoundingClientRect()) !== null && _this$player$video$ge !== void 0 ? _this$player$video$ge : null;
|
|
16
16
|
},
|
|
17
17
|
back: (page) => {
|
|
18
18
|
var _this$getAttribute;
|
|
@@ -8,7 +8,9 @@ import { BUTTON_STYLE, iconSlots, show, style } from "./shared.js";
|
|
|
8
8
|
* thing back on click. The glyph is a slot per state, so a page drops its
|
|
9
9
|
* own SVG into `icon-play`, `icon-pause` or `icon-replay`; the name is on
|
|
10
10
|
* the button, from `label-play`, `label-pause` and `label-replay`, where a
|
|
11
|
-
* screen reader reads it.
|
|
11
|
+
* screen reader reads it. While the seek bar holds the video paused for a
|
|
12
|
+
* drag, the button shows the state from before the drag, which the player
|
|
13
|
+
* carries as `scrubbing`.
|
|
12
14
|
*/
|
|
13
15
|
const STATES = [
|
|
14
16
|
"play",
|
|
@@ -53,13 +55,18 @@ var MbxPlayButton = class extends Component {
|
|
|
53
55
|
], () => {
|
|
54
56
|
this.render();
|
|
55
57
|
});
|
|
58
|
+
this.observe(player, ["scrubbing"], () => {
|
|
59
|
+
this.render();
|
|
60
|
+
});
|
|
56
61
|
this.render();
|
|
57
62
|
}
|
|
58
63
|
render() {
|
|
59
|
-
var _this$player2, _this$getAttribute;
|
|
64
|
+
var _this$player2, _this$player$getAttri, _this$player3, _this$getAttribute;
|
|
60
65
|
const video = (_this$player2 = this.player) === null || _this$player2 === void 0 ? void 0 : _this$player2.video;
|
|
61
66
|
if (video === void 0) return;
|
|
62
|
-
const
|
|
67
|
+
const held = (_this$player$getAttri = (_this$player3 = this.player) === null || _this$player3 === void 0 ? void 0 : _this$player3.getAttribute("scrubbing")) !== null && _this$player$getAttri !== void 0 ? _this$player$getAttri : null;
|
|
68
|
+
const paused = held === null ? video.paused : held === "paused";
|
|
69
|
+
const state = video.ended ? "replay" : paused ? "play" : "pause";
|
|
63
70
|
show(this.slots, state);
|
|
64
71
|
this.button.setAttribute("aria-label", (_this$getAttribute = this.getAttribute(`label-${state}`)) !== null && _this$getAttribute !== void 0 ? _this$getAttribute : LABELS[state]);
|
|
65
72
|
}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { show } from "./shared.js";
|
|
2
2
|
import { MenuElement, single } from "./menu-element.js";
|
|
3
|
+
import { qualityLabels, qualityNames } from "../controls/quality-names.js";
|
|
3
4
|
//#region src/elements/quality-menu.ts
|
|
4
5
|
const AUTO = "auto";
|
|
5
|
-
function renditionLabel(rendition) {
|
|
6
|
-
if (rendition.height !== void 0) return `${rendition.height}p`;
|
|
7
|
-
return `${Math.round(rendition.bitrate / 1e3)} kbps`;
|
|
8
|
-
}
|
|
9
6
|
var MbxQualityMenu = class extends MenuElement {
|
|
10
7
|
static get observedAttributes() {
|
|
11
8
|
return [
|
|
@@ -17,6 +14,7 @@ var MbxQualityMenu = class extends MenuElement {
|
|
|
17
14
|
constructor() {
|
|
18
15
|
super(...single("settings"));
|
|
19
16
|
this.engine = null;
|
|
17
|
+
this.playing = void 0;
|
|
20
18
|
show(this.slots, "default");
|
|
21
19
|
}
|
|
22
20
|
name() {
|
|
@@ -30,7 +28,12 @@ var MbxQualityMenu = class extends MenuElement {
|
|
|
30
28
|
const tick = () => {
|
|
31
29
|
this.render();
|
|
32
30
|
};
|
|
31
|
+
const clock = () => {
|
|
32
|
+
if (this.playingName() !== this.playing) this.render();
|
|
33
|
+
};
|
|
34
|
+
player.video.addEventListener("timeupdate", clock);
|
|
33
35
|
const offs = [
|
|
36
|
+
() => player.video.removeEventListener("timeupdate", clock),
|
|
34
37
|
engine.on("tracks:changed", tick),
|
|
35
38
|
engine.on("quality:constraints-unsatisfiable", tick),
|
|
36
39
|
engine.on("quality:pin-unsatisfiable", tick)
|
|
@@ -49,8 +52,12 @@ var MbxQualityMenu = class extends MenuElement {
|
|
|
49
52
|
return;
|
|
50
53
|
}
|
|
51
54
|
const quality = engine.quality;
|
|
52
|
-
|
|
53
|
-
|
|
55
|
+
this.playing = this.playingName();
|
|
56
|
+
const items = [[
|
|
57
|
+
AUTO,
|
|
58
|
+
(_this$getAttribute = this.getAttribute("label-auto")) !== null && _this$getAttribute !== void 0 ? _this$getAttribute : "Auto",
|
|
59
|
+
this.playing
|
|
60
|
+
], ...qualityNames(quality.selectable)];
|
|
54
61
|
this.menu.fill([{
|
|
55
62
|
name: "rendition",
|
|
56
63
|
items,
|
|
@@ -61,7 +68,15 @@ var MbxQualityMenu = class extends MenuElement {
|
|
|
61
68
|
this.render();
|
|
62
69
|
}
|
|
63
70
|
}]);
|
|
64
|
-
this.hidden =
|
|
71
|
+
this.hidden = items.length === 1;
|
|
72
|
+
}
|
|
73
|
+
/** The name of the rendition that plays, under Auto only: a pin names itself by its tick. */
|
|
74
|
+
playingName() {
|
|
75
|
+
var _this$engine, _quality$playing, _qualityLabels$find;
|
|
76
|
+
const quality = (_this$engine = this.engine) === null || _this$engine === void 0 ? void 0 : _this$engine.quality;
|
|
77
|
+
if (quality === void 0 || quality.pinned !== null) return void 0;
|
|
78
|
+
const id = (_quality$playing = quality.playing) === null || _quality$playing === void 0 ? void 0 : _quality$playing.id;
|
|
79
|
+
return (_qualityLabels$find = qualityLabels(quality.selectable).find(([candidate]) => candidate === id)) === null || _qualityLabels$find === void 0 ? void 0 : _qualityLabels$find[1];
|
|
65
80
|
}
|
|
66
81
|
};
|
|
67
82
|
//#endregion
|
|
@@ -8,9 +8,10 @@ import { TimeElement } from "./time-element.js";
|
|
|
8
8
|
* left more often than where they are. A live stream has no end, so the
|
|
9
9
|
* element hides while the stream is live, as the duration does.
|
|
10
10
|
*/
|
|
11
|
+
const TRAILING = ":host{text-align:right}";
|
|
11
12
|
var MbxRemainingTime = class extends TimeElement {
|
|
12
13
|
constructor() {
|
|
13
|
-
super(
|
|
14
|
+
super(TRAILING);
|
|
14
15
|
}
|
|
15
16
|
render() {
|
|
16
17
|
const player = this.player;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { el, setChildren } from "../dom.js";
|
|
2
|
+
import { icon } from "../controls/icons.js";
|
|
3
|
+
import { Component } from "./component.js";
|
|
4
|
+
import { BUTTON_STYLE, style } from "./shared.js";
|
|
5
|
+
import { optional } from "../controls/session.js";
|
|
6
|
+
//#region src/elements/scan-button.ts
|
|
7
|
+
/**
|
|
8
|
+
* <mbx-scan-button>: fast forward, or rewind with `direction="backward"`,
|
|
9
|
+
* through the I-frame track: `engine.trick.setRate`, see the engine guide's
|
|
10
|
+
* trick play chapter. Each press steps up through `rates`, "4 8 16" by
|
|
11
|
+
* default, and a press past the last one plays at normal speed again. A
|
|
12
|
+
* press while the other button scans starts this one at its first rate.
|
|
13
|
+
* Every rate must be above 2, the engine's own floor for a scan.
|
|
14
|
+
*
|
|
15
|
+
* The button shows only when the session has an I-frame track: without
|
|
16
|
+
* one there is no picture to scan with, and the speed menu covers playback
|
|
17
|
+
* speed. It hides too on a live stream whose window is too short to seek,
|
|
18
|
+
* where the player carries `live` and not `seekable`, as the seek bar does. It carries `aria-pressed` and `scanning` while it scans, and its
|
|
19
|
+
* `rate` part shows the rate, "8×". The name comes from `label`,
|
|
20
|
+
* "Fast forward" or "Rewind".
|
|
21
|
+
*/
|
|
22
|
+
const STYLE_CSS = "[part~=button]{position:relative}[part~=rate]{font-variant-numeric:tabular-nums;font-size:10px;font-weight:700;line-height:1;position:absolute;bottom:2px;right:0}[part~=rate][hidden]{display:none}";
|
|
23
|
+
const RATES = [
|
|
24
|
+
4,
|
|
25
|
+
8,
|
|
26
|
+
16
|
|
27
|
+
];
|
|
28
|
+
/** The engine's floor: a scan rate is above 2 or below -2. */
|
|
29
|
+
const FLOOR = 2;
|
|
30
|
+
/**
|
|
31
|
+
* What changes the rate or whether scanning is possible: every rate change,
|
|
32
|
+
* from either button, the page, or the engine ending a scan, and a new track
|
|
33
|
+
* list, which is when an I-frame track appears.
|
|
34
|
+
*/
|
|
35
|
+
const ENGINE_EVENTS = ["trick:rate", "tracks:changed"];
|
|
36
|
+
const STYLE = BUTTON_STYLE + STYLE_CSS;
|
|
37
|
+
var MbxScanButton = class extends Component {
|
|
38
|
+
static get observedAttributes() {
|
|
39
|
+
return [
|
|
40
|
+
"direction",
|
|
41
|
+
"rates",
|
|
42
|
+
"label"
|
|
43
|
+
];
|
|
44
|
+
}
|
|
45
|
+
constructor() {
|
|
46
|
+
super();
|
|
47
|
+
const root = this.attachShadow({ mode: "open" });
|
|
48
|
+
this.button = el("button", "button");
|
|
49
|
+
this.button.type = "button";
|
|
50
|
+
this.glyph = document.createElement("slot");
|
|
51
|
+
this.glyph.name = "icon";
|
|
52
|
+
this.badge = el("span", "rate");
|
|
53
|
+
this.badge.hidden = true;
|
|
54
|
+
this.button.append(this.glyph, this.badge);
|
|
55
|
+
this.button.addEventListener("click", () => {
|
|
56
|
+
this.step();
|
|
57
|
+
});
|
|
58
|
+
root.append(style(STYLE), this.button);
|
|
59
|
+
}
|
|
60
|
+
connectedCallback() {
|
|
61
|
+
this.hidden = true;
|
|
62
|
+
super.connectedCallback();
|
|
63
|
+
}
|
|
64
|
+
backward() {
|
|
65
|
+
return this.getAttribute("direction") === "backward";
|
|
66
|
+
}
|
|
67
|
+
/** The rates to step through, each above the floor, in the order given. */
|
|
68
|
+
rates() {
|
|
69
|
+
var _this$getAttribute;
|
|
70
|
+
const own = ((_this$getAttribute = this.getAttribute("rates")) !== null && _this$getAttribute !== void 0 ? _this$getAttribute : "").split(/\s+/).map(Number).filter((rate) => Number.isFinite(rate) && rate > FLOOR);
|
|
71
|
+
return own.length > 0 ? own : RATES;
|
|
72
|
+
}
|
|
73
|
+
step() {
|
|
74
|
+
var _this$player$engine, _this$player;
|
|
75
|
+
const trick = optional((_this$player$engine = (_this$player = this.player) === null || _this$player === void 0 ? void 0 : _this$player.engine) !== null && _this$player$engine !== void 0 ? _this$player$engine : null).trick;
|
|
76
|
+
if ((trick === null || trick === void 0 ? void 0 : trick.available) !== true) return;
|
|
77
|
+
const sign = this.backward() ? -1 : 1;
|
|
78
|
+
const rates = this.rates();
|
|
79
|
+
const now = trick.rate * sign;
|
|
80
|
+
const next = now > FLOOR ? rates[rates.indexOf(now) + 1] : rates[0];
|
|
81
|
+
trick.setRate(next === void 0 ? 1 : next * sign);
|
|
82
|
+
this.render();
|
|
83
|
+
}
|
|
84
|
+
attach(player) {
|
|
85
|
+
const tick = () => {
|
|
86
|
+
this.render();
|
|
87
|
+
};
|
|
88
|
+
this.listen(player.video, ["emptied"], tick);
|
|
89
|
+
this.observe(player, ["live", "seekable"], tick);
|
|
90
|
+
this.follow(player, (engine) => {
|
|
91
|
+
tick();
|
|
92
|
+
if (engine === null) return void 0;
|
|
93
|
+
const offs = ENGINE_EVENTS.map((name) => engine.on(name, tick));
|
|
94
|
+
return () => {
|
|
95
|
+
for (const off of offs) off();
|
|
96
|
+
};
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
render() {
|
|
100
|
+
var _this$player$engine2, _this$player2, _trick$rate, _this$getAttribute2;
|
|
101
|
+
const trick = optional((_this$player$engine2 = (_this$player2 = this.player) === null || _this$player2 === void 0 ? void 0 : _this$player2.engine) !== null && _this$player$engine2 !== void 0 ? _this$player$engine2 : null).trick;
|
|
102
|
+
const backward = this.backward();
|
|
103
|
+
const player = this.player;
|
|
104
|
+
const unseekable = (player === null || player === void 0 ? void 0 : player.hasAttribute("live")) === true && !player.hasAttribute("seekable");
|
|
105
|
+
this.hidden = (trick === null || trick === void 0 ? void 0 : trick.available) !== true || unseekable;
|
|
106
|
+
const rate = (_trick$rate = trick === null || trick === void 0 ? void 0 : trick.rate) !== null && _trick$rate !== void 0 ? _trick$rate : 1;
|
|
107
|
+
const on = backward ? rate < -2 : rate > FLOOR;
|
|
108
|
+
this.toggleAttribute("scanning", on);
|
|
109
|
+
this.button.setAttribute("aria-pressed", String(on));
|
|
110
|
+
this.badge.hidden = !on;
|
|
111
|
+
this.badge.textContent = on ? `${Math.abs(rate)}×` : "";
|
|
112
|
+
setChildren(this.glyph, icon(backward ? "fast-backward" : "fast-forward"));
|
|
113
|
+
const name = (_this$getAttribute2 = this.getAttribute("label")) !== null && _this$getAttribute2 !== void 0 ? _this$getAttribute2 : backward ? "Rewind" : "Fast forward";
|
|
114
|
+
this.button.setAttribute("aria-label", name);
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
//#endregion
|
|
118
|
+
export { MbxScanButton };
|