@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
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The languages a page registered, shared by every player on it. A
|
|
3
|
+
* language is a list of word sets, merged in order, so a page's own words
|
|
4
|
+
* go over the shipped ones. A set can be a loader, which runs the first
|
|
5
|
+
* time a player needs the language: a page registers every language it
|
|
6
|
+
* offers and downloads only the one it shows.
|
|
7
|
+
*/
|
|
8
|
+
import type { Words } from './messages.js';
|
|
9
|
+
/** A set of words, or a function that loads one, such as `() => import('…/locales/de.js')`. */
|
|
10
|
+
export type LocaleSource = Words | (() => Promise<Words | {
|
|
11
|
+
readonly default: Words;
|
|
12
|
+
}>);
|
|
13
|
+
export declare function addLocale(language: string, sources: readonly LocaleSource[]): void;
|
|
14
|
+
/** Calls `fn` on every registration, until the returned function runs. */
|
|
15
|
+
export declare function onLocales(fn: () => void): () => void;
|
|
16
|
+
/**
|
|
17
|
+
* The registered key for a language tag: the tag, else its language
|
|
18
|
+
* alone, so `de-CH` falls back to `de` (BCP 47 lookup, RFC 4647 §3.4).
|
|
19
|
+
* Null when neither is registered, and English then comes from the
|
|
20
|
+
* controls themselves.
|
|
21
|
+
*/
|
|
22
|
+
export declare function registered(tag: string): string | null;
|
|
23
|
+
/** The merged words of `key` now, or null while a loader of it has not run. */
|
|
24
|
+
export declare function wordsNow(key: string): Words | null;
|
|
25
|
+
/** Runs the loaders of `key` once, keeps what they load, and answers the merged words. */
|
|
26
|
+
export declare function load(key: string): Promise<Words>;
|
|
27
|
+
//# sourceMappingURL=locales.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locales.d.ts","sourceRoot":"","sources":["../src/locales.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAE3C,+FAA+F;AAC/F,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,CAAC,MAAM,OAAO,CAAC,KAAK,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAA;CAAE,CAAC,CAAC,CAAC;AAMxF,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,YAAY,EAAE,GAAG,IAAI,CAIlF;AAED,0EAA0E;AAC1E,wBAAgB,SAAS,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAKpD;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAKrD;AAED,+EAA+E;AAC/E,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI,CAIlD;AAED,0FAA0F;AAC1F,wBAAsB,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAYtD"}
|
package/dist/locales.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// src/locales.ts
|
|
2
|
+
/** By lowercase language tag. A loaded set takes its loader's place. */
|
|
3
|
+
const registry = /* @__PURE__ */ new Map();
|
|
4
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
5
|
+
function addLocale(language, sources) {
|
|
6
|
+
const key = language.toLowerCase();
|
|
7
|
+
registry.set(key, [...registry.get(key) ?? [], ...sources]);
|
|
8
|
+
for (const listener of listeners) listener();
|
|
9
|
+
}
|
|
10
|
+
/** Calls `fn` on every registration, until the returned function runs. */
|
|
11
|
+
function onLocales(fn) {
|
|
12
|
+
listeners.add(fn);
|
|
13
|
+
return () => {
|
|
14
|
+
listeners.delete(fn);
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The registered key for a language tag: the tag, else its language
|
|
19
|
+
* alone, so `de-CH` falls back to `de` (BCP 47 lookup, RFC 4647 §3.4).
|
|
20
|
+
* Null when neither is registered, and English then comes from the
|
|
21
|
+
* controls themselves.
|
|
22
|
+
*/
|
|
23
|
+
function registered(tag) {
|
|
24
|
+
const key = tag.toLowerCase();
|
|
25
|
+
if (registry.has(key)) return key;
|
|
26
|
+
const base = key.split("-")[0];
|
|
27
|
+
return registry.has(base) ? base : null;
|
|
28
|
+
}
|
|
29
|
+
/** The merged words of `key` now, or null while a loader of it has not run. */
|
|
30
|
+
function wordsNow(key) {
|
|
31
|
+
const sources = registry.get(key) ?? [];
|
|
32
|
+
if (sources.some((source) => typeof source === "function")) return null;
|
|
33
|
+
return Object.assign({}, ...sources);
|
|
34
|
+
}
|
|
35
|
+
/** Runs the loaders of `key` once, keeps what they load, and answers the merged words. */
|
|
36
|
+
async function load(key) {
|
|
37
|
+
const sources = registry.get(key) ?? [];
|
|
38
|
+
const loaded = await Promise.all(sources.map(async (source) => {
|
|
39
|
+
if (typeof source !== "function") return source;
|
|
40
|
+
const module = await source();
|
|
41
|
+
return "default" in module ? module.default : module;
|
|
42
|
+
}));
|
|
43
|
+
registry.set(key, [...loaded, ...(registry.get(key) ?? []).slice(sources.length)]);
|
|
44
|
+
return wordsNow(key) ?? Object.assign({}, ...loaded);
|
|
45
|
+
}
|
|
46
|
+
export { addLocale, load, onLocales, registered, wordsNow };
|
|
47
|
+
|
|
48
|
+
//# sourceMappingURL=locales.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locales.js","names":[],"sources":["../src/locales.ts"],"sourcesContent":["/**\n * The languages a page registered, shared by every player on it. A\n * language is a list of word sets, merged in order, so a page's own words\n * go over the shipped ones. A set can be a loader, which runs the first\n * time a player needs the language: a page registers every language it\n * offers and downloads only the one it shows.\n */\nimport type { Words } from './messages.js';\n\n/** A set of words, or a function that loads one, such as `() => import('…/locales/de.js')`. */\nexport type LocaleSource = Words | (() => Promise<Words | { readonly default: Words }>);\n\n/** By lowercase language tag. A loaded set takes its loader's place. */\nconst registry = new Map<string, LocaleSource[]>();\nconst listeners = new Set<() => void>();\n\nexport function addLocale(language: string, sources: readonly LocaleSource[]): void {\n const key = language.toLowerCase();\n registry.set(key, [...(registry.get(key) ?? []), ...sources]);\n for (const listener of listeners) listener();\n}\n\n/** Calls `fn` on every registration, until the returned function runs. */\nexport function onLocales(fn: () => void): () => void {\n listeners.add(fn);\n return () => {\n listeners.delete(fn);\n };\n}\n\n/**\n * The registered key for a language tag: the tag, else its language\n * alone, so `de-CH` falls back to `de` (BCP 47 lookup, RFC 4647 §3.4).\n * Null when neither is registered, and English then comes from the\n * controls themselves.\n */\nexport function registered(tag: string): string | null {\n const key = tag.toLowerCase();\n if (registry.has(key)) return key;\n const base = key.split('-')[0] as string;\n return registry.has(base) ? base : null;\n}\n\n/** The merged words of `key` now, or null while a loader of it has not run. */\nexport function wordsNow(key: string): Words | null {\n const sources = registry.get(key) ?? [];\n if (sources.some((source) => typeof source === 'function')) return null;\n return Object.assign({}, ...(sources as Words[]));\n}\n\n/** Runs the loaders of `key` once, keeps what they load, and answers the merged words. */\nexport async function load(key: string): Promise<Words> {\n const sources = registry.get(key) ?? [];\n const loaded = await Promise.all(\n sources.map(async (source) => {\n if (typeof source !== 'function') return source;\n const module = await source();\n return 'default' in module ? (module.default as Words) : (module as Words);\n }),\n );\n // A registration while the loaders ran goes after them, as it was made.\n registry.set(key, [...loaded, ...(registry.get(key) ?? []).slice(sources.length)]);\n return wordsNow(key) ?? Object.assign({}, ...loaded);\n}\n"],"mappings":";;AAaA,MAAM,2BAAW,IAAI,IAA4B;AACjD,MAAM,4BAAY,IAAI,IAAgB;AAEtC,SAAgB,UAAU,UAAkB,SAAwC;CAClF,MAAM,MAAM,SAAS,YAAY;CACjC,SAAS,IAAI,KAAK,CAAC,GAAI,SAAS,IAAI,GAAG,KAAK,CAAC,GAAI,GAAG,OAAO,CAAC;CAC5D,KAAK,MAAM,YAAY,WAAW,SAAS;AAC7C;;AAGA,SAAgB,UAAU,IAA4B;CACpD,UAAU,IAAI,EAAE;CAChB,aAAa;EACX,UAAU,OAAO,EAAE;CACrB;AACF;;;;;;;AAQA,SAAgB,WAAW,KAA4B;CACrD,MAAM,MAAM,IAAI,YAAY;CAC5B,IAAI,SAAS,IAAI,GAAG,GAAG,OAAO;CAC9B,MAAM,OAAO,IAAI,MAAM,GAAG,CAAC,CAAC;CAC5B,OAAO,SAAS,IAAI,IAAI,IAAI,OAAO;AACrC;;AAGA,SAAgB,SAAS,KAA2B;CAClD,MAAM,UAAU,SAAS,IAAI,GAAG,KAAK,CAAC;CACtC,IAAI,QAAQ,MAAM,WAAW,OAAO,WAAW,UAAU,GAAG,OAAO;CACnE,OAAO,OAAO,OAAO,CAAC,GAAG,GAAI,OAAmB;AAClD;;AAGA,eAAsB,KAAK,KAA6B;CACtD,MAAM,UAAU,SAAS,IAAI,GAAG,KAAK,CAAC;CACtC,MAAM,SAAS,MAAM,QAAQ,IAC3B,QAAQ,IAAI,OAAO,WAAW;EAC5B,IAAI,OAAO,WAAW,YAAY,OAAO;EACzC,MAAM,SAAS,MAAM,OAAO;EAC5B,OAAO,aAAa,SAAU,OAAO,UAAqB;CAC5D,CAAC,CACH;CAEA,SAAS,IAAI,KAAK,CAAC,GAAG,QAAQ,IAAI,SAAS,IAAI,GAAG,KAAK,CAAC,EAAA,CAAG,MAAM,QAAQ,MAAM,CAAC,CAAC;CACjF,OAAO,SAAS,GAAG,KAAK,OAAO,OAAO,CAAC,GAAG,GAAG,MAAM;AACrD"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The words of the player, by id. A language is a set of them, which a
|
|
3
|
+
* page registers with `MatteboxPlayerElement.addLocale`. Each id lists its
|
|
4
|
+
* English text, which the controls carry themselves. A `{name}` in a text
|
|
5
|
+
* is filled in at use. Type only: nothing here reaches a bundle.
|
|
6
|
+
*/
|
|
7
|
+
export interface PlayerMessages {
|
|
8
|
+
/** "Play": the play button and the start button. */
|
|
9
|
+
readonly play: string;
|
|
10
|
+
/** "Pause". */
|
|
11
|
+
readonly pause: string;
|
|
12
|
+
/** "Replay", once the media has ended. */
|
|
13
|
+
readonly replay: string;
|
|
14
|
+
/** "Mute". */
|
|
15
|
+
readonly mute: string;
|
|
16
|
+
/** "Unmute". */
|
|
17
|
+
readonly unmute: string;
|
|
18
|
+
/** "Volume": the volume slider. */
|
|
19
|
+
readonly volume: string;
|
|
20
|
+
/** "Seek": the seek bar. */
|
|
21
|
+
readonly seek: string;
|
|
22
|
+
/** "{current} of {duration}": what the seek bar says at a time. */
|
|
23
|
+
readonly seekOf: string;
|
|
24
|
+
/** "{time} behind live". */
|
|
25
|
+
readonly behindLive: string;
|
|
26
|
+
/** "Not available": a blocked part of the seek bar. */
|
|
27
|
+
readonly blocked: string;
|
|
28
|
+
/** "Go to the live edge": the live button. */
|
|
29
|
+
readonly goLive: string;
|
|
30
|
+
/** "At the live edge". */
|
|
31
|
+
readonly atLiveEdge: string;
|
|
32
|
+
/** "LIVE": the live button's text. */
|
|
33
|
+
readonly live: string;
|
|
34
|
+
/** "Rewind": the backward scan button. */
|
|
35
|
+
readonly rewind: string;
|
|
36
|
+
/** "Fast forward". */
|
|
37
|
+
readonly fastForward: string;
|
|
38
|
+
/** "Back {seconds} seconds": the backward skip button. */
|
|
39
|
+
readonly skipBack: string;
|
|
40
|
+
/** "Forward {seconds} seconds". */
|
|
41
|
+
readonly skipForward: string;
|
|
42
|
+
/** "Enter fullscreen". */
|
|
43
|
+
readonly enterFullscreen: string;
|
|
44
|
+
/** "Exit fullscreen". */
|
|
45
|
+
readonly exitFullscreen: string;
|
|
46
|
+
/** "Picture in picture". */
|
|
47
|
+
readonly enterPip: string;
|
|
48
|
+
/** "Leave picture in picture". */
|
|
49
|
+
readonly exitPip: string;
|
|
50
|
+
/** "AirPlay". */
|
|
51
|
+
readonly airplay: string;
|
|
52
|
+
/** "Stop AirPlay". */
|
|
53
|
+
readonly stopAirplay: string;
|
|
54
|
+
/** "Loading": the spinner, and the live region after a wait. */
|
|
55
|
+
readonly loading: string;
|
|
56
|
+
/** "Playback failed": the error screen's title, and the live region. */
|
|
57
|
+
readonly playbackFailed: string;
|
|
58
|
+
/** "Retry". */
|
|
59
|
+
readonly retry: string;
|
|
60
|
+
/** "Back from {page}": the way back from a menu's page. */
|
|
61
|
+
readonly menuBack: string;
|
|
62
|
+
/** "Playback speed": the speed menu. */
|
|
63
|
+
readonly speed: string;
|
|
64
|
+
/** "Normal": the rate 1. */
|
|
65
|
+
readonly speedNormal: string;
|
|
66
|
+
/** "Chapters". */
|
|
67
|
+
readonly chapters: string;
|
|
68
|
+
/** "Quality". */
|
|
69
|
+
readonly quality: string;
|
|
70
|
+
/** "Auto": the quality the engine picks. */
|
|
71
|
+
readonly qualityAuto: string;
|
|
72
|
+
/** "Audio". */
|
|
73
|
+
readonly audio: string;
|
|
74
|
+
/** "Original": the badge of the original soundtrack. */
|
|
75
|
+
readonly original: string;
|
|
76
|
+
/** "AD": the badge of an audio description. */
|
|
77
|
+
readonly audioDescription: string;
|
|
78
|
+
/** "Mono". */
|
|
79
|
+
readonly mono: string;
|
|
80
|
+
/** "Stereo". */
|
|
81
|
+
readonly stereo: string;
|
|
82
|
+
/** "Track": "Track 2" names a track with no name or language. */
|
|
83
|
+
readonly track: string;
|
|
84
|
+
/** "Subtitles": the subtitles menu. */
|
|
85
|
+
readonly subtitles: string;
|
|
86
|
+
/** "Off": subtitles off. */
|
|
87
|
+
readonly subtitlesOff: string;
|
|
88
|
+
/** "SDH": the badge of subtitles for the deaf and hard of hearing. */
|
|
89
|
+
readonly sdh: string;
|
|
90
|
+
/** "CC": the badge of closed captions. */
|
|
91
|
+
readonly closedCaptions: string;
|
|
92
|
+
/** "Settings": the subtitle look. */
|
|
93
|
+
readonly subtitleSettings: string;
|
|
94
|
+
/** "Size". */
|
|
95
|
+
readonly subtitleSize: string;
|
|
96
|
+
/** "Small". */
|
|
97
|
+
readonly sizeSmall: string;
|
|
98
|
+
/** "Medium". */
|
|
99
|
+
readonly sizeMedium: string;
|
|
100
|
+
/** "Large". */
|
|
101
|
+
readonly sizeLarge: string;
|
|
102
|
+
/** "Extra large". */
|
|
103
|
+
readonly sizeExtraLarge: string;
|
|
104
|
+
/** "Background". */
|
|
105
|
+
readonly subtitleBackground: string;
|
|
106
|
+
/** "None": no background. */
|
|
107
|
+
readonly backgroundNone: string;
|
|
108
|
+
/** "Dark". */
|
|
109
|
+
readonly backgroundDark: string;
|
|
110
|
+
/** "Solid". */
|
|
111
|
+
readonly backgroundSolid: string;
|
|
112
|
+
/** "Video": the video menu. */
|
|
113
|
+
readonly video: string;
|
|
114
|
+
/** "Main": the main picture. */
|
|
115
|
+
readonly videoMain: string;
|
|
116
|
+
/** "Alternative": another version of the picture. */
|
|
117
|
+
readonly videoAlternative: string;
|
|
118
|
+
/** "Sign language". */
|
|
119
|
+
readonly videoSign: string;
|
|
120
|
+
/** "Captions": a version with captions in the picture. */
|
|
121
|
+
readonly videoCaptions: string;
|
|
122
|
+
/** "Subtitles": a version with subtitles in the picture. */
|
|
123
|
+
readonly videoSubtitles: string;
|
|
124
|
+
/** "Commentary". */
|
|
125
|
+
readonly videoCommentary: string;
|
|
126
|
+
/** "Skip": the marker button. */
|
|
127
|
+
readonly skip: string;
|
|
128
|
+
/** "Skip intro". */
|
|
129
|
+
readonly skipIntro: string;
|
|
130
|
+
/** "Skip credits". */
|
|
131
|
+
readonly skipCredits: string;
|
|
132
|
+
/** "Protected by {system}, {keys}": the DRM badge. */
|
|
133
|
+
readonly drmProtected: string;
|
|
134
|
+
/** "no key yet". */
|
|
135
|
+
readonly drmNoKey: string;
|
|
136
|
+
/** "{count} key: {statuses}". */
|
|
137
|
+
readonly drmKey: string;
|
|
138
|
+
/** "{count} keys: {statuses}". */
|
|
139
|
+
readonly drmKeys: string;
|
|
140
|
+
/** "Playing": the live region. */
|
|
141
|
+
readonly saidPlaying: string;
|
|
142
|
+
/** "Paused". */
|
|
143
|
+
readonly saidPaused: string;
|
|
144
|
+
/** "Audio: {track}". */
|
|
145
|
+
readonly saidAudio: string;
|
|
146
|
+
/** "Subtitles: {track}". */
|
|
147
|
+
readonly saidSubtitles: string;
|
|
148
|
+
/** "Subtitles off". */
|
|
149
|
+
readonly saidSubtitlesOff: string;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Every id a page can give words for. The player's ids are here; a
|
|
153
|
+
* package with words of its own adds its ids through declaration merging:
|
|
154
|
+
*
|
|
155
|
+
* ```ts
|
|
156
|
+
* declare module '@mattebox/player' {
|
|
157
|
+
* interface Messages extends PlaylistMessages {}
|
|
158
|
+
* }
|
|
159
|
+
* ```
|
|
160
|
+
*/
|
|
161
|
+
export interface Messages extends PlayerMessages {
|
|
162
|
+
}
|
|
163
|
+
/** Some words of a language: a shipped one, or the page's own over it. */
|
|
164
|
+
export type Words = {
|
|
165
|
+
readonly [Id in keyof Messages]?: string;
|
|
166
|
+
};
|
|
167
|
+
//# sourceMappingURL=messages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../src/messages.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,oDAAoD;IACpD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,eAAe;IACf,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,0CAA0C;IAC1C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,cAAc;IACd,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,gBAAgB;IAChB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,mCAAmC;IACnC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,4BAA4B;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,mEAAmE;IACnE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,4BAA4B;IAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,uDAAuD;IACvD,QAAQ,CAAC,OAAO,EAAE,MAAM,C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Q,EAAE,EAAE,IAAI,MAAM,QAAQ,CAAC,CAAC,EAAE,MAAM;CAAE,CAAC"}
|
package/dist/namespaces.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
// src/namespaces.ts
|
|
2
2
|
/** The optional namespaces on an engine, each present exactly when its stage was composed. */
|
|
3
3
|
function namespaces(engine) {
|
|
4
4
|
return engine;
|
|
5
5
|
}
|
|
6
|
-
//#endregion
|
|
7
6
|
export { namespaces };
|
|
8
7
|
|
|
9
8
|
//# sourceMappingURL=namespaces.js.map
|
package/dist/presets.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/presets.ts
|
|
2
2
|
/** eme-core's teardown calls `element.setMediaKeys(null)` unguarded, so a build without EME throws out of `detach`. */
|
|
3
3
|
const DRM_STAGES = [
|
|
4
4
|
"eme-core",
|
|
@@ -35,7 +35,6 @@ async function resolvePreset(name) {
|
|
|
35
35
|
function drmGuard() {
|
|
36
36
|
return "setMediaKeys" in HTMLMediaElement.prototype ? {} : { without: DRM_STAGES };
|
|
37
37
|
}
|
|
38
|
-
//#endregion
|
|
39
38
|
export { drmGuard, resolvePreset };
|
|
40
39
|
|
|
41
40
|
//# sourceMappingURL=presets.js.map
|
package/dist/style.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
const STYLE = ":host{--mbx-surface:#1c1c20;--mbx-text:#f3ede4;--mbx-muted:#aaa49a;--mbx-accent:#e0543c;--mbx-error:#ffb4ab;--mbx-live:#ff4d4d;--mbx-radius:.25em;--mbx-gap:.625em;--mbx-pad:.5em;--mbx-font:system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif;background:#000;outline:none;font-size:16px;display:block;position:relative}:host([hidden]){display:none}[part~=stage]{flex-direction:column;justify-content:center;height:100%;display:flex;position:relative}::slotted(video){object-fit:contain;width:100%;min-height:0;max-height:100%;display:block}::slotted(source){display:none}@supports (aspect-ratio:1){::slotted(video){aspect-ratio:auto 16/9}}:host([casting]) ::slotted(mbx-control-bar),:host([casting]) ::slotted(mbx-start-button),:host([ended]) ::slotted(mbx-marker-button),:host([controls=none]) ::slotted(:not(video)){display:none}:host(:focus) [part~=stage]{outline:2px solid var(--mbx-accent);outline-offset:-2px}:host(:focus:not(:focus-visible)) [part~=stage]{outline:none}[part~=error]{padding:calc(var(--mbx-pad) - var(--mbx-gap) / 2);background:var(--mbx-surface);color:var(--mbx-error);font:400 .8125em / 1.4 var(--mbx-font);flex-wrap:wrap;align-items:center;display:flex}:host(:fullscreen) ::slotted(video){flex:1}:host(:fullscreen) [part~=error]{position:absolute;bottom:0;left:0;right:0}:host(:-webkit-full-screen) ::slotted(video){flex:1}:host(:-webkit-full-screen) [part~=error]{position:absolute;bottom:0;left:0;right:0}[part~=error]>*{margin:calc(var(--mbx-gap) / 2)}[part~=value]{color:var(--mbx-accent)}[part~=announcer]{clip:rect(0 0 0 0);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}[part~=button]{font:inherit;color:inherit;border-radius:var(--mbx-radius);background:0 0;border:1px solid;padding:.125em .375em}[hidden]{display:none}:host([tooltips=off]){--mbx-tooltip:none}:host([layout=wide]){font-size:20px}";
|
|
2
|
-
//#endregion
|
|
1
|
+
const STYLE = ":host{--mbx-surface:#1c1c20;--mbx-text:#f3ede4;--mbx-muted:#aaa49a;--mbx-accent:#e0543c;--mbx-error:#ffb4ab;--mbx-live:#ff4d4d;--mbx-radius:.25em;--mbx-gap:.625em;--mbx-pad:.5em;--mbx-font:system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif;background:#000;outline:none;font-size:16px;display:block;position:relative}:host([hidden]){display:none}[part~=stage]{flex-direction:column;justify-content:center;height:100%;display:flex;position:relative}::slotted(video){object-fit:contain;width:100%;min-height:0;max-height:100%;display:block}::slotted(source){display:none}@supports (aspect-ratio:1){::slotted(video){aspect-ratio:auto 16/9}}:host([casting]) ::slotted(mbx-control-bar),:host([casting]) ::slotted(mbx-start-button),:host([ended]) ::slotted(mbx-marker-button),:host([error]:not([diagnostics])) ::slotted(:not(video):not(mbx-error-screen):not(mbx-diagnostics)),:host([blocked]:not([diagnostics])) ::slotted(:not(video):not(mbx-error-screen):not(mbx-diagnostics)),:host([controls=none]) ::slotted(:not(video)){display:none}:host(:focus) [part~=stage]{outline:2px solid var(--mbx-accent);outline-offset:-2px}:host(:focus:not(:focus-visible)) [part~=stage]{outline:none}[part~=error]{padding:calc(var(--mbx-pad) - var(--mbx-gap) / 2);background:var(--mbx-surface);color:var(--mbx-error);font:400 .8125em / 1.4 var(--mbx-font);flex-wrap:wrap;align-items:center;display:flex}:host(:fullscreen) ::slotted(video){flex:1}:host(:fullscreen) [part~=error]{position:absolute;bottom:0;left:0;right:0}:host(:-webkit-full-screen) ::slotted(video){flex:1}:host(:-webkit-full-screen) [part~=error]{position:absolute;bottom:0;left:0;right:0}[part~=error]>*{margin:calc(var(--mbx-gap) / 2)}[part~=value]{color:var(--mbx-accent)}[part~=announcer]{clip:rect(0 0 0 0);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}[part~=button]{font:inherit;color:inherit;border-radius:var(--mbx-radius);background:0 0;border:1px solid;padding:.125em .375em}[hidden]{display:none}:host([tooltips=off]){--mbx-tooltip:none}:host([layout=wide]){font-size:20px}";
|
|
3
2
|
export { STYLE };
|
|
4
3
|
|
|
5
4
|
//# sourceMappingURL=style.js.map
|
package/dist/surface.d.ts
CHANGED
|
@@ -9,7 +9,10 @@ import type { PlayerError } from '@mattebox/player-core';
|
|
|
9
9
|
export interface ErrorSurface {
|
|
10
10
|
readonly root: HTMLElement;
|
|
11
11
|
show(error: PlayerError): void;
|
|
12
|
+
/** Shows a block's words, with no retry: a retry cannot lift a block. */
|
|
13
|
+
inform(title: string, message: string): void;
|
|
12
14
|
clear(): void;
|
|
13
15
|
}
|
|
14
|
-
|
|
16
|
+
/** `word` names the retry, in the player's language at the time of the error. */
|
|
17
|
+
export declare function errorSurface(retry: () => void, word: () => string): ErrorSurface;
|
|
15
18
|
//# sourceMappingURL=surface.d.ts.map
|
package/dist/surface.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"surface.d.ts","sourceRoot":"","sources":["../src/surface.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGzD,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,IAAI,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,CAAC;IAC/B,KAAK,IAAI,IAAI,CAAC;CACf;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,IAAI,GAAG,YAAY,
|
|
1
|
+
{"version":3,"file":"surface.d.ts","sourceRoot":"","sources":["../src/surface.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGzD,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,IAAI,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,CAAC;IAC/B,yEAAyE;IACzE,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7C,KAAK,IAAI,IAAI,CAAC;CACf;AAED,iFAAiF;AACjF,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,IAAI,EAAE,IAAI,EAAE,MAAM,MAAM,GAAG,YAAY,CA6BhF"}
|
package/dist/surface.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { el } from "./dom.js";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
// src/surface.ts
|
|
3
|
+
/** `word` names the retry, in the player's language at the time of the error. */
|
|
4
|
+
function errorSurface(retry, word) {
|
|
4
5
|
const root = el("div", "error");
|
|
5
6
|
const category = el("span", "value error-category");
|
|
6
7
|
const code = el("span", "value error-code");
|
|
7
|
-
const button = el("button", "button error-retry"
|
|
8
|
+
const button = el("button", "button error-retry");
|
|
8
9
|
button.type = "button";
|
|
9
10
|
button.addEventListener("click", retry);
|
|
10
11
|
root.append(category, code, button);
|
|
@@ -14,6 +15,14 @@ function errorSurface(retry) {
|
|
|
14
15
|
show(error) {
|
|
15
16
|
category.textContent = error.category;
|
|
16
17
|
code.textContent = error.code;
|
|
18
|
+
button.textContent = word();
|
|
19
|
+
button.hidden = false;
|
|
20
|
+
root.hidden = false;
|
|
21
|
+
},
|
|
22
|
+
inform(title, message) {
|
|
23
|
+
category.textContent = title;
|
|
24
|
+
code.textContent = message;
|
|
25
|
+
button.hidden = true;
|
|
17
26
|
root.hidden = false;
|
|
18
27
|
},
|
|
19
28
|
clear() {
|
|
@@ -21,7 +30,6 @@ function errorSurface(retry) {
|
|
|
21
30
|
}
|
|
22
31
|
};
|
|
23
32
|
}
|
|
24
|
-
//#endregion
|
|
25
33
|
export { errorSurface };
|
|
26
34
|
|
|
27
35
|
//# sourceMappingURL=surface.js.map
|
package/dist/surface.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"surface.js","names":[],"sources":["../src/surface.ts"],"sourcesContent":["/**\n * The error surface under native controls: a row under the video with the\n * category, the code and a retry. It outlives a session, because the core\n * reports \"no handler claimed this source\" when there is no session to\n * hang it on. It stays hidden until a fatal error arrives, and under\n * custom controls the error screen element carries the error instead.\n */\nimport type { PlayerError } from '@mattebox/player-core';\nimport { el } from './dom.js';\n\nexport interface ErrorSurface {\n readonly root: HTMLElement;\n show(error: PlayerError): void;\n clear(): void;\n}\n\nexport function errorSurface(retry: () => void): ErrorSurface {\n const root = el('div', 'error');\n const category = el('span', 'value error-category');\n const code = el('span', 'value error-code');\n const button = el('button', 'button error-retry'
|
|
1
|
+
{"version":3,"file":"surface.js","names":[],"sources":["../src/surface.ts"],"sourcesContent":["/**\n * The error surface under native controls: a row under the video with the\n * category, the code and a retry. It outlives a session, because the core\n * reports \"no handler claimed this source\" when there is no session to\n * hang it on. It stays hidden until a fatal error arrives, and under\n * custom controls the error screen element carries the error instead.\n */\nimport type { PlayerError } from '@mattebox/player-core';\nimport { el } from './dom.js';\n\nexport interface ErrorSurface {\n readonly root: HTMLElement;\n show(error: PlayerError): void;\n /** Shows a block's words, with no retry: a retry cannot lift a block. */\n inform(title: string, message: string): void;\n clear(): void;\n}\n\n/** `word` names the retry, in the player's language at the time of the error. */\nexport function errorSurface(retry: () => void, word: () => string): ErrorSurface {\n const root = el('div', 'error');\n const category = el('span', 'value error-category');\n const code = el('span', 'value error-code');\n const button = el('button', 'button error-retry');\n button.type = 'button';\n button.addEventListener('click', retry);\n root.append(category, code, button);\n root.hidden = true;\n\n return {\n root,\n show(error: PlayerError): void {\n category.textContent = error.category;\n code.textContent = error.code;\n button.textContent = word();\n button.hidden = false;\n root.hidden = false;\n },\n inform(title: string, message: string): void {\n category.textContent = title;\n code.textContent = message;\n button.hidden = true;\n root.hidden = false;\n },\n clear(): void {\n root.hidden = true;\n },\n };\n}\n"],"mappings":";;;AAmBA,SAAgB,aAAa,OAAmB,MAAkC;CAChF,MAAM,OAAO,GAAG,OAAO,OAAO;CAC9B,MAAM,WAAW,GAAG,QAAQ,sBAAsB;CAClD,MAAM,OAAO,GAAG,QAAQ,kBAAkB;CAC1C,MAAM,SAAS,GAAG,UAAU,oBAAoB;CAChD,OAAO,OAAO;CACd,OAAO,iBAAiB,SAAS,KAAK;CACtC,KAAK,OAAO,UAAU,MAAM,MAAM;CAClC,KAAK,SAAS;CAEd,OAAO;EACL;EACA,KAAK,OAA0B;GAC7B,SAAS,cAAc,MAAM;GAC7B,KAAK,cAAc,MAAM;GACzB,OAAO,cAAc,KAAK;GAC1B,OAAO,SAAS;GAChB,KAAK,SAAS;EAChB;EACA,OAAO,OAAe,SAAuB;GAC3C,SAAS,cAAc;GACvB,KAAK,cAAc;GACnB,OAAO,SAAS;GAChB,KAAK,SAAS;EAChB;EACA,QAAc;GACZ,KAAK,SAAS;EAChB;CACF;AACF"}
|
package/dist/tags.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export declare const LIVE_BUTTON = "mbx-live-button";
|
|
|
23
23
|
export declare const SPEED_MENU = "mbx-speed-menu";
|
|
24
24
|
export declare const QUALITY_MENU = "mbx-quality-menu";
|
|
25
25
|
export declare const AUDIO_MENU = "mbx-audio-menu";
|
|
26
|
+
export declare const VIDEO_MENU = "mbx-video-menu";
|
|
26
27
|
export declare const SUBTITLES_MENU = "mbx-subtitles-menu";
|
|
27
28
|
export declare const DRM_BADGE = "mbx-drm-badge";
|
|
28
29
|
export declare const VOLUME = "mbx-volume";
|
package/dist/tags.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tags.d.ts","sourceRoot":"","sources":["../src/tags.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,eAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,eAAO,MAAM,WAAW,oBAAoB,CAAC;AAC7C,eAAO,MAAM,MAAM,eAAe,CAAC;AACnC,eAAO,MAAM,WAAW,oBAAoB,CAAC;AAC7C,eAAO,MAAM,WAAW,oBAAoB,CAAC;AAC7C,eAAO,MAAM,aAAa,sBAAsB,CAAC;AACjD,eAAO,MAAM,WAAW,oBAAoB,CAAC;AAC7C,eAAO,MAAM,WAAW,oBAAoB,CAAC;AAC7C,eAAO,MAAM,UAAU,mBAAmB,CAAC;AAC3C,eAAO,MAAM,cAAc,uBAAuB,CAAC;AACnD,eAAO,MAAM,iBAAiB,0BAA0B,CAAC;AACzD,eAAO,MAAM,YAAY,qBAAqB,CAAC;AAC/C,eAAO,MAAM,aAAa,sBAAsB,CAAC;AACjD,eAAO,MAAM,YAAY,qBAAqB,CAAC;AAC/C,eAAO,MAAM,OAAO,gBAAgB,CAAC;AACrC,eAAO,MAAM,KAAK,cAAc,CAAC;AACjC,eAAO,MAAM,YAAY,qBAAqB,CAAC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AAO,MAAM,cAAc,uBAAuB,CAAC;AACnD,eAAO,MAAM,QAAQ,iBAAiB,CAAC;AACvC,eAAO,MAAM,WAAW,oBAAoB,CAAC;AAC7C,eAAO,MAAM,UAAU,mBAAmB,CAAC;AAC3C,eAAO,MAAM,YAAY,qBAAqB,CAAC;AAC/C,eAAO,MAAM,UAAU,mBAAmB,CAAC;AAC3C,eAAO,MAAM,UAAU,mBAAmB,CAAC;AAC3C,eAAO,MAAM,cAAc,uBAAuB,CAAC;AACnD,eAAO,MAAM,SAAS,kBAAkB,CAAC;AACzC,eAAO,MAAM,MAAM,eAAe,CAAC;AACnC,eAAO,MAAM,aAAa,sBAAsB,CAAC"}
|
package/dist/tags.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/tags.ts
|
|
2
2
|
/** The tag names, in one place, so the composition and the lookup agree with the registration. */
|
|
3
3
|
const PLAYER = "mattebox-player";
|
|
4
4
|
const CONTROL_BAR = "mbx-control-bar";
|
|
@@ -24,11 +24,11 @@ const LIVE_BUTTON = "mbx-live-button";
|
|
|
24
24
|
const SPEED_MENU = "mbx-speed-menu";
|
|
25
25
|
const QUALITY_MENU = "mbx-quality-menu";
|
|
26
26
|
const AUDIO_MENU = "mbx-audio-menu";
|
|
27
|
+
const VIDEO_MENU = "mbx-video-menu";
|
|
27
28
|
const SUBTITLES_MENU = "mbx-subtitles-menu";
|
|
28
29
|
const DRM_BADGE = "mbx-drm-badge";
|
|
29
30
|
const VOLUME = "mbx-volume";
|
|
30
31
|
const CHAPTERS_MENU = "mbx-chapters-menu";
|
|
31
|
-
|
|
32
|
-
export { AIRPLAY_BUTTON, AUDIO_MENU, CHAPTERS_MENU, CONTROL_BAR, CURRENT_TIME, DRM_BADGE, DURATION, ERROR_SCREEN, FULLSCREEN_BUTTON, LIVE_BUTTON, MARKER_BUTTON, MUTE_BUTTON, PIP_BUTTON, PLAYER, PLAY_BUTTON, QUALITY_MENU, REMAINING_TIME, SCAN_BUTTON, SEEK_BAR, SKIP_BUTTON, SPACER, SPEED_MENU, SPINNER, START_BUTTON, SUBTITLES_MENU, TITLE, VOLUME, VOLUME_SLIDER };
|
|
32
|
+
export { AIRPLAY_BUTTON, AUDIO_MENU, CHAPTERS_MENU, CONTROL_BAR, CURRENT_TIME, DRM_BADGE, DURATION, ERROR_SCREEN, FULLSCREEN_BUTTON, LIVE_BUTTON, MARKER_BUTTON, MUTE_BUTTON, PIP_BUTTON, PLAYER, PLAY_BUTTON, QUALITY_MENU, REMAINING_TIME, SCAN_BUTTON, SEEK_BAR, SKIP_BUTTON, SPACER, SPEED_MENU, SPINNER, START_BUTTON, SUBTITLES_MENU, TITLE, VIDEO_MENU, VOLUME, VOLUME_SLIDER };
|
|
33
33
|
|
|
34
34
|
//# sourceMappingURL=tags.js.map
|
package/dist/tags.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tags.js","names":[],"sources":["../src/tags.ts"],"sourcesContent":["/** The tag names, in one place, so the composition and the lookup agree with the registration. */\nexport const PLAYER = 'mattebox-player';\nexport const CONTROL_BAR = 'mbx-control-bar';\nexport const SPACER = 'mbx-spacer';\nexport const PLAY_BUTTON = 'mbx-play-button';\nexport const MUTE_BUTTON = 'mbx-mute-button';\nexport const VOLUME_SLIDER = 'mbx-volume-slider';\nexport const SKIP_BUTTON = 'mbx-skip-button';\nexport const SCAN_BUTTON = 'mbx-scan-button';\nexport const PIP_BUTTON = 'mbx-pip-button';\nexport const AIRPLAY_BUTTON = 'mbx-airplay-button';\nexport const FULLSCREEN_BUTTON = 'mbx-fullscreen-button';\nexport const START_BUTTON = 'mbx-start-button';\nexport const MARKER_BUTTON = 'mbx-marker-button';\nexport const ERROR_SCREEN = 'mbx-error-screen';\nexport const SPINNER = 'mbx-spinner';\nexport const TITLE = 'mbx-title';\nexport const CURRENT_TIME = 'mbx-current-time';\nexport const DURATION = 'mbx-duration';\nexport const REMAINING_TIME = 'mbx-remaining-time';\nexport const SEEK_BAR = 'mbx-seek-bar';\nexport const LIVE_BUTTON = 'mbx-live-button';\nexport const SPEED_MENU = 'mbx-speed-menu';\nexport const QUALITY_MENU = 'mbx-quality-menu';\nexport const AUDIO_MENU = 'mbx-audio-menu';\nexport const SUBTITLES_MENU = 'mbx-subtitles-menu';\nexport const DRM_BADGE = 'mbx-drm-badge';\nexport const VOLUME = 'mbx-volume';\nexport const CHAPTERS_MENU = 'mbx-chapters-menu';\n"],"mappings":";;AACA,MAAa,SAAS;AACtB,MAAa,cAAc;AAC3B,MAAa,SAAS;AACtB,MAAa,cAAc;AAC3B,MAAa,cAAc;AAC3B,MAAa,gBAAgB;AAC7B,MAAa,cAAc;AAC3B,MAAa,cAAc;AAC3B,MAAa,aAAa;AAC1B,MAAa,iBAAiB;AAC9B,MAAa,oBAAoB;AACjC,MAAa,eAAe;AAC5B,MAAa,gBAAgB;AAC7B,MAAa,eAAe;AAC5B,MAAa,UAAU;AACvB,MAAa,QAAQ;AACrB,MAAa,eAAe;AAC5B,MAAa,WAAW;AACxB,MAAa,iBAAiB;AAC9B,MAAa,WAAW;AACxB,MAAa,cAAc;AAC3B,MAAa,aAAa;AAC1B,MAAa,eAAe;AAC5B,MAAa,aAAa;AAC1B,MAAa,iBAAiB;AAC9B,MAAa,YAAY;AACzB,MAAa,SAAS;AACtB,MAAa,gBAAgB"}
|
|
1
|
+
{"version":3,"file":"tags.js","names":[],"sources":["../src/tags.ts"],"sourcesContent":["/** The tag names, in one place, so the composition and the lookup agree with the registration. */\nexport const PLAYER = 'mattebox-player';\nexport const CONTROL_BAR = 'mbx-control-bar';\nexport const SPACER = 'mbx-spacer';\nexport const PLAY_BUTTON = 'mbx-play-button';\nexport const MUTE_BUTTON = 'mbx-mute-button';\nexport const VOLUME_SLIDER = 'mbx-volume-slider';\nexport const SKIP_BUTTON = 'mbx-skip-button';\nexport const SCAN_BUTTON = 'mbx-scan-button';\nexport const PIP_BUTTON = 'mbx-pip-button';\nexport const AIRPLAY_BUTTON = 'mbx-airplay-button';\nexport const FULLSCREEN_BUTTON = 'mbx-fullscreen-button';\nexport const START_BUTTON = 'mbx-start-button';\nexport const MARKER_BUTTON = 'mbx-marker-button';\nexport const ERROR_SCREEN = 'mbx-error-screen';\nexport const SPINNER = 'mbx-spinner';\nexport const TITLE = 'mbx-title';\nexport const CURRENT_TIME = 'mbx-current-time';\nexport const DURATION = 'mbx-duration';\nexport const REMAINING_TIME = 'mbx-remaining-time';\nexport const SEEK_BAR = 'mbx-seek-bar';\nexport const LIVE_BUTTON = 'mbx-live-button';\nexport const SPEED_MENU = 'mbx-speed-menu';\nexport const QUALITY_MENU = 'mbx-quality-menu';\nexport const AUDIO_MENU = 'mbx-audio-menu';\nexport const VIDEO_MENU = 'mbx-video-menu';\nexport const SUBTITLES_MENU = 'mbx-subtitles-menu';\nexport const DRM_BADGE = 'mbx-drm-badge';\nexport const VOLUME = 'mbx-volume';\nexport const CHAPTERS_MENU = 'mbx-chapters-menu';\n"],"mappings":";;AACA,MAAa,SAAS;AACtB,MAAa,cAAc;AAC3B,MAAa,SAAS;AACtB,MAAa,cAAc;AAC3B,MAAa,cAAc;AAC3B,MAAa,gBAAgB;AAC7B,MAAa,cAAc;AAC3B,MAAa,cAAc;AAC3B,MAAa,aAAa;AAC1B,MAAa,iBAAiB;AAC9B,MAAa,oBAAoB;AACjC,MAAa,eAAe;AAC5B,MAAa,gBAAgB;AAC7B,MAAa,eAAe;AAC5B,MAAa,UAAU;AACvB,MAAa,QAAQ;AACrB,MAAa,eAAe;AAC5B,MAAa,WAAW;AACxB,MAAa,iBAAiB;AAC9B,MAAa,WAAW;AACxB,MAAa,cAAc;AAC3B,MAAa,aAAa;AAC1B,MAAa,eAAe;AAC5B,MAAa,aAAa;AAC1B,MAAa,aAAa;AAC1B,MAAa,iBAAiB;AAC9B,MAAa,YAAY;AACzB,MAAa,SAAS;AACtB,MAAa,gBAAgB"}
|
package/dist/text.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Words a page gives the player, such as why a programme is blocked: one
|
|
3
|
+
* string, or the same words by language tag, which the player reads in
|
|
4
|
+
* its own language and reads again on `localechange`.
|
|
5
|
+
*/
|
|
6
|
+
import type { Text } from '@mattebox/player-core';
|
|
7
|
+
export type { Text };
|
|
8
|
+
/**
|
|
9
|
+
* The words of `text` for `locale`: the tag, then its language alone, so
|
|
10
|
+
* `de-CH` falls back to `de` (BCP 47 lookup, RFC 4647 §3.4), then English,
|
|
11
|
+
* then the first entry. Tags compare without case.
|
|
12
|
+
*/
|
|
13
|
+
export declare function textIn(text: Text, locale: string): string;
|
|
14
|
+
//# sourceMappingURL=text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../src/text.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAElD,YAAY,EAAE,IAAI,EAAE,CAAC;AAErB;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAYzD"}
|
package/dist/text.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// src/text.ts
|
|
2
|
+
/**
|
|
3
|
+
* The words of `text` for `locale`: the tag, then its language alone, so
|
|
4
|
+
* `de-CH` falls back to `de` (BCP 47 lookup, RFC 4647 §3.4), then English,
|
|
5
|
+
* then the first entry. Tags compare without case.
|
|
6
|
+
*/
|
|
7
|
+
function textIn(text, locale) {
|
|
8
|
+
if (typeof text === "string") return text;
|
|
9
|
+
const tags = /* @__PURE__ */ new Map();
|
|
10
|
+
for (const tag of Object.keys(text)) tags.set(tag.toLowerCase(), text[tag]);
|
|
11
|
+
const key = locale.toLowerCase();
|
|
12
|
+
return tags.get(key) ?? tags.get(key.split("-")[0]) ?? tags.get("en") ?? tags.values().next().value ?? "";
|
|
13
|
+
}
|
|
14
|
+
export { textIn };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=text.js.map
|
package/dist/text.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.js","names":[],"sources":["../src/text.ts"],"sourcesContent":["/**\n * Words a page gives the player, such as why a programme is blocked: one\n * string, or the same words by language tag, which the player reads in\n * its own language and reads again on `localechange`.\n */\n\nimport type { Text } from '@mattebox/player-core';\n\nexport type { Text };\n\n/**\n * The words of `text` for `locale`: the tag, then its language alone, so\n * `de-CH` falls back to `de` (BCP 47 lookup, RFC 4647 §3.4), then English,\n * then the first entry. Tags compare without case.\n */\nexport function textIn(text: Text, locale: string): string {\n if (typeof text === 'string') return text;\n const tags = new Map<string, string>();\n for (const tag of Object.keys(text)) tags.set(tag.toLowerCase(), text[tag] as string);\n const key = locale.toLowerCase();\n return (\n tags.get(key) ??\n tags.get(key.split('-')[0] as string) ??\n tags.get('en') ??\n tags.values().next().value ??\n ''\n );\n}\n"],"mappings":";;;;;;AAeA,SAAgB,OAAO,MAAY,QAAwB;CACzD,IAAI,OAAO,SAAS,UAAU,OAAO;CACrC,MAAM,uBAAO,IAAI,IAAoB;CACrC,KAAK,MAAM,OAAO,OAAO,KAAK,IAAI,GAAG,KAAK,IAAI,IAAI,YAAY,GAAG,KAAK,IAAc;CACpF,MAAM,MAAM,OAAO,YAAY;CAC/B,OACE,KAAK,IAAI,GAAG,KACZ,KAAK,IAAI,IAAI,MAAM,GAAG,CAAC,CAAC,EAAY,KACpC,KAAK,IAAI,IAAI,KACb,KAAK,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,SACrB;AAEJ"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The trackers of one player: what the page added, started at each
|
|
3
|
+
* programme and stopped at its end. The page decides which trackers run,
|
|
4
|
+
* and when it adds or removes them; the player only starts and stops them.
|
|
5
|
+
* The lifecycle is pillarbox-apple's `PlayerItemTracker`, enable at the
|
|
6
|
+
* start of an item and disable at its end, without its tracking switch:
|
|
7
|
+
* consent is the page's to decide.
|
|
8
|
+
*/
|
|
9
|
+
import type { Programme } from '@mattebox/player-core';
|
|
10
|
+
import type { PlayerHost, Tracker, Trackers } from './host.js';
|
|
11
|
+
export type { Tracker, Trackers };
|
|
12
|
+
/** What the element drives: the programme that starts, or null at its end. */
|
|
13
|
+
export interface TrackerRunner extends Trackers {
|
|
14
|
+
begin(programme: Programme | null): void;
|
|
15
|
+
}
|
|
16
|
+
/** The trackers of `host`. `changed` runs after each start, stop, addition and removal. */
|
|
17
|
+
export declare function createTrackers(host: PlayerHost, changed: () => void): TrackerRunner;
|
|
18
|
+
//# sourceMappingURL=trackers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trackers.d.ts","sourceRoot":"","sources":["../src/trackers.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE/D,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;AAElC,8EAA8E;AAC9E,MAAM,WAAW,aAAc,SAAQ,QAAQ;IAC7C,KAAK,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI,GAAG,IAAI,CAAC;CAC1C;AAaD,2FAA2F;AAC3F,wBAAgB,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,IAAI,GAAG,aAAa,CA8BnF"}
|
package/dist/trackers.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// src/trackers.ts
|
|
2
|
+
/** Runs `fn`, and throws its error on a task of its own: one tracker's bug stops neither playback nor the others. */
|
|
3
|
+
function guard(fn) {
|
|
4
|
+
try {
|
|
5
|
+
fn();
|
|
6
|
+
} catch (error) {
|
|
7
|
+
setTimeout(() => {
|
|
8
|
+
throw error;
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
/** The trackers of `host`. `changed` runs after each start, stop, addition and removal. */
|
|
13
|
+
function createTrackers(host, changed) {
|
|
14
|
+
const set = /* @__PURE__ */ new Set();
|
|
15
|
+
let current = null;
|
|
16
|
+
return {
|
|
17
|
+
add(tracker) {
|
|
18
|
+
if (set.has(tracker)) return;
|
|
19
|
+
set.add(tracker);
|
|
20
|
+
const programme = current;
|
|
21
|
+
if (programme !== null) guard(() => tracker.start(programme, host));
|
|
22
|
+
changed();
|
|
23
|
+
},
|
|
24
|
+
delete(tracker) {
|
|
25
|
+
if (!set.delete(tracker)) return false;
|
|
26
|
+
if (current !== null) guard(() => tracker.stop());
|
|
27
|
+
changed();
|
|
28
|
+
return true;
|
|
29
|
+
},
|
|
30
|
+
has: (tracker) => set.has(tracker),
|
|
31
|
+
get list() {
|
|
32
|
+
return [...set];
|
|
33
|
+
},
|
|
34
|
+
begin(programme) {
|
|
35
|
+
if (current === null && programme === null) return;
|
|
36
|
+
if (current !== null) for (const tracker of set) guard(() => tracker.stop());
|
|
37
|
+
current = programme;
|
|
38
|
+
if (programme !== null) for (const tracker of set) guard(() => tracker.start(programme, host));
|
|
39
|
+
changed();
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export { createTrackers };
|
|
44
|
+
|
|
45
|
+
//# sourceMappingURL=trackers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trackers.js","names":[],"sources":["../src/trackers.ts"],"sourcesContent":["/**\n * The trackers of one player: what the page added, started at each\n * programme and stopped at its end. The page decides which trackers run,\n * and when it adds or removes them; the player only starts and stops them.\n * The lifecycle is pillarbox-apple's `PlayerItemTracker`, enable at the\n * start of an item and disable at its end, without its tracking switch:\n * consent is the page's to decide.\n */\nimport type { Programme } from '@mattebox/player-core';\nimport type { PlayerHost, Tracker, Trackers } from './host.js';\n\nexport type { Tracker, Trackers };\n\n/** What the element drives: the programme that starts, or null at its end. */\nexport interface TrackerRunner extends Trackers {\n begin(programme: Programme | null): void;\n}\n\n/** Runs `fn`, and throws its error on a task of its own: one tracker's bug stops neither playback nor the others. */\nfunction guard(fn: () => void): void {\n try {\n fn();\n } catch (error) {\n setTimeout(() => {\n throw error;\n });\n }\n}\n\n/** The trackers of `host`. `changed` runs after each start, stop, addition and removal. */\nexport function createTrackers(host: PlayerHost, changed: () => void): TrackerRunner {\n const set = new Set<Tracker>();\n let current: Programme | null = null;\n return {\n add(tracker) {\n if (set.has(tracker)) return;\n set.add(tracker);\n const programme = current;\n if (programme !== null) guard(() => tracker.start(programme, host));\n changed();\n },\n delete(tracker) {\n if (!set.delete(tracker)) return false;\n if (current !== null) guard(() => tracker.stop());\n changed();\n return true;\n },\n has: (tracker) => set.has(tracker),\n get list() {\n return [...set];\n },\n begin(programme) {\n if (current === null && programme === null) return;\n if (current !== null) for (const tracker of set) guard(() => tracker.stop());\n current = programme;\n if (programme !== null)\n for (const tracker of set) guard(() => tracker.start(programme, host));\n changed();\n },\n };\n}\n"],"mappings":";;AAmBA,SAAS,MAAM,IAAsB;CACnC,IAAI;EACF,GAAG;CACL,SAAS,OAAO;EACd,iBAAiB;GACf,MAAM;EACR,CAAC;CACH;AACF;;AAGA,SAAgB,eAAe,MAAkB,SAAoC;CACnF,MAAM,sBAAM,IAAI,IAAa;CAC7B,IAAI,UAA4B;CAChC,OAAO;EACL,IAAI,SAAS;GACX,IAAI,IAAI,IAAI,OAAO,GAAG;GACtB,IAAI,IAAI,OAAO;GACf,MAAM,YAAY;GAClB,IAAI,cAAc,MAAM,YAAY,QAAQ,MAAM,WAAW,IAAI,CAAC;GAClE,QAAQ;EACV;EACA,OAAO,SAAS;GACd,IAAI,CAAC,IAAI,OAAO,OAAO,GAAG,OAAO;GACjC,IAAI,YAAY,MAAM,YAAY,QAAQ,KAAK,CAAC;GAChD,QAAQ;GACR,OAAO;EACT;EACA,MAAM,YAAY,IAAI,IAAI,OAAO;EACjC,IAAI,OAAO;GACT,OAAO,CAAC,GAAG,GAAG;EAChB;EACA,MAAM,WAAW;GACf,IAAI,YAAY,QAAQ,cAAc,MAAM;GAC5C,IAAI,YAAY,MAAM,KAAK,MAAM,WAAW,KAAK,YAAY,QAAQ,KAAK,CAAC;GAC3E,UAAU;GACV,IAAI,cAAc,MAChB,KAAK,MAAM,WAAW,KAAK,YAAY,QAAQ,MAAM,WAAW,IAAI,CAAC;GACvE,QAAQ;EACV;CACF;AACF"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Versions of the picture at their own URLs, such as a sign-language
|
|
3
|
+
* version. A switch is a new load, so the element carries over what the
|
|
4
|
+
* viewer had: the position, the play state, and the audio and subtitle
|
|
5
|
+
* choice. A track inside the manifest needs none of this: the engine
|
|
6
|
+
* switches it in the same session.
|
|
7
|
+
*/
|
|
8
|
+
import type { Source, SourceVideoTrack } from '@mattebox/player-core';
|
|
9
|
+
import type { Mattebox, Track } from 'mattebox';
|
|
10
|
+
/** The child element that declares a version in markup, as `<track>` declares text. */
|
|
11
|
+
export declare const VIDEO_TRACK = "mbx-video-track";
|
|
12
|
+
/** The versions the `<mbx-video-track>` children of `element` declare, in their order. */
|
|
13
|
+
export declare function markupVideoTracks(element: Element): SourceVideoTrack[];
|
|
14
|
+
/** The source a version loads as. Without EME it brings no DRM, as a source does not. */
|
|
15
|
+
export declare function versionSource(track: SourceVideoTrack, eme: boolean): Source;
|
|
16
|
+
/**
|
|
17
|
+
* Puts the new load where the old one was: the same position, and playing
|
|
18
|
+
* when it played. A position on a live source means nothing on another
|
|
19
|
+
* stream's timeline, so `at` is null there and the load joins at its edge.
|
|
20
|
+
* A load that empties the video before its metadata drops the wait.
|
|
21
|
+
*/
|
|
22
|
+
export declare function resume(media: HTMLMediaElement, at: number | null, playing: boolean): void;
|
|
23
|
+
/** The audio and subtitle tracks a viewer had; text is null when subtitles were off. */
|
|
24
|
+
export interface Chosen {
|
|
25
|
+
readonly audio: Track | null;
|
|
26
|
+
readonly text: Track | null;
|
|
27
|
+
}
|
|
28
|
+
export declare function chosen(engine: Mattebox | null): Chosen | null;
|
|
29
|
+
/**
|
|
30
|
+
* Selects on `engine` the tracks that match what the viewer had, once its
|
|
31
|
+
* manifest lists them. A track with no match keeps the engine's default.
|
|
32
|
+
*/
|
|
33
|
+
export declare function restore(engine: Mattebox | null, had: Chosen | null): void;
|
|
34
|
+
/**
|
|
35
|
+
* Shows the frame on screen as the poster of `media` while the next load has
|
|
36
|
+
* none: a new load empties the video, which then shows its poster, so the
|
|
37
|
+
* picture would flash to the poster and back. Returns the function that puts
|
|
38
|
+
* the poster back, or null when there is no frame to hold or the canvas
|
|
39
|
+
* cannot export it, as for a video from another origin without CORS.
|
|
40
|
+
*/
|
|
41
|
+
export declare function holdFrame(media: HTMLVideoElement): (() => void) | null;
|
|
42
|
+
/**
|
|
43
|
+
* Calls `release` once the new load shows a frame where `resume` put it:
|
|
44
|
+
* after the seek to `at`, or on the first frame when it joins a live edge,
|
|
45
|
+
* or when playback starts.
|
|
46
|
+
*/
|
|
47
|
+
export declare function onNextFrame(media: HTMLMediaElement, at: number | null, release: () => void): void;
|
|
48
|
+
//# sourceMappingURL=video-sources.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"video-sources.d.ts","sourceRoot":"","sources":["../src/video-sources.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAGhD,uFAAuF;AACvF,eAAO,MAAM,WAAW,oBAAoB,CAAC;AAE7C,0FAA0F;AAC1F,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,gBAAgB,EAAE,CAiBtE;AAED,yFAAyF;AACzF,wBAAgB,aAAa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