@mattebox/player 0.11.0 → 0.12.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/announcer.d.ts +6 -3
- package/dist/announcer.d.ts.map +1 -1
- package/dist/announcer.js +17 -14
- package/dist/announcer.js.map +1 -1
- package/dist/cdn/mattebox-player.min.js +3 -3
- package/dist/controls/airplay.js +1 -2
- package/dist/controls/chapters.js +1 -2
- package/dist/controls/cues.js +1 -2
- package/dist/controls/fullscreen.js +1 -2
- package/dist/controls/icons.js +1 -2
- package/dist/controls/markers.d.ts +2 -15
- package/dist/controls/markers.d.ts.map +1 -1
- package/dist/controls/markers.js +1 -2
- package/dist/controls/markers.js.map +1 -1
- package/dist/controls/menu.js +1 -2
- package/dist/controls/native-tracks.js +1 -2
- package/dist/controls/pip.js +1 -2
- package/dist/controls/quality-names.js +1 -2
- package/dist/controls/ranges.js +1 -2
- package/dist/controls/session.js +1 -2
- package/dist/controls/slider.js +1 -2
- package/dist/controls/time.js +1 -2
- package/dist/controls/track-names.d.ts +3 -2
- package/dist/controls/track-names.d.ts.map +1 -1
- package/dist/controls/track-names.js +5 -5
- package/dist/controls/track-names.js.map +1 -1
- package/dist/dom.js +1 -2
- package/dist/element-entry.d.ts +4 -1
- package/dist/element-entry.d.ts.map +1 -1
- package/dist/element-entry.js +1 -2
- package/dist/element-entry.js.map +1 -1
- package/dist/element.d.ts +90 -6
- package/dist/element.d.ts.map +1 -1
- package/dist/element.js +212 -30
- package/dist/element.js.map +1 -1
- package/dist/elements/airplay-button.js +2 -3
- package/dist/elements/airplay-button.js.map +1 -1
- package/dist/elements/audio-menu.d.ts +3 -2
- package/dist/elements/audio-menu.d.ts.map +1 -1
- package/dist/elements/audio-menu.js +18 -12
- package/dist/elements/audio-menu.js.map +1 -1
- package/dist/elements/chapters-menu.d.ts +2 -1
- package/dist/elements/chapters-menu.d.ts.map +1 -1
- package/dist/elements/chapters-menu.js +2 -3
- package/dist/elements/chapters-menu.js.map +1 -1
- package/dist/elements/component.d.ts +9 -0
- package/dist/elements/component.d.ts.map +1 -1
- package/dist/elements/component.js +16 -2
- package/dist/elements/component.js.map +1 -1
- package/dist/elements/control-bar.js +1 -2
- package/dist/elements/current-time.js +1 -2
- package/dist/elements/drm-badge.js +4 -5
- package/dist/elements/drm-badge.js.map +1 -1
- package/dist/elements/duration.js +1 -2
- package/dist/elements/error-screen.d.ts +9 -0
- package/dist/elements/error-screen.d.ts.map +1 -1
- package/dist/elements/error-screen.js +54 -12
- package/dist/elements/error-screen.js.map +1 -1
- package/dist/elements/fullscreen-button.js +2 -3
- package/dist/elements/fullscreen-button.js.map +1 -1
- package/dist/elements/live-button.js +3 -4
- package/dist/elements/live-button.js.map +1 -1
- package/dist/elements/marker-button.d.ts.map +1 -1
- package/dist/elements/marker-button.js +7 -6
- package/dist/elements/marker-button.js.map +1 -1
- package/dist/elements/menu-element.d.ts +3 -2
- package/dist/elements/menu-element.d.ts.map +1 -1
- package/dist/elements/menu-element.js +3 -4
- package/dist/elements/menu-element.js.map +1 -1
- package/dist/elements/mute-button.js +2 -3
- package/dist/elements/mute-button.js.map +1 -1
- package/dist/elements/pip-button.js +2 -3
- package/dist/elements/pip-button.js.map +1 -1
- package/dist/elements/play-button.js +2 -3
- package/dist/elements/play-button.js.map +1 -1
- package/dist/elements/quality-menu.d.ts +2 -1
- package/dist/elements/quality-menu.d.ts.map +1 -1
- package/dist/elements/quality-menu.js +3 -4
- package/dist/elements/quality-menu.js.map +1 -1
- package/dist/elements/remaining-time.js +1 -2
- package/dist/elements/scan-button.d.ts.map +1 -1
- package/dist/elements/scan-button.js +2 -3
- package/dist/elements/scan-button.js.map +1 -1
- package/dist/elements/seek-bar.d.ts +2 -0
- package/dist/elements/seek-bar.d.ts.map +1 -1
- package/dist/elements/seek-bar.js +10 -7
- package/dist/elements/seek-bar.js.map +1 -1
- package/dist/elements/shared.js +1 -2
- package/dist/elements/skip-button.d.ts.map +1 -1
- package/dist/elements/skip-button.js +2 -3
- package/dist/elements/skip-button.js.map +1 -1
- package/dist/elements/spacer.js +1 -2
- package/dist/elements/speed-menu.d.ts +2 -1
- package/dist/elements/speed-menu.d.ts.map +1 -1
- package/dist/elements/speed-menu.js +3 -4
- package/dist/elements/speed-menu.js.map +1 -1
- package/dist/elements/spinner.d.ts +1 -1
- package/dist/elements/spinner.js +2 -4
- package/dist/elements/spinner.js.map +1 -1
- package/dist/elements/start-button.d.ts.map +1 -1
- package/dist/elements/start-button.js +2 -4
- package/dist/elements/start-button.js.map +1 -1
- package/dist/elements/subtitles-menu.d.ts +2 -1
- package/dist/elements/subtitles-menu.d.ts.map +1 -1
- package/dist/elements/subtitles-menu.js +51 -22
- package/dist/elements/subtitles-menu.js.map +1 -1
- package/dist/elements/time-element.js +1 -2
- package/dist/elements/title.d.ts.map +1 -1
- package/dist/elements/title.js +11 -5
- package/dist/elements/title.js.map +1 -1
- package/dist/elements/video-menu.d.ts +2 -1
- package/dist/elements/video-menu.d.ts.map +1 -1
- package/dist/elements/video-menu.js +12 -12
- package/dist/elements/video-menu.js.map +1 -1
- package/dist/elements/volume-slider.js +2 -3
- package/dist/elements/volume-slider.js.map +1 -1
- package/dist/elements/volume.js +1 -2
- package/dist/entries/airplay-button.js +1 -2
- package/dist/entries/audio-menu.js +1 -2
- package/dist/entries/chapters-menu.js +1 -2
- package/dist/entries/control-bar.js +1 -2
- package/dist/entries/current-time.js +1 -2
- package/dist/entries/drm-badge.js +1 -2
- package/dist/entries/duration.js +1 -2
- package/dist/entries/error-screen.js +1 -2
- package/dist/entries/fullscreen-button.js +1 -2
- package/dist/entries/live-button.js +1 -2
- package/dist/entries/marker-button.js +1 -2
- package/dist/entries/mute-button.js +1 -2
- package/dist/entries/pip-button.js +1 -2
- package/dist/entries/play-button.js +1 -2
- package/dist/entries/quality-menu.js +1 -2
- package/dist/entries/remaining-time.js +1 -2
- package/dist/entries/scan-button.js +1 -2
- package/dist/entries/seek-bar.js +1 -2
- package/dist/entries/skip-button.js +1 -2
- package/dist/entries/spacer.js +1 -2
- package/dist/entries/speed-menu.js +1 -2
- package/dist/entries/spinner.js +1 -2
- package/dist/entries/start-button.js +1 -2
- package/dist/entries/subtitles-menu.js +1 -2
- package/dist/entries/title.js +1 -2
- package/dist/entries/video-menu.js +1 -2
- package/dist/entries/volume-slider.js +1 -2
- package/dist/entries/volume.js +1 -2
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/asyncToGenerator.js +1 -2
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/defineProperty.js +1 -2
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/objectSpread2.js +1 -2
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/toPrimitive.js +1 -2
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/toPropertyKey.js +1 -2
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/typeof.js +1 -2
- package/dist/es2015/announcer.js +18 -15
- package/dist/es2015/controls/airplay.js +1 -2
- package/dist/es2015/controls/chapters.js +2 -3
- package/dist/es2015/controls/cues.js +1 -2
- package/dist/es2015/controls/fullscreen.js +1 -2
- package/dist/es2015/controls/icons.js +1 -2
- package/dist/es2015/controls/markers.js +1 -2
- package/dist/es2015/controls/menu.js +2 -3
- package/dist/es2015/controls/native-tracks.js +1 -2
- package/dist/es2015/controls/pip.js +1 -2
- package/dist/es2015/controls/quality-names.js +1 -2
- package/dist/es2015/controls/ranges.js +1 -2
- package/dist/es2015/controls/session.js +1 -2
- package/dist/es2015/controls/slider.js +1 -2
- package/dist/es2015/controls/time.js +1 -2
- package/dist/es2015/controls/track-names.js +5 -5
- package/dist/es2015/dom.js +1 -2
- package/dist/es2015/element-entry.js +1 -2
- package/dist/es2015/element.js +227 -37
- package/dist/es2015/elements/airplay-button.js +2 -4
- package/dist/es2015/elements/audio-menu.js +18 -16
- package/dist/es2015/elements/chapters-menu.js +2 -3
- package/dist/es2015/elements/component.js +18 -2
- package/dist/es2015/elements/control-bar.js +1 -2
- package/dist/es2015/elements/current-time.js +1 -2
- package/dist/es2015/elements/drm-badge.js +5 -7
- package/dist/es2015/elements/duration.js +1 -2
- package/dist/es2015/elements/error-screen.js +56 -13
- package/dist/es2015/elements/fullscreen-button.js +2 -4
- package/dist/es2015/elements/live-button.js +3 -5
- package/dist/es2015/elements/marker-button.js +8 -7
- package/dist/es2015/elements/menu-element.js +3 -8
- package/dist/es2015/elements/mute-button.js +3 -4
- package/dist/es2015/elements/pip-button.js +2 -4
- package/dist/es2015/elements/play-button.js +2 -4
- package/dist/es2015/elements/quality-menu.js +4 -5
- package/dist/es2015/elements/remaining-time.js +1 -2
- package/dist/es2015/elements/scan-button.js +3 -4
- package/dist/es2015/elements/seek-bar.js +12 -11
- package/dist/es2015/elements/shared.js +1 -2
- package/dist/es2015/elements/skip-button.js +2 -4
- package/dist/es2015/elements/spacer.js +1 -2
- package/dist/es2015/elements/speed-menu.js +4 -5
- package/dist/es2015/elements/spinner.js +2 -5
- package/dist/es2015/elements/start-button.js +3 -5
- package/dist/es2015/elements/subtitles-menu.js +53 -31
- package/dist/es2015/elements/time-element.js +1 -2
- package/dist/es2015/elements/title.js +12 -6
- package/dist/es2015/elements/video-menu.js +12 -12
- package/dist/es2015/elements/volume-slider.js +3 -4
- package/dist/es2015/elements/volume.js +1 -2
- package/dist/es2015/entries/airplay-button.js +1 -2
- package/dist/es2015/entries/audio-menu.js +1 -2
- package/dist/es2015/entries/chapters-menu.js +1 -2
- package/dist/es2015/entries/control-bar.js +1 -2
- package/dist/es2015/entries/current-time.js +1 -2
- package/dist/es2015/entries/drm-badge.js +1 -2
- package/dist/es2015/entries/duration.js +1 -2
- package/dist/es2015/entries/error-screen.js +1 -2
- package/dist/es2015/entries/fullscreen-button.js +1 -2
- package/dist/es2015/entries/live-button.js +1 -2
- package/dist/es2015/entries/marker-button.js +1 -2
- package/dist/es2015/entries/mute-button.js +1 -2
- package/dist/es2015/entries/pip-button.js +1 -2
- package/dist/es2015/entries/play-button.js +1 -2
- package/dist/es2015/entries/quality-menu.js +1 -2
- package/dist/es2015/entries/remaining-time.js +1 -2
- package/dist/es2015/entries/scan-button.js +1 -2
- package/dist/es2015/entries/seek-bar.js +1 -2
- package/dist/es2015/entries/skip-button.js +1 -2
- package/dist/es2015/entries/spacer.js +1 -2
- package/dist/es2015/entries/speed-menu.js +1 -2
- package/dist/es2015/entries/spinner.js +1 -2
- package/dist/es2015/entries/start-button.js +1 -2
- package/dist/es2015/entries/subtitles-menu.js +1 -2
- package/dist/es2015/entries/title.js +1 -2
- package/dist/es2015/entries/video-menu.js +1 -2
- package/dist/es2015/entries/volume-slider.js +1 -2
- package/dist/es2015/entries/volume.js +1 -2
- package/dist/es2015/host.js +1 -2
- package/dist/es2015/ids.js +33 -0
- package/dist/es2015/index.js +2 -1
- package/dist/es2015/labels.js +1 -2
- package/dist/es2015/locales/ar.js +75 -0
- package/dist/es2015/locales/ca.js +75 -0
- package/dist/es2015/locales/de.js +75 -0
- package/dist/es2015/locales/es.js +75 -0
- package/dist/es2015/locales/fr.js +75 -0
- package/dist/es2015/locales/hi.js +75 -0
- package/dist/es2015/locales/it.js +75 -0
- package/dist/es2015/locales/ja.js +75 -0
- package/dist/es2015/locales/ko.js +75 -0
- package/dist/es2015/locales/pt.js +75 -0
- package/dist/es2015/locales/zh.js +75 -0
- package/dist/es2015/locales.js +61 -0
- package/dist/es2015/namespaces.js +1 -2
- package/dist/es2015/presets.js +2 -3
- package/dist/es2015/style.js +1 -2
- package/dist/es2015/surface.js +12 -4
- package/dist/es2015/tags.js +1 -2
- package/dist/es2015/text.js +15 -0
- package/dist/es2015/trackers.js +43 -0
- package/dist/es2015/video-sources.js +2 -3
- package/dist/host.d.ts +40 -1
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +1 -2
- package/dist/host.js.map +1 -1
- package/dist/ids.d.ts +19 -0
- package/dist/ids.d.ts.map +1 -0
- package/dist/ids.js +34 -0
- package/dist/ids.js.map +1 -0
- package/dist/index.d.ts +8 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/labels.js +1 -2
- package/dist/locales/ar.d.ts +75 -0
- package/dist/locales/ar.d.ts.map +1 -0
- package/dist/locales/ar.js +77 -0
- package/dist/locales/ar.js.map +1 -0
- package/dist/locales/ca.d.ts +75 -0
- package/dist/locales/ca.d.ts.map +1 -0
- package/dist/locales/ca.js +77 -0
- package/dist/locales/ca.js.map +1 -0
- package/dist/locales/de.d.ts +75 -0
- package/dist/locales/de.d.ts.map +1 -0
- package/dist/locales/de.js +77 -0
- package/dist/locales/de.js.map +1 -0
- package/dist/locales/es.d.ts +75 -0
- package/dist/locales/es.d.ts.map +1 -0
- package/dist/locales/es.js +77 -0
- package/dist/locales/es.js.map +1 -0
- package/dist/locales/fr.d.ts +75 -0
- package/dist/locales/fr.d.ts.map +1 -0
- package/dist/locales/fr.js +77 -0
- package/dist/locales/fr.js.map +1 -0
- package/dist/locales/hi.d.ts +75 -0
- package/dist/locales/hi.d.ts.map +1 -0
- package/dist/locales/hi.js +77 -0
- package/dist/locales/hi.js.map +1 -0
- package/dist/locales/it.d.ts +75 -0
- package/dist/locales/it.d.ts.map +1 -0
- package/dist/locales/it.js +77 -0
- package/dist/locales/it.js.map +1 -0
- package/dist/locales/ja.d.ts +75 -0
- package/dist/locales/ja.d.ts.map +1 -0
- package/dist/locales/ja.js +77 -0
- package/dist/locales/ja.js.map +1 -0
- package/dist/locales/ko.d.ts +75 -0
- package/dist/locales/ko.d.ts.map +1 -0
- package/dist/locales/ko.js +77 -0
- package/dist/locales/ko.js.map +1 -0
- package/dist/locales/pt.d.ts +75 -0
- package/dist/locales/pt.d.ts.map +1 -0
- package/dist/locales/pt.js +77 -0
- package/dist/locales/pt.js.map +1 -0
- package/dist/locales/zh.d.ts +75 -0
- package/dist/locales/zh.d.ts.map +1 -0
- package/dist/locales/zh.js +77 -0
- package/dist/locales/zh.js.map +1 -0
- package/dist/locales.d.ts +27 -0
- package/dist/locales.d.ts.map +1 -0
- package/dist/locales.js +48 -0
- package/dist/locales.js.map +1 -0
- package/dist/messages.d.ts +167 -0
- package/dist/messages.d.ts.map +1 -0
- package/dist/namespaces.js +1 -2
- package/dist/presets.js +1 -2
- package/dist/style.js +1 -2
- package/dist/surface.d.ts +4 -1
- package/dist/surface.d.ts.map +1 -1
- package/dist/surface.js +12 -4
- package/dist/surface.js.map +1 -1
- package/dist/tags.js +1 -2
- package/dist/text.d.ts +14 -0
- package/dist/text.d.ts.map +1 -0
- package/dist/text.js +16 -0
- package/dist/text.js.map +1 -0
- package/dist/trackers.d.ts +18 -0
- package/dist/trackers.d.ts.map +1 -0
- package/dist/trackers.js +45 -0
- package/dist/trackers.js.map +1 -0
- package/dist/video-sources.js +1 -2
- package/package.json +11 -3
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { PLAYER } from "../tags.js";
|
|
2
|
+
import { textIn } from "../text.js";
|
|
2
3
|
import { findPlayer } from "../host.js";
|
|
3
|
-
|
|
4
|
+
// src/elements/component.ts
|
|
4
5
|
var Component = class extends HTMLElement {
|
|
5
6
|
constructor() {
|
|
6
7
|
super();
|
|
@@ -27,6 +28,9 @@ var Component = class extends HTMLElement {
|
|
|
27
28
|
tier();
|
|
28
29
|
this.render();
|
|
29
30
|
});
|
|
31
|
+
this.listen(found, ["localechange"], () => {
|
|
32
|
+
this.render();
|
|
33
|
+
});
|
|
30
34
|
tier();
|
|
31
35
|
this.attach(this.player);
|
|
32
36
|
};
|
|
@@ -52,6 +56,19 @@ var Component = class extends HTMLElement {
|
|
|
52
56
|
for (const name of names) target.removeEventListener(name, fn);
|
|
53
57
|
});
|
|
54
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* A word the control shows: its `attribute` when the page set one, else
|
|
61
|
+
* the player's language's `id`, else `english`.
|
|
62
|
+
*/
|
|
63
|
+
word(attribute, id, english) {
|
|
64
|
+
var _ref, _this$getAttribute, _this$player;
|
|
65
|
+
return (_ref = (_this$getAttribute = this.getAttribute(attribute)) !== null && _this$getAttribute !== void 0 ? _this$getAttribute : (_this$player = this.player) === null || _this$player === void 0 ? void 0 : _this$player.message(id)) !== null && _ref !== void 0 ? _ref : english;
|
|
66
|
+
}
|
|
67
|
+
/** Words the page gave, in the player's language. */
|
|
68
|
+
pageText(text) {
|
|
69
|
+
var _this$player$locale, _this$player2;
|
|
70
|
+
return textIn(text, (_this$player$locale = (_this$player2 = this.player) === null || _this$player2 === void 0 ? void 0 : _this$player2.locale) !== null && _this$player$locale !== void 0 ? _this$player$locale : "");
|
|
71
|
+
}
|
|
55
72
|
/** Keeps `off` to run on detach. */
|
|
56
73
|
keep(off) {
|
|
57
74
|
this.offs.push(off);
|
|
@@ -91,5 +108,4 @@ var Component = class extends HTMLElement {
|
|
|
91
108
|
/** Draws the current state. Called on every observed attribute change while attached. */
|
|
92
109
|
render() {}
|
|
93
110
|
};
|
|
94
|
-
//#endregion
|
|
95
111
|
export { Component };
|
|
@@ -3,7 +3,7 @@ import { Component } from "./component.js";
|
|
|
3
3
|
import { number, shownPaused, style } from "./shared.js";
|
|
4
4
|
import { cueLift, cueStyle } from "../controls/cues.js";
|
|
5
5
|
import { fullscreen } from "../controls/fullscreen.js";
|
|
6
|
-
|
|
6
|
+
// src/elements/control-bar.ts
|
|
7
7
|
const STYLE = ":host{box-sizing:border-box;color:var(--mbx-text);font:500 1em / 1.2 var(--mbx-font);background:linear-gradient(#0000,#0009);flex-direction:column;padding:2.5em 1em .75em;transition:opacity .2s;display:flex;position:absolute;bottom:0;left:0;right:0}:host([menu]){z-index:2;--mbx-tooltip:none}:host([idle]){opacity:0;pointer-events:none}[part~=row]{align-items:center;margin:0 -.25em;display:flex}[part~=buttons-row]{margin-top:.25em}[part~=seek-row]{margin:0 -.5em}slot:not([name])::slotted(*){margin:0 .25em}slot[name=seek]::slotted(*){margin:0 .5em}::slotted([collapsed]){display:none}@media (prefers-reduced-motion:reduce){:host{transition:none}}:host([layout=compact]){padding:1.5em .5em .25em}";
|
|
8
8
|
const IDLE_MS = 3e3;
|
|
9
9
|
const SEEK_STEP = 5;
|
|
@@ -320,5 +320,4 @@ var MbxControlBar = class extends Component {
|
|
|
320
320
|
player.removeAttribute("fullscreen");
|
|
321
321
|
}
|
|
322
322
|
};
|
|
323
|
-
//#endregion
|
|
324
323
|
export { MbxControlBar };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { format } from "../controls/time.js";
|
|
2
2
|
import { live, span, wall } from "../controls/session.js";
|
|
3
3
|
import { TimeElement } from "./time-element.js";
|
|
4
|
-
|
|
4
|
+
// src/elements/current-time.ts
|
|
5
5
|
/**
|
|
6
6
|
* <mbx-current-time>: the position, "1:23". On a live stream it reads the
|
|
7
7
|
* wall clock when `engine.pdt` can say it, "14:23:05", which is what a
|
|
@@ -23,5 +23,4 @@ var MbxCurrentTime = class extends TimeElement {
|
|
|
23
23
|
this.hidden = on && player.hasAttribute("live") && !player.hasAttribute("seekable") || !on && this.getAttribute("layout") === "compact";
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
|
-
//#endregion
|
|
27
26
|
export { MbxCurrentTime };
|
|
@@ -4,7 +4,7 @@ import { namespaces } from "../namespaces.js";
|
|
|
4
4
|
import { icon } from "../controls/icons.js";
|
|
5
5
|
import { Component } from "./component.js";
|
|
6
6
|
import { style } from "./shared.js";
|
|
7
|
-
|
|
7
|
+
// src/elements/drm-badge.ts
|
|
8
8
|
const STYLE = ":host{width:2.5em;height:2.5em;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:#1c1c20f2;margin-bottom:.6154em;padding:.6154em .7692em;font-size:.8125em;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)}";
|
|
9
9
|
/** The name a viewer knows a key system by. */
|
|
10
10
|
function keySystemName(id) {
|
|
@@ -57,8 +57,7 @@ var MbxDrmBadge = class extends Component {
|
|
|
57
57
|
}
|
|
58
58
|
/** "3 keys: usable ×2, expired", or "no key yet". */
|
|
59
59
|
sessionsText(sessions) {
|
|
60
|
-
|
|
61
|
-
if (sessions.length === 0) return (_this$getAttribute = this.getAttribute("label-no-key")) !== null && _this$getAttribute !== void 0 ? _this$getAttribute : "no key yet";
|
|
60
|
+
if (sessions.length === 0) return this.word("label-no-key", "drmNoKey", "no key yet");
|
|
62
61
|
const counts = /* @__PURE__ */ new Map();
|
|
63
62
|
for (const session of sessions) {
|
|
64
63
|
var _counts$get;
|
|
@@ -66,7 +65,7 @@ var MbxDrmBadge = class extends Component {
|
|
|
66
65
|
}
|
|
67
66
|
const parts = [];
|
|
68
67
|
for (const [status, count] of counts) parts.push(count > 1 ? `${status} ×${count}` : status);
|
|
69
|
-
const template = sessions.length === 1 ?
|
|
68
|
+
const template = sessions.length === 1 ? this.word("label-key", "drmKey", "{count} key: {statuses}") : this.word("label-keys", "drmKeys", "{count} keys: {statuses}");
|
|
70
69
|
return fill(template, {
|
|
71
70
|
count: sessions.length,
|
|
72
71
|
statuses: parts.join(", ")
|
|
@@ -97,7 +96,7 @@ var MbxDrmBadge = class extends Component {
|
|
|
97
96
|
this.tooltip.hidden = true;
|
|
98
97
|
}
|
|
99
98
|
render() {
|
|
100
|
-
var _drm$keySystem
|
|
99
|
+
var _drm$keySystem;
|
|
101
100
|
const drm = this.drm;
|
|
102
101
|
const name = (_drm$keySystem = drm === null || drm === void 0 ? void 0 : drm.keySystem) !== null && _drm$keySystem !== void 0 ? _drm$keySystem : null;
|
|
103
102
|
this.hidden = name === null;
|
|
@@ -107,11 +106,10 @@ var MbxDrmBadge = class extends Component {
|
|
|
107
106
|
this.system.textContent = system;
|
|
108
107
|
this.system_id.textContent = name;
|
|
109
108
|
this.keys.textContent = keys;
|
|
110
|
-
this.setAttribute("aria-label", fill(
|
|
109
|
+
this.setAttribute("aria-label", fill(this.word("label", "drmProtected", "Protected by {system}, {keys}"), {
|
|
111
110
|
system,
|
|
112
111
|
keys
|
|
113
112
|
}));
|
|
114
113
|
}
|
|
115
114
|
};
|
|
116
|
-
//#endregion
|
|
117
115
|
export { MbxDrmBadge };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { format } from "../controls/time.js";
|
|
2
2
|
import { live, span } from "../controls/session.js";
|
|
3
3
|
import { TimeElement } from "./time-element.js";
|
|
4
|
-
|
|
4
|
+
// src/elements/duration.ts
|
|
5
5
|
/**
|
|
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. On a
|
|
@@ -24,5 +24,4 @@ var MbxDuration = class extends TimeElement {
|
|
|
24
24
|
this.text.data = this.getAttribute("layout") === "compact" ? `-${format(Math.max(0, end - player.video.currentTime))}` : format(end);
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
|
-
//#endregion
|
|
28
27
|
export { MbxDuration };
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import { el } from "../dom.js";
|
|
2
2
|
import { Component } from "./component.js";
|
|
3
3
|
import { style } from "./shared.js";
|
|
4
|
-
|
|
5
|
-
const STYLE = ":host{color:var(--mbx-text);font:400 .9375em / 1.4 var(--mbx-font);text-align:center;background:#000000bf;justify-content:center;align-items:center;padding:1.0667em;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:.5333em}[part~=title]{font-size:1.2em;font-weight:600}[part~=detail]{color:var(--mbx-error);font-family:monospace;font-size:.8667em}[part~=
|
|
4
|
+
// src/elements/error-screen.ts
|
|
5
|
+
const STYLE = ":host{color:var(--mbx-text);font:400 .9375em / 1.4 var(--mbx-font);text-align:center;background:#000000bf;justify-content:center;align-items:center;padding:1.0667em;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:.5333em}[part~=title]{font-size:1.2em;font-weight:600}[part~=detail]{color:var(--mbx-error);font-family:monospace;font-size:.8667em}[part~=message]{max-width:32em}[part~=actions]>:not([hidden])~:not([hidden]){margin-left:.5333em}[part~=action]{height:2.4em;font:inherit;color:inherit;border-radius:var(--mbx-radius);cursor:pointer;background:0 0;border:1px solid;padding:0 1.0667em;font-weight:600}[part~=action]:focus{outline:2px solid var(--mbx-accent);outline-offset:-2px}[part~=action]:focus:not(:focus-visible){outline:none}";
|
|
6
|
+
/** The diagnostics element, another package's, named here as a string. */
|
|
7
|
+
const DIAGNOSTICS = "mbx-diagnostics";
|
|
6
8
|
var MbxErrorScreen = class extends Component {
|
|
7
9
|
static get observedAttributes() {
|
|
8
|
-
return [
|
|
10
|
+
return [
|
|
11
|
+
"label-title",
|
|
12
|
+
"label-retry",
|
|
13
|
+
"label-blocked",
|
|
14
|
+
"label-diagnostics"
|
|
15
|
+
];
|
|
9
16
|
}
|
|
10
17
|
constructor() {
|
|
11
18
|
super();
|
|
@@ -14,15 +21,25 @@ var MbxErrorScreen = class extends Component {
|
|
|
14
21
|
this.title_ = el("div", "title");
|
|
15
22
|
this.category = el("span", "category");
|
|
16
23
|
this.code = el("span", "code");
|
|
17
|
-
|
|
18
|
-
detail.append(this.category, el("span", "separator", " · "), this.code);
|
|
19
|
-
this.
|
|
24
|
+
this.detail = el("div", "detail");
|
|
25
|
+
this.detail.append(this.category, el("span", "separator", " · "), this.code);
|
|
26
|
+
this.message = el("div", "message");
|
|
27
|
+
this.block = null;
|
|
28
|
+
this.retry = el("button", "action retry");
|
|
20
29
|
this.retry.type = "button";
|
|
21
30
|
this.retry.addEventListener("click", () => {
|
|
22
31
|
var _this$player;
|
|
23
32
|
(_this$player = this.player) === null || _this$player === void 0 || _this$player.retry();
|
|
24
33
|
});
|
|
25
|
-
|
|
34
|
+
this.inspect = el("button", "action diagnostics");
|
|
35
|
+
this.inspect.type = "button";
|
|
36
|
+
this.inspect.addEventListener("click", () => {
|
|
37
|
+
var _this$diagnostics;
|
|
38
|
+
(_this$diagnostics = this.diagnostics()) === null || _this$diagnostics === void 0 || _this$diagnostics.show();
|
|
39
|
+
});
|
|
40
|
+
const actions = el("div", "actions");
|
|
41
|
+
actions.append(this.retry, this.inspect);
|
|
42
|
+
box.append(this.title_, this.detail, this.message, actions);
|
|
26
43
|
root.append(style(STYLE), box);
|
|
27
44
|
}
|
|
28
45
|
/** Hidden and named before attaching: a constructor must not add attributes. */
|
|
@@ -32,10 +49,18 @@ var MbxErrorScreen = class extends Component {
|
|
|
32
49
|
super.connectedCallback();
|
|
33
50
|
}
|
|
34
51
|
show(error) {
|
|
52
|
+
this.block = null;
|
|
35
53
|
this.category.textContent = error.category;
|
|
36
54
|
this.code.textContent = error.code;
|
|
55
|
+
this.render();
|
|
37
56
|
this.hidden = false;
|
|
38
57
|
}
|
|
58
|
+
/** Shows `block`, or hides the screen for null. */
|
|
59
|
+
showBlock(block) {
|
|
60
|
+
this.block = block;
|
|
61
|
+
this.render();
|
|
62
|
+
this.hidden = block === null;
|
|
63
|
+
}
|
|
39
64
|
attach(player) {
|
|
40
65
|
const failure = (event) => {
|
|
41
66
|
const error = event.detail;
|
|
@@ -46,22 +71,40 @@ var MbxErrorScreen = class extends Component {
|
|
|
46
71
|
player.removeEventListener("error", failure);
|
|
47
72
|
});
|
|
48
73
|
this.listen(player.video, ["playing", "loadstart"], () => {
|
|
49
|
-
this.hidden = true;
|
|
74
|
+
if (this.block === null) this.hidden = true;
|
|
50
75
|
});
|
|
51
76
|
this.listen(player, ["sourcechange"], () => {
|
|
52
|
-
this.hidden = true;
|
|
77
|
+
if (this.block === null) this.hidden = true;
|
|
78
|
+
});
|
|
79
|
+
this.listen(player, ["blockchange"], () => {
|
|
80
|
+
this.showBlock(player.blocked);
|
|
53
81
|
});
|
|
54
82
|
if (player.error !== null) this.show(player.error);
|
|
83
|
+
if (player.blocked !== null) this.showBlock(player.blocked);
|
|
55
84
|
this.render();
|
|
56
85
|
}
|
|
57
86
|
detach() {
|
|
58
87
|
this.hidden = true;
|
|
59
88
|
}
|
|
89
|
+
/** The player's diagnostics panel, when the page put one in it. */
|
|
90
|
+
diagnostics() {
|
|
91
|
+
var _this$player2;
|
|
92
|
+
return (_this$player2 = this.player) === null || _this$player2 === void 0 ? void 0 : _this$player2.querySelector(DIAGNOSTICS);
|
|
93
|
+
}
|
|
60
94
|
render() {
|
|
61
|
-
|
|
62
|
-
this.
|
|
63
|
-
this.retry.
|
|
95
|
+
const block = this.block;
|
|
96
|
+
this.detail.hidden = block !== null;
|
|
97
|
+
this.retry.hidden = block !== null;
|
|
98
|
+
this.inspect.hidden = block !== null || this.diagnostics() === null;
|
|
99
|
+
this.inspect.textContent = this.word("label-diagnostics", "diagnostics", "Diagnostics");
|
|
100
|
+
this.message.hidden = (block === null || block === void 0 ? void 0 : block.message) === void 0;
|
|
101
|
+
if (block === null) {
|
|
102
|
+
this.title_.textContent = this.word("label-title", "playbackFailed", "Playback failed");
|
|
103
|
+
this.retry.textContent = this.word("label-retry", "retry", "Retry");
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
this.title_.textContent = block.title === void 0 ? this.word("label-blocked", "blocked", "Not available") : this.pageText(block.title);
|
|
107
|
+
this.message.textContent = block.message === void 0 ? "" : this.pageText(block.message);
|
|
64
108
|
}
|
|
65
109
|
};
|
|
66
|
-
//#endregion
|
|
67
110
|
export { MbxErrorScreen };
|
|
@@ -2,7 +2,7 @@ import { icon } from "../controls/icons.js";
|
|
|
2
2
|
import { Component } from "./component.js";
|
|
3
3
|
import { BUTTON_STYLE, iconSlots, show, style } from "./shared.js";
|
|
4
4
|
import { fullscreen } from "../controls/fullscreen.js";
|
|
5
|
-
|
|
5
|
+
// src/elements/fullscreen-button.ts
|
|
6
6
|
const STATES = ["enter", "exit"];
|
|
7
7
|
var MbxFullscreenButton = class extends Component {
|
|
8
8
|
static get observedAttributes() {
|
|
@@ -36,14 +36,12 @@ var MbxFullscreenButton = class extends Component {
|
|
|
36
36
|
this.api = null;
|
|
37
37
|
}
|
|
38
38
|
render() {
|
|
39
|
-
var _this$getAttribute, _this$getAttribute2;
|
|
40
39
|
const player = this.player;
|
|
41
40
|
if (player === null || this.api === null) return;
|
|
42
41
|
const active = this.api.active();
|
|
43
42
|
show(this.slots, active ? "exit" : "enter");
|
|
44
|
-
this.button.setAttribute("aria-label", active ?
|
|
43
|
+
this.button.setAttribute("aria-label", active ? this.word("label-exit", "exitFullscreen", "Exit fullscreen") : this.word("label-enter", "enterFullscreen", "Enter fullscreen"));
|
|
45
44
|
player.toggleAttribute("fullscreen", active);
|
|
46
45
|
}
|
|
47
46
|
};
|
|
48
|
-
//#endregion
|
|
49
47
|
export { MbxFullscreenButton };
|
|
@@ -2,7 +2,7 @@ import { el } from "../dom.js";
|
|
|
2
2
|
import { Component } from "./component.js";
|
|
3
3
|
import { seekRow, style } from "./shared.js";
|
|
4
4
|
import { live } from "../controls/session.js";
|
|
5
|
-
|
|
5
|
+
// src/elements/live-button.ts
|
|
6
6
|
/**
|
|
7
7
|
* <mbx-live-button>: a dot and the word, the dot red at the edge and grey
|
|
8
8
|
* behind it, the way viewers read it everywhere. Shown once the stream has
|
|
@@ -52,18 +52,16 @@ var MbxLiveButton = class extends Component {
|
|
|
52
52
|
this.render();
|
|
53
53
|
}
|
|
54
54
|
render() {
|
|
55
|
-
var _this$getAttribute, _this$getAttribute2, _this$getAttribute3;
|
|
56
55
|
const player = this.player;
|
|
57
56
|
if (player === null) return;
|
|
58
57
|
const api = live(player.engine);
|
|
59
58
|
this.hidden = api === void 0;
|
|
60
|
-
this.text.textContent =
|
|
59
|
+
this.text.textContent = this.word("text", "live", "LIVE");
|
|
61
60
|
if (api === void 0) return;
|
|
62
61
|
const atEdge = player.hasAttribute("live") && !player.hasAttribute("seekable") || api.atEdge;
|
|
63
62
|
this.button.disabled = atEdge;
|
|
64
63
|
this.toggleAttribute("at-edge", atEdge);
|
|
65
|
-
this.button.setAttribute("aria-label", atEdge ?
|
|
64
|
+
this.button.setAttribute("aria-label", atEdge ? this.word("label-at-edge", "atLiveEdge", "At the live edge") : this.word("label-live", "goLive", "Go to the live edge"));
|
|
66
65
|
}
|
|
67
66
|
};
|
|
68
|
-
//#endregion
|
|
69
67
|
export { MbxLiveButton };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Component } from "./component.js";
|
|
2
2
|
import { BUTTON_STYLE, style } from "./shared.js";
|
|
3
|
-
|
|
3
|
+
// src/elements/marker-button.ts
|
|
4
4
|
const STYLE_CSS = ":host{right:calc(var(--mbx-pad,.5em) + .5em);bottom:calc(var(--mbx-marker-lift,3.5em) + .75em);z-index:1;transition:transform .3s;position:absolute}:host([idle]){transform:translateY(var(--mbx-marker-lift,3.5em))}:host([hidden]){display:none}[part~=button]{width:auto;height:2.5em;color:var(--mbx-text);font:inherit;white-space:nowrap;background:#0009;border:1px solid #ffffff80;padding:0 1.125em;font-weight:600}[part~=button]:hover{background:#000c}@media (prefers-reduced-motion:reduce){:host{transition:none}}";
|
|
5
|
+
/** The id and the English of the button over each kind of range. */
|
|
5
6
|
const WORDS = {
|
|
6
|
-
"opening-credits": "Skip intro",
|
|
7
|
-
"closing-credits": "Skip credits"
|
|
7
|
+
"opening-credits": ["skipIntro", "Skip intro"],
|
|
8
|
+
"closing-credits": ["skipCredits", "Skip credits"]
|
|
8
9
|
};
|
|
9
10
|
var MbxMarkerButton = class extends Component {
|
|
10
11
|
static get observedAttributes() {
|
|
@@ -81,16 +82,16 @@ var MbxMarkerButton = class extends Component {
|
|
|
81
82
|
this.style.setProperty("--mbx-marker-lift", `${Math.max(0, lift)}px`);
|
|
82
83
|
}
|
|
83
84
|
render() {
|
|
84
|
-
var _player$markers$withi, _this$marker, _this$getAttribute
|
|
85
|
+
var _player$markers$withi, _this$marker, _this$getAttribute;
|
|
85
86
|
const player = this.player;
|
|
86
87
|
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;
|
|
87
88
|
if (((_this$marker = this.marker) === null || _this$marker === void 0 ? void 0 : _this$marker.kind) === "closing-credits" && (player === null || player === void 0 ? void 0 : player.hasAttribute("upnext")) === true) this.marker = null;
|
|
88
89
|
this.hidden = this.marker === null;
|
|
89
90
|
if (this.marker === null) return;
|
|
90
91
|
const kind = this.marker.kind;
|
|
91
|
-
const skip =
|
|
92
|
-
|
|
92
|
+
const skip = this.word("label-skip", "skip", "Skip");
|
|
93
|
+
const known = WORDS[kind];
|
|
94
|
+
this.button.textContent = known !== void 0 ? this.word(`label-${kind}`, ...known) : (_this$getAttribute = this.getAttribute(`label-${kind}`)) !== null && _this$getAttribute !== void 0 ? _this$getAttribute : this.marker.label === void 0 ? skip : `${skip} ${this.pageText(this.marker.label)}`;
|
|
93
95
|
}
|
|
94
96
|
};
|
|
95
|
-
//#endregion
|
|
96
97
|
export { MbxMarkerButton };
|
|
@@ -3,7 +3,7 @@ import { icon } from "../controls/icons.js";
|
|
|
3
3
|
import { Component } from "./component.js";
|
|
4
4
|
import { MENU_STYLE, iconSlots, style } from "./shared.js";
|
|
5
5
|
import { menu } from "../controls/menu.js";
|
|
6
|
-
|
|
6
|
+
// src/elements/menu-element.ts
|
|
7
7
|
var MenuElement = class extends Component {
|
|
8
8
|
constructor(states, glyphs) {
|
|
9
9
|
super();
|
|
@@ -15,10 +15,7 @@ var MenuElement = class extends Component {
|
|
|
15
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
|
frame: () => this.player,
|
|
18
|
-
back: (page) => {
|
|
19
|
-
var _this$getAttribute;
|
|
20
|
-
return fill((_this$getAttribute = this.getAttribute("label-back")) !== null && _this$getAttribute !== void 0 ? _this$getAttribute : "Back from {page}", { page });
|
|
21
|
-
}
|
|
18
|
+
back: (page) => fill(this.word("label-back", "menuBack", "Back from {page}"), { page })
|
|
22
19
|
});
|
|
23
20
|
this.slots = iconSlots(states, glyphs);
|
|
24
21
|
for (const state of states) this.menu.button.append(this.slots[state]);
|
|
@@ -28,13 +25,11 @@ var MenuElement = class extends Component {
|
|
|
28
25
|
this.menu.close();
|
|
29
26
|
}
|
|
30
27
|
render() {
|
|
31
|
-
|
|
32
|
-
this.menu.label((_this$getAttribute2 = this.getAttribute("label")) !== null && _this$getAttribute2 !== void 0 ? _this$getAttribute2 : this.name());
|
|
28
|
+
this.menu.label(this.word("label", ...this.name()));
|
|
33
29
|
}
|
|
34
30
|
};
|
|
35
31
|
/** A glyph that never changes, for a menu of one state. */
|
|
36
32
|
function single(name) {
|
|
37
33
|
return [["default"], () => icon(name)];
|
|
38
34
|
}
|
|
39
|
-
//#endregion
|
|
40
35
|
export { MenuElement, single };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { icon } from "../controls/icons.js";
|
|
2
2
|
import { Component } from "./component.js";
|
|
3
3
|
import { BUTTON_STYLE, iconSlots, show, style } from "./shared.js";
|
|
4
|
-
|
|
4
|
+
// src/elements/mute-button.ts
|
|
5
5
|
/**
|
|
6
6
|
* <mbx-mute-button>: mute and unmute, with the level drawn in the glyph:
|
|
7
7
|
* `icon-mute` while muted or at zero, `icon-low` up to half, `icon-high`
|
|
@@ -47,14 +47,13 @@ var MbxMuteButton = class extends Component {
|
|
|
47
47
|
this.render();
|
|
48
48
|
}
|
|
49
49
|
render() {
|
|
50
|
-
var _this$player2
|
|
50
|
+
var _this$player2;
|
|
51
51
|
const video = (_this$player2 = this.player) === null || _this$player2 === void 0 ? void 0 : _this$player2.video;
|
|
52
52
|
if (video === void 0) return;
|
|
53
53
|
const silent = video.muted || video.volume === 0;
|
|
54
54
|
show(this.slots, silent ? "mute" : video.volume <= .5 ? "low" : "high");
|
|
55
|
-
this.button.setAttribute("aria-label", silent ?
|
|
55
|
+
this.button.setAttribute("aria-label", silent ? this.word("label-unmute", "unmute", "Unmute") : this.word("label-mute", "mute", "Mute"));
|
|
56
56
|
this.button.setAttribute("aria-pressed", String(video.muted));
|
|
57
57
|
}
|
|
58
58
|
};
|
|
59
|
-
//#endregion
|
|
60
59
|
export { MbxMuteButton };
|
|
@@ -2,7 +2,7 @@ import { icon } from "../controls/icons.js";
|
|
|
2
2
|
import { Component } from "./component.js";
|
|
3
3
|
import { BUTTON_STYLE, iconSlots, show, style } from "./shared.js";
|
|
4
4
|
import { pictureInPicture } from "../controls/pip.js";
|
|
5
|
-
|
|
5
|
+
// src/elements/pip-button.ts
|
|
6
6
|
/**
|
|
7
7
|
* <mbx-pip-button>: picture in picture, through whichever API the browser
|
|
8
8
|
* has, and hidden where there is none. The glyph is `icon-enter` or
|
|
@@ -43,14 +43,12 @@ var MbxPipButton = class extends Component {
|
|
|
43
43
|
player.removeAttribute("pip");
|
|
44
44
|
}
|
|
45
45
|
render() {
|
|
46
|
-
var _this$getAttribute, _this$getAttribute2;
|
|
47
46
|
const player = this.player;
|
|
48
47
|
if (player === null || this.api === null) return;
|
|
49
48
|
const active = this.api.active();
|
|
50
49
|
show(this.slots, active ? "exit" : "enter");
|
|
51
|
-
this.button.setAttribute("aria-label", active ?
|
|
50
|
+
this.button.setAttribute("aria-label", active ? this.word("label-exit", "exitPip", "Leave picture in picture") : this.word("label-enter", "enterPip", "Picture in picture"));
|
|
52
51
|
player.toggleAttribute("pip", active);
|
|
53
52
|
}
|
|
54
53
|
};
|
|
55
|
-
//#endregion
|
|
56
54
|
export { MbxPipButton };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { icon } from "../controls/icons.js";
|
|
2
2
|
import { Component } from "./component.js";
|
|
3
3
|
import { BUTTON_STYLE, HELD, iconSlots, show, shownPaused, style } from "./shared.js";
|
|
4
|
-
|
|
4
|
+
// src/elements/play-button.ts
|
|
5
5
|
/**
|
|
6
6
|
* <mbx-play-button>: play, pause, or replay once the media has ended. It
|
|
7
7
|
* reads the video on the events the video already fires and writes one
|
|
@@ -61,13 +61,11 @@ var MbxPlayButton = class extends Component {
|
|
|
61
61
|
this.render();
|
|
62
62
|
}
|
|
63
63
|
render() {
|
|
64
|
-
var _this$getAttribute;
|
|
65
64
|
const player = this.player;
|
|
66
65
|
if (player === null) return;
|
|
67
66
|
const state = player.video.ended ? "replay" : shownPaused(player) ? "play" : "pause";
|
|
68
67
|
show(this.slots, state);
|
|
69
|
-
this.button.setAttribute("aria-label",
|
|
68
|
+
this.button.setAttribute("aria-label", this.word(`label-${state}`, state, LABELS[state]));
|
|
70
69
|
}
|
|
71
70
|
};
|
|
72
|
-
//#endregion
|
|
73
71
|
export { MbxPlayButton };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { show } from "./shared.js";
|
|
2
2
|
import { MenuElement, single } from "./menu-element.js";
|
|
3
3
|
import { qualityLabels, qualityNames } from "../controls/quality-names.js";
|
|
4
|
-
|
|
4
|
+
// src/elements/quality-menu.ts
|
|
5
5
|
const AUTO = "auto";
|
|
6
6
|
var MbxQualityMenu = class extends MenuElement {
|
|
7
7
|
static get observedAttributes() {
|
|
@@ -18,7 +18,7 @@ var MbxQualityMenu = class extends MenuElement {
|
|
|
18
18
|
show(this.slots, "default");
|
|
19
19
|
}
|
|
20
20
|
name() {
|
|
21
|
-
return "Quality";
|
|
21
|
+
return ["quality", "Quality"];
|
|
22
22
|
}
|
|
23
23
|
attach(player) {
|
|
24
24
|
this.follow(player, (engine) => {
|
|
@@ -44,7 +44,7 @@ var MbxQualityMenu = class extends MenuElement {
|
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
render() {
|
|
47
|
-
var
|
|
47
|
+
var _quality$pinned;
|
|
48
48
|
super.render();
|
|
49
49
|
const engine = this.engine;
|
|
50
50
|
if (engine === null) {
|
|
@@ -55,7 +55,7 @@ var MbxQualityMenu = class extends MenuElement {
|
|
|
55
55
|
this.playing = this.playingName();
|
|
56
56
|
const items = [[
|
|
57
57
|
AUTO,
|
|
58
|
-
|
|
58
|
+
this.word("label-auto", "qualityAuto", "Auto"),
|
|
59
59
|
this.playing
|
|
60
60
|
], ...qualityNames(quality.selectable)];
|
|
61
61
|
this.menu.fill([{
|
|
@@ -79,5 +79,4 @@ var MbxQualityMenu = class extends MenuElement {
|
|
|
79
79
|
return (_qualityLabels$find = qualityLabels(quality.selectable).find(([candidate]) => candidate === id)) === null || _qualityLabels$find === void 0 ? void 0 : _qualityLabels$find[1];
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
|
-
//#endregion
|
|
83
82
|
export { MbxQualityMenu };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { format } from "../controls/time.js";
|
|
2
2
|
import { live, span } from "../controls/session.js";
|
|
3
3
|
import { TimeElement } from "./time-element.js";
|
|
4
|
-
|
|
4
|
+
// src/elements/remaining-time.ts
|
|
5
5
|
/**
|
|
6
6
|
* <mbx-remaining-time>: what is left, "-4:53", once the metadata is in. A
|
|
7
7
|
* bar that shows one number shows this one: a viewer asks how much is
|
|
@@ -23,5 +23,4 @@ var MbxRemainingTime = class extends TimeElement {
|
|
|
23
23
|
if (!on) this.text.data = `-${format(Math.max(0, span(video, engine).end - video.currentTime))}`;
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
|
-
//#endregion
|
|
27
26
|
export { MbxRemainingTime };
|
|
@@ -3,7 +3,7 @@ import { icon } from "../controls/icons.js";
|
|
|
3
3
|
import { Component } from "./component.js";
|
|
4
4
|
import { BUTTON_STYLE, style } from "./shared.js";
|
|
5
5
|
import { optional } from "../controls/session.js";
|
|
6
|
-
|
|
6
|
+
// src/elements/scan-button.ts
|
|
7
7
|
/**
|
|
8
8
|
* <mbx-scan-button>: fast forward, or rewind with `direction="backward"`,
|
|
9
9
|
* through the I-frame track: `engine.trick.setRate`, see the engine guide's
|
|
@@ -97,7 +97,7 @@ var MbxScanButton = class extends Component {
|
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
99
|
render() {
|
|
100
|
-
var _this$player$engine2, _this$player2, _trick$rate
|
|
100
|
+
var _this$player$engine2, _this$player2, _trick$rate;
|
|
101
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
102
|
const backward = this.backward();
|
|
103
103
|
const player = this.player;
|
|
@@ -110,9 +110,8 @@ var MbxScanButton = class extends Component {
|
|
|
110
110
|
this.badge.hidden = !on;
|
|
111
111
|
this.badge.textContent = on ? `${Math.abs(rate)}×` : "";
|
|
112
112
|
setChildren(this.glyph, icon(backward ? "fast-backward" : "fast-forward"));
|
|
113
|
-
const name =
|
|
113
|
+
const name = backward ? this.word("label", "rewind", "Rewind") : this.word("label", "fastForward", "Fast forward");
|
|
114
114
|
this.button.setAttribute("aria-label", name);
|
|
115
115
|
}
|
|
116
116
|
};
|
|
117
|
-
//#endregion
|
|
118
117
|
export { MbxScanButton };
|