@mattebox/player 0.10.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.d.ts +1 -1
- package/dist/controls/icons.d.ts.map +1 -1
- package/dist/controls/icons.js +2 -2
- package/dist/controls/icons.js.map +1 -1
- 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.d.ts +8 -7
- package/dist/controls/native-tracks.d.ts.map +1 -1
- package/dist/controls/native-tracks.js +1 -2
- package/dist/controls/native-tracks.js.map +1 -1
- 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 +134 -5
- package/dist/element.d.ts.map +1 -1
- package/dist/element.js +346 -35
- 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.d.ts.map +1 -1
- package/dist/elements/control-bar.js +9 -8
- package/dist/elements/control-bar.js.map +1 -1
- 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 +55 -15
- 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.d.ts.map +1 -1
- package/dist/elements/play-button.js +9 -12
- 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.d.ts +18 -0
- package/dist/elements/shared.d.ts.map +1 -1
- package/dist/elements/shared.js +17 -11
- package/dist/elements/shared.js.map +1 -1
- 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 +5 -7
- 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 +16 -7
- package/dist/elements/title.js.map +1 -1
- package/dist/elements/video-menu.d.ts +24 -0
- package/dist/elements/video-menu.d.ts.map +1 -0
- package/dist/elements/video-menu.js +146 -0
- package/dist/elements/video-menu.js.map +1 -0
- 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.d.ts +5 -0
- package/dist/entries/video-menu.d.ts.map +1 -0
- package/dist/entries/video-menu.js +8 -0
- package/dist/entries/video-menu.js.map +1 -0
- 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 +2 -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 +402 -85
- 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 +9 -8
- 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 +58 -16
- 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 +9 -13
- 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 +17 -11
- 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 +6 -8
- package/dist/es2015/elements/subtitles-menu.js +53 -31
- package/dist/es2015/elements/time-element.js +1 -2
- package/dist/es2015/elements/title.js +17 -8
- package/dist/es2015/elements/video-menu.js +152 -0
- 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 +6 -0
- 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 +4 -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 +3 -3
- package/dist/es2015/text.js +15 -0
- package/dist/es2015/trackers.js +43 -0
- package/dist/es2015/video-sources.js +127 -0
- package/dist/host.d.ts +49 -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 +11 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -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.d.ts +1 -0
- package/dist/tags.d.ts.map +1 -1
- package/dist/tags.js +3 -3
- package/dist/tags.js.map +1 -1
- 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.d.ts +48 -0
- package/dist/video-sources.d.ts.map +1 -0
- package/dist/video-sources.js +133 -0
- package/dist/video-sources.js.map +1 -0
- package/package.json +11 -3
|
@@ -2,7 +2,7 @@ import { airplay } from "../controls/airplay.js";
|
|
|
2
2
|
import { icon } from "../controls/icons.js";
|
|
3
3
|
import { Component } from "./component.js";
|
|
4
4
|
import { BUTTON_STYLE, iconSlots, show, style } from "./shared.js";
|
|
5
|
-
|
|
5
|
+
// src/elements/airplay-button.ts
|
|
6
6
|
const STATES = ["default", "active"];
|
|
7
7
|
var MbxAirplayButton = class extends Component {
|
|
8
8
|
static get observedAttributes() {
|
|
@@ -38,15 +38,13 @@ var MbxAirplayButton = class extends Component {
|
|
|
38
38
|
player.removeAttribute("airplay");
|
|
39
39
|
}
|
|
40
40
|
render() {
|
|
41
|
-
var _this$getAttribute, _this$getAttribute2;
|
|
42
41
|
const player = this.player;
|
|
43
42
|
if (player === null || this.api === null) return;
|
|
44
43
|
const active = this.api.active();
|
|
45
44
|
this.hidden = !this.api.supported || !this.api.offered();
|
|
46
45
|
show(this.slots, active ? "active" : "default");
|
|
47
|
-
this.button.setAttribute("aria-label", active ?
|
|
46
|
+
this.button.setAttribute("aria-label", active ? this.word("label-active", "stopAirplay", "Stop AirPlay") : this.word("label", "airplay", "AirPlay"));
|
|
48
47
|
player.toggleAttribute("airplay", active);
|
|
49
48
|
}
|
|
50
49
|
};
|
|
51
|
-
//#endregion
|
|
52
50
|
export { MbxAirplayButton };
|
|
@@ -4,11 +4,11 @@ import { show } from "./shared.js";
|
|
|
4
4
|
import { nativeTracks, onNativeTracks } from "../controls/native-tracks.js";
|
|
5
5
|
import { MenuElement, single } from "./menu-element.js";
|
|
6
6
|
import { isAudioDescription, isOriginal } from "mattebox";
|
|
7
|
-
|
|
7
|
+
// src/elements/audio-menu.ts
|
|
8
8
|
/** A track's channel layout, from its first rendition: `audioObjects` `JOC` is Dolby Atmos. */
|
|
9
|
-
function channels(track) {
|
|
9
|
+
function channels(track, words) {
|
|
10
10
|
const first = track.renditions[0];
|
|
11
|
-
return (first === null || first === void 0 ? void 0 : first.channels) === void 0 ? void 0 : layout(`${first.channels}${first.audioObjects ? `/${first.audioObjects}` : ""}
|
|
11
|
+
return (first === null || first === void 0 ? void 0 : first.channels) === void 0 ? void 0 : layout(`${first.channels}${first.audioObjects ? `/${first.audioObjects}` : ""}`, words);
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
14
|
* The tracks of one content type that the engine can play and `listed`
|
|
@@ -16,7 +16,7 @@ function channels(track) {
|
|
|
16
16
|
* is listed. A track the browser cannot decode, or that no stage plays,
|
|
17
17
|
* stays out (guide chapter 06).
|
|
18
18
|
*/
|
|
19
|
-
function trackItems(engine, contentType, badges = () => [], listed = () => true) {
|
|
19
|
+
function trackItems(engine, contentType, badges = () => [], listed = () => true, words = {}) {
|
|
20
20
|
var _tracks$active;
|
|
21
21
|
const tracks = engine.tracks;
|
|
22
22
|
const available = tracks.available.filter((track) => track.contentType === contentType && tracks.selectable(track.id) && listed(track));
|
|
@@ -25,7 +25,7 @@ function trackItems(engine, contentType, badges = () => [], listed = () => true)
|
|
|
25
25
|
track.name,
|
|
26
26
|
track.lang,
|
|
27
27
|
badges(track),
|
|
28
|
-
[channels(track), track.role === "main" ? void 0 : track.role]
|
|
28
|
+
[channels(track, words), track.role === "main" ? void 0 : track.role]
|
|
29
29
|
]);
|
|
30
30
|
const active = (_tracks$active = tracks.active(contentType)) === null || _tracks$active === void 0 ? void 0 : _tracks$active.id;
|
|
31
31
|
return [entries, available.some((track) => track.id === active) ? active : null];
|
|
@@ -44,7 +44,9 @@ var MbxAudioMenu = class extends MenuElement {
|
|
|
44
44
|
"label-back",
|
|
45
45
|
"label-ad",
|
|
46
46
|
"label-original",
|
|
47
|
-
"label-track"
|
|
47
|
+
"label-track",
|
|
48
|
+
"label-mono",
|
|
49
|
+
"label-stereo"
|
|
48
50
|
];
|
|
49
51
|
}
|
|
50
52
|
constructor() {
|
|
@@ -53,7 +55,7 @@ var MbxAudioMenu = class extends MenuElement {
|
|
|
53
55
|
show(this.slots, "default");
|
|
54
56
|
}
|
|
55
57
|
name() {
|
|
56
|
-
return "Audio";
|
|
58
|
+
return ["audio", "Audio"];
|
|
57
59
|
}
|
|
58
60
|
attach(player) {
|
|
59
61
|
this.follow(player, (engine) => {
|
|
@@ -67,8 +69,7 @@ var MbxAudioMenu = class extends MenuElement {
|
|
|
67
69
|
}
|
|
68
70
|
/** The native session's audio tracks as entries, and the enabled one's. */
|
|
69
71
|
native(tracks) {
|
|
70
|
-
|
|
71
|
-
const ad = (_this$getAttribute = this.getAttribute("label-ad")) !== null && _this$getAttribute !== void 0 ? _this$getAttribute : "AD";
|
|
72
|
+
const ad = this.word("label-ad", "audioDescription", "AD");
|
|
72
73
|
const entries = tracks.map((track, index) => [
|
|
73
74
|
String(index),
|
|
74
75
|
track.label,
|
|
@@ -80,7 +81,7 @@ var MbxAudioMenu = class extends MenuElement {
|
|
|
80
81
|
return [entries, on === -1 ? null : String(on)];
|
|
81
82
|
}
|
|
82
83
|
render() {
|
|
83
|
-
var _this$
|
|
84
|
+
var _this$player;
|
|
84
85
|
super.render();
|
|
85
86
|
const engine = this.engine;
|
|
86
87
|
const player = this.player;
|
|
@@ -89,15 +90,17 @@ var MbxAudioMenu = class extends MenuElement {
|
|
|
89
90
|
this.hidden = true;
|
|
90
91
|
return;
|
|
91
92
|
}
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
const ad = this.word("label-ad", "audioDescription", "AD");
|
|
94
|
+
const original = this.word("label-original", "original", "Original");
|
|
95
|
+
const [entries, active] = tracks !== void 0 ? this.native(tracks) : trackItems(engine, "audio", (track) => [...isAudioDescription(track) ? [ad] : [], ...isOriginal(track) ? [original] : []], void 0, {
|
|
96
|
+
1: this.word("label-mono", "mono", "Mono"),
|
|
97
|
+
2: this.word("label-stereo", "stereo", "Stereo")
|
|
95
98
|
});
|
|
96
|
-
const items = trackNames(entries, this.
|
|
99
|
+
const items = trackNames(entries, this.word("label-track", "track", "Track"), ((_this$player = this.player) === null || _this$player === void 0 ? void 0 : _this$player.locale) || void 0);
|
|
97
100
|
this.menu.fill([{
|
|
98
101
|
name: "track",
|
|
99
102
|
items,
|
|
100
|
-
badgeGlyphs: { [
|
|
103
|
+
badgeGlyphs: { [ad]: () => icon("audio-description") },
|
|
101
104
|
value: active !== null && active !== void 0 ? active : "",
|
|
102
105
|
onSelect: (value) => {
|
|
103
106
|
if (tracks !== void 0) tracks.forEach((track, index) => {
|
|
@@ -110,5 +113,4 @@ var MbxAudioMenu = class extends MenuElement {
|
|
|
110
113
|
this.hidden = items.length < 2;
|
|
111
114
|
}
|
|
112
115
|
};
|
|
113
|
-
//#endregion
|
|
114
116
|
export { MbxAudioMenu, onTracks, trackItems };
|
|
@@ -2,7 +2,7 @@ import { show } from "./shared.js";
|
|
|
2
2
|
import { MenuElement, single } from "./menu-element.js";
|
|
3
3
|
import { format } from "../controls/time.js";
|
|
4
4
|
import { chapterAt, chapters, followChapters } from "../controls/chapters.js";
|
|
5
|
-
|
|
5
|
+
// src/elements/chapters-menu.ts
|
|
6
6
|
/**
|
|
7
7
|
* <mbx-chapters-menu>: the chapters of the video as a list, each with its
|
|
8
8
|
* start time, the one the playhead is in checked; choosing one seeks to its
|
|
@@ -23,7 +23,7 @@ var MbxChaptersMenu = class extends MenuElement {
|
|
|
23
23
|
show(this.slots, "default");
|
|
24
24
|
}
|
|
25
25
|
name() {
|
|
26
|
-
return "Chapters";
|
|
26
|
+
return ["chapters", "Chapters"];
|
|
27
27
|
}
|
|
28
28
|
attach(player) {
|
|
29
29
|
const tick = () => {
|
|
@@ -72,5 +72,4 @@ var MbxChaptersMenu = class extends MenuElement {
|
|
|
72
72
|
}]);
|
|
73
73
|
}
|
|
74
74
|
};
|
|
75
|
-
//#endregion
|
|
76
75
|
export { MbxChaptersMenu };
|
|
@@ -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 };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { AIRPLAY_BUTTON, AUDIO_MENU, CHAPTERS_MENU, DRM_BADGE, MUTE_BUTTON, PIP_BUTTON, QUALITY_MENU, SCAN_BUTTON, SKIP_BUTTON, SPEED_MENU, SUBTITLES_MENU, VOLUME, VOLUME_SLIDER } from "../tags.js";
|
|
1
|
+
import { AIRPLAY_BUTTON, AUDIO_MENU, CHAPTERS_MENU, DRM_BADGE, MUTE_BUTTON, PIP_BUTTON, QUALITY_MENU, SCAN_BUTTON, SKIP_BUTTON, SPEED_MENU, SUBTITLES_MENU, VIDEO_MENU, VOLUME, VOLUME_SLIDER } from "../tags.js";
|
|
2
2
|
import { Component } from "./component.js";
|
|
3
|
-
import { number, style } from "./shared.js";
|
|
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;
|
|
@@ -12,8 +12,9 @@ const SEEK_STEP = 5;
|
|
|
12
12
|
* suit a TV remote more than a small screen; then the slider, which takes
|
|
13
13
|
* the most room for the least; then the diagnostics, the lock and the
|
|
14
14
|
* menus a viewer rarely opens; then the menus for the picture and the
|
|
15
|
-
* sound; then the skips; then the mute
|
|
16
|
-
* menu
|
|
15
|
+
* sound; then the skips; then the mute, the subtitles and the video
|
|
16
|
+
* menu. The subtitles and video menus go last of the menus because a
|
|
17
|
+
* viewer may need them: the video menu holds the sign-language version.
|
|
17
18
|
* The diagnostics is another package's, named here as a string. A
|
|
18
19
|
* `priority` attribute on the control replaces its default.
|
|
19
20
|
*/
|
|
@@ -30,6 +31,7 @@ const PRIORITY = {
|
|
|
30
31
|
[AIRPLAY_BUTTON]: 2,
|
|
31
32
|
[SKIP_BUTTON]: 2,
|
|
32
33
|
[SUBTITLES_MENU]: 1,
|
|
34
|
+
[VIDEO_MENU]: 1,
|
|
33
35
|
[VOLUME]: 1,
|
|
34
36
|
[MUTE_BUTTON]: 1
|
|
35
37
|
};
|
|
@@ -149,7 +151,7 @@ var MbxControlBar = class extends Component {
|
|
|
149
151
|
};
|
|
150
152
|
}
|
|
151
153
|
held(player) {
|
|
152
|
-
if (player
|
|
154
|
+
if (shownPaused(player, ["switching"])) return true;
|
|
153
155
|
if (this.querySelector("[open]") !== null) return true;
|
|
154
156
|
if (!this.keyboard) return false;
|
|
155
157
|
const active = this.getRootNode().activeElement;
|
|
@@ -280,7 +282,7 @@ var MbxControlBar = class extends Component {
|
|
|
280
282
|
"pause",
|
|
281
283
|
"ended"
|
|
282
284
|
], () => {
|
|
283
|
-
this.wake(player);
|
|
285
|
+
if (!player.hasAttribute("switching")) this.wake(player);
|
|
284
286
|
});
|
|
285
287
|
this.wake(player);
|
|
286
288
|
this.cues.lifted(true);
|
|
@@ -318,5 +320,4 @@ var MbxControlBar = class extends Component {
|
|
|
318
320
|
player.removeAttribute("fullscreen");
|
|
319
321
|
}
|
|
320
322
|
};
|
|
321
|
-
//#endregion
|
|
322
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,16 +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
|
-
|
|
23
|
-
|
|
24
|
-
if (player !== null && player !== void 0 && src !== null && src !== void 0) player.setAttribute("src", src);
|
|
31
|
+
var _this$player;
|
|
32
|
+
(_this$player = this.player) === null || _this$player === void 0 || _this$player.retry();
|
|
25
33
|
});
|
|
26
|
-
|
|
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);
|
|
27
43
|
root.append(style(STYLE), box);
|
|
28
44
|
}
|
|
29
45
|
/** Hidden and named before attaching: a constructor must not add attributes. */
|
|
@@ -33,10 +49,18 @@ var MbxErrorScreen = class extends Component {
|
|
|
33
49
|
super.connectedCallback();
|
|
34
50
|
}
|
|
35
51
|
show(error) {
|
|
52
|
+
this.block = null;
|
|
36
53
|
this.category.textContent = error.category;
|
|
37
54
|
this.code.textContent = error.code;
|
|
55
|
+
this.render();
|
|
38
56
|
this.hidden = false;
|
|
39
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
|
+
}
|
|
40
64
|
attach(player) {
|
|
41
65
|
const failure = (event) => {
|
|
42
66
|
const error = event.detail;
|
|
@@ -47,22 +71,40 @@ var MbxErrorScreen = class extends Component {
|
|
|
47
71
|
player.removeEventListener("error", failure);
|
|
48
72
|
});
|
|
49
73
|
this.listen(player.video, ["playing", "loadstart"], () => {
|
|
50
|
-
this.hidden = true;
|
|
74
|
+
if (this.block === null) this.hidden = true;
|
|
51
75
|
});
|
|
52
76
|
this.listen(player, ["sourcechange"], () => {
|
|
53
|
-
this.hidden = true;
|
|
77
|
+
if (this.block === null) this.hidden = true;
|
|
78
|
+
});
|
|
79
|
+
this.listen(player, ["blockchange"], () => {
|
|
80
|
+
this.showBlock(player.blocked);
|
|
54
81
|
});
|
|
55
82
|
if (player.error !== null) this.show(player.error);
|
|
83
|
+
if (player.blocked !== null) this.showBlock(player.blocked);
|
|
56
84
|
this.render();
|
|
57
85
|
}
|
|
58
86
|
detach() {
|
|
59
87
|
this.hidden = true;
|
|
60
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
|
+
}
|
|
61
94
|
render() {
|
|
62
|
-
|
|
63
|
-
this.
|
|
64
|
-
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);
|
|
65
108
|
}
|
|
66
109
|
};
|
|
67
|
-
//#endregion
|
|
68
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 };
|