@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,75 @@
|
|
|
1
|
+
// src/locales/pt.ts
|
|
2
|
+
var pt_default = {
|
|
3
|
+
play: "Reproduzir",
|
|
4
|
+
pause: "Pausar",
|
|
5
|
+
replay: "Reproduzir de novo",
|
|
6
|
+
mute: "Silenciar",
|
|
7
|
+
unmute: "Ativar o som",
|
|
8
|
+
volume: "Volume",
|
|
9
|
+
seek: "Posição",
|
|
10
|
+
seekOf: "{current} de {duration}",
|
|
11
|
+
behindLive: "{time} atrás do direto",
|
|
12
|
+
blocked: "Indisponível",
|
|
13
|
+
goLive: "Ir para o direto",
|
|
14
|
+
atLiveEdge: "Em direto",
|
|
15
|
+
live: "DIRETO",
|
|
16
|
+
rewind: "Retroceder rápido",
|
|
17
|
+
fastForward: "Avançar rápido",
|
|
18
|
+
skipBack: "Recuar {seconds} segundos",
|
|
19
|
+
skipForward: "Avançar {seconds} segundos",
|
|
20
|
+
enterFullscreen: "Ecrã inteiro",
|
|
21
|
+
exitFullscreen: "Sair de ecrã inteiro",
|
|
22
|
+
enterPip: "Imagem na imagem",
|
|
23
|
+
exitPip: "Sair de imagem na imagem",
|
|
24
|
+
airplay: "AirPlay",
|
|
25
|
+
stopAirplay: "Parar AirPlay",
|
|
26
|
+
loading: "A carregar",
|
|
27
|
+
playbackFailed: "A reprodução falhou",
|
|
28
|
+
retry: "Tentar de novo",
|
|
29
|
+
menuBack: "Voltar de {page}",
|
|
30
|
+
speed: "Velocidade",
|
|
31
|
+
speedNormal: "Normal",
|
|
32
|
+
chapters: "Capítulos",
|
|
33
|
+
quality: "Qualidade",
|
|
34
|
+
qualityAuto: "Automática",
|
|
35
|
+
audio: "Áudio",
|
|
36
|
+
original: "Original",
|
|
37
|
+
audioDescription: "AD",
|
|
38
|
+
mono: "Mono",
|
|
39
|
+
stereo: "Estéreo",
|
|
40
|
+
track: "Faixa",
|
|
41
|
+
subtitles: "Legendas",
|
|
42
|
+
subtitlesOff: "Desligadas",
|
|
43
|
+
sdh: "SDH",
|
|
44
|
+
closedCaptions: "CC",
|
|
45
|
+
subtitleSettings: "Definições",
|
|
46
|
+
subtitleSize: "Tamanho",
|
|
47
|
+
sizeSmall: "Pequeno",
|
|
48
|
+
sizeMedium: "Médio",
|
|
49
|
+
sizeLarge: "Grande",
|
|
50
|
+
sizeExtraLarge: "Muito grande",
|
|
51
|
+
subtitleBackground: "Fundo",
|
|
52
|
+
backgroundNone: "Nenhum",
|
|
53
|
+
backgroundDark: "Escuro",
|
|
54
|
+
backgroundSolid: "Sólido",
|
|
55
|
+
video: "Vídeo",
|
|
56
|
+
videoMain: "Principal",
|
|
57
|
+
videoAlternative: "Alternativa",
|
|
58
|
+
videoSign: "Língua gestual",
|
|
59
|
+
videoCaptions: "Legendas para surdos",
|
|
60
|
+
videoSubtitles: "Legendado",
|
|
61
|
+
videoCommentary: "Comentário",
|
|
62
|
+
skip: "Pular",
|
|
63
|
+
skipIntro: "Pular abertura",
|
|
64
|
+
skipCredits: "Pular créditos",
|
|
65
|
+
drmProtected: "Protegido por {system}, {keys}",
|
|
66
|
+
drmNoKey: "ainda sem chave",
|
|
67
|
+
drmKey: "{count} chave: {statuses}",
|
|
68
|
+
drmKeys: "{count} chaves: {statuses}",
|
|
69
|
+
saidPlaying: "A reproduzir",
|
|
70
|
+
saidPaused: "Em pausa",
|
|
71
|
+
saidAudio: "Áudio: {track}",
|
|
72
|
+
saidSubtitles: "Legendas: {track}",
|
|
73
|
+
saidSubtitlesOff: "Legendas desativadas"
|
|
74
|
+
};
|
|
75
|
+
export { pt_default as default };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// src/locales/zh.ts
|
|
2
|
+
var zh_default = {
|
|
3
|
+
play: "播放",
|
|
4
|
+
pause: "暂停",
|
|
5
|
+
replay: "重新播放",
|
|
6
|
+
mute: "静音",
|
|
7
|
+
unmute: "取消静音",
|
|
8
|
+
volume: "音量",
|
|
9
|
+
seek: "进度",
|
|
10
|
+
seekOf: "{current} / {duration}",
|
|
11
|
+
behindLive: "落后直播 {time}",
|
|
12
|
+
blocked: "不可用",
|
|
13
|
+
goLive: "跳到直播",
|
|
14
|
+
atLiveEdge: "正在直播",
|
|
15
|
+
live: "直播",
|
|
16
|
+
rewind: "快退",
|
|
17
|
+
fastForward: "快进",
|
|
18
|
+
skipBack: "后退 {seconds} 秒",
|
|
19
|
+
skipForward: "前进 {seconds} 秒",
|
|
20
|
+
enterFullscreen: "全屏",
|
|
21
|
+
exitFullscreen: "退出全屏",
|
|
22
|
+
enterPip: "画中画",
|
|
23
|
+
exitPip: "退出画中画",
|
|
24
|
+
airplay: "AirPlay",
|
|
25
|
+
stopAirplay: "停止 AirPlay",
|
|
26
|
+
loading: "加载中",
|
|
27
|
+
playbackFailed: "播放失败",
|
|
28
|
+
retry: "重试",
|
|
29
|
+
menuBack: "从{page}返回",
|
|
30
|
+
speed: "播放速度",
|
|
31
|
+
speedNormal: "正常",
|
|
32
|
+
chapters: "章节",
|
|
33
|
+
quality: "画质",
|
|
34
|
+
qualityAuto: "自动",
|
|
35
|
+
audio: "音轨",
|
|
36
|
+
original: "原声",
|
|
37
|
+
audioDescription: "AD",
|
|
38
|
+
mono: "单声道",
|
|
39
|
+
stereo: "立体声",
|
|
40
|
+
track: "字幕轨",
|
|
41
|
+
subtitles: "字幕",
|
|
42
|
+
subtitlesOff: "关闭",
|
|
43
|
+
sdh: "SDH",
|
|
44
|
+
closedCaptions: "CC",
|
|
45
|
+
subtitleSettings: "设置",
|
|
46
|
+
subtitleSize: "字号",
|
|
47
|
+
sizeSmall: "小",
|
|
48
|
+
sizeMedium: "中",
|
|
49
|
+
sizeLarge: "大",
|
|
50
|
+
sizeExtraLarge: "特大",
|
|
51
|
+
subtitleBackground: "背景",
|
|
52
|
+
backgroundNone: "无",
|
|
53
|
+
backgroundDark: "深色",
|
|
54
|
+
backgroundSolid: "实色",
|
|
55
|
+
video: "视频",
|
|
56
|
+
videoMain: "主画面",
|
|
57
|
+
videoAlternative: "其他版本",
|
|
58
|
+
videoSign: "手语",
|
|
59
|
+
videoCaptions: "听障字幕",
|
|
60
|
+
videoSubtitles: "带字幕",
|
|
61
|
+
videoCommentary: "解说",
|
|
62
|
+
skip: "跳过",
|
|
63
|
+
skipIntro: "跳过片头",
|
|
64
|
+
skipCredits: "跳过片尾",
|
|
65
|
+
drmProtected: "由 {system} 保护,{keys}",
|
|
66
|
+
drmNoKey: "尚无密钥",
|
|
67
|
+
drmKey: "{count} 个密钥:{statuses}",
|
|
68
|
+
drmKeys: "{count} 个密钥:{statuses}",
|
|
69
|
+
saidPlaying: "正在播放",
|
|
70
|
+
saidPaused: "已暂停",
|
|
71
|
+
saidAudio: "音频:{track}",
|
|
72
|
+
saidSubtitles: "字幕:{track}",
|
|
73
|
+
saidSubtitlesOff: "字幕已关闭"
|
|
74
|
+
};
|
|
75
|
+
export { zh_default as default };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import _asyncToGenerator from "./_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/asyncToGenerator.js";
|
|
2
|
+
// src/locales.ts
|
|
3
|
+
/** By lowercase language tag. A loaded set takes its loader's place. */
|
|
4
|
+
const registry = /* @__PURE__ */ new Map();
|
|
5
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
6
|
+
function addLocale(language, sources) {
|
|
7
|
+
var _registry$get;
|
|
8
|
+
const key = language.toLowerCase();
|
|
9
|
+
registry.set(key, [...(_registry$get = registry.get(key)) !== null && _registry$get !== void 0 ? _registry$get : [], ...sources]);
|
|
10
|
+
for (const listener of listeners) listener();
|
|
11
|
+
}
|
|
12
|
+
/** Calls `fn` on every registration, until the returned function runs. */
|
|
13
|
+
function onLocales(fn) {
|
|
14
|
+
listeners.add(fn);
|
|
15
|
+
return () => {
|
|
16
|
+
listeners.delete(fn);
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The registered key for a language tag: the tag, else its language
|
|
21
|
+
* alone, so `de-CH` falls back to `de` (BCP 47 lookup, RFC 4647 §3.4).
|
|
22
|
+
* Null when neither is registered, and English then comes from the
|
|
23
|
+
* controls themselves.
|
|
24
|
+
*/
|
|
25
|
+
function registered(tag) {
|
|
26
|
+
const key = tag.toLowerCase();
|
|
27
|
+
if (registry.has(key)) return key;
|
|
28
|
+
const base = key.split("-")[0];
|
|
29
|
+
return registry.has(base) ? base : null;
|
|
30
|
+
}
|
|
31
|
+
/** The merged words of `key` now, or null while a loader of it has not run. */
|
|
32
|
+
function wordsNow(key) {
|
|
33
|
+
var _registry$get2;
|
|
34
|
+
const sources = (_registry$get2 = registry.get(key)) !== null && _registry$get2 !== void 0 ? _registry$get2 : [];
|
|
35
|
+
if (sources.some((source) => typeof source === "function")) return null;
|
|
36
|
+
return Object.assign({}, ...sources);
|
|
37
|
+
}
|
|
38
|
+
/** Runs the loaders of `key` once, keeps what they load, and answers the merged words. */
|
|
39
|
+
function load(_x2) {
|
|
40
|
+
return _load.apply(this, arguments);
|
|
41
|
+
}
|
|
42
|
+
function _load() {
|
|
43
|
+
_load = _asyncToGenerator(function* (key) {
|
|
44
|
+
var _registry$get3, _registry$get4, _wordsNow;
|
|
45
|
+
const sources = (_registry$get3 = registry.get(key)) !== null && _registry$get3 !== void 0 ? _registry$get3 : [];
|
|
46
|
+
const loaded = yield Promise.all(sources.map(function() {
|
|
47
|
+
var _ref = _asyncToGenerator(function* (source) {
|
|
48
|
+
if (typeof source !== "function") return source;
|
|
49
|
+
const module = yield source();
|
|
50
|
+
return "default" in module ? module.default : module;
|
|
51
|
+
});
|
|
52
|
+
return function(_x) {
|
|
53
|
+
return _ref.apply(this, arguments);
|
|
54
|
+
};
|
|
55
|
+
}()));
|
|
56
|
+
registry.set(key, [...loaded, ...((_registry$get4 = registry.get(key)) !== null && _registry$get4 !== void 0 ? _registry$get4 : []).slice(sources.length)]);
|
|
57
|
+
return (_wordsNow = wordsNow(key)) !== null && _wordsNow !== void 0 ? _wordsNow : Object.assign({}, ...loaded);
|
|
58
|
+
});
|
|
59
|
+
return _load.apply(this, arguments);
|
|
60
|
+
}
|
|
61
|
+
export { addLocale, load, onLocales, registered, wordsNow };
|
package/dist/es2015/presets.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _asyncToGenerator from "./_virtual/_@oxc-project_runtime@0.
|
|
2
|
-
|
|
1
|
+
import _asyncToGenerator from "./_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/asyncToGenerator.js";
|
|
2
|
+
// src/presets.ts
|
|
3
3
|
/** eme-core's teardown calls `element.setMediaKeys(null)` unguarded, so a build without EME throws out of `detach`. */
|
|
4
4
|
const DRM_STAGES = [
|
|
5
5
|
"eme-core",
|
|
@@ -42,5 +42,4 @@ function _resolvePreset() {
|
|
|
42
42
|
function drmGuard() {
|
|
43
43
|
return "setMediaKeys" in HTMLMediaElement.prototype ? {} : { without: DRM_STAGES };
|
|
44
44
|
}
|
|
45
|
-
//#endregion
|
|
46
45
|
export { drmGuard, resolvePreset };
|
package/dist/es2015/style.js
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
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 };
|
package/dist/es2015/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,5 +30,4 @@ function errorSurface(retry) {
|
|
|
21
30
|
}
|
|
22
31
|
};
|
|
23
32
|
}
|
|
24
|
-
//#endregion
|
|
25
33
|
export { errorSurface };
|
package/dist/es2015/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,9 +24,9 @@ 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 };
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
var _ref, _ref2, _ref3, _tags$get;
|
|
9
|
+
if (typeof text === "string") return text;
|
|
10
|
+
const tags = /* @__PURE__ */ new Map();
|
|
11
|
+
for (const tag of Object.keys(text)) tags.set(tag.toLowerCase(), text[tag]);
|
|
12
|
+
const key = locale.toLowerCase();
|
|
13
|
+
return (_ref = (_ref2 = (_ref3 = (_tags$get = tags.get(key)) !== null && _tags$get !== void 0 ? _tags$get : tags.get(key.split("-")[0])) !== null && _ref3 !== void 0 ? _ref3 : tags.get("en")) !== null && _ref2 !== void 0 ? _ref2 : tags.values().next().value) !== null && _ref !== void 0 ? _ref : "";
|
|
14
|
+
}
|
|
15
|
+
export { textIn };
|
|
@@ -0,0 +1,43 @@
|
|
|
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 };
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import _objectSpread2 from "./_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/objectSpread2.js";
|
|
2
|
+
import { isAudioDescription, isSdh } from "mattebox";
|
|
3
|
+
// src/video-sources.ts
|
|
4
|
+
/** The child element that declares a version in markup, as `<track>` declares text. */
|
|
5
|
+
const VIDEO_TRACK = "mbx-video-track";
|
|
6
|
+
/** The versions the `<mbx-video-track>` children of `element` declare, in their order. */
|
|
7
|
+
function markupVideoTracks(element) {
|
|
8
|
+
const found = [];
|
|
9
|
+
for (const child of Array.from(element.children)) {
|
|
10
|
+
var _child$getAttribute;
|
|
11
|
+
const url = child.localName === "mbx-video-track" ? child.getAttribute("src") : null;
|
|
12
|
+
if (url === null) continue;
|
|
13
|
+
const type = child.getAttribute("type");
|
|
14
|
+
const label = child.getAttribute("label");
|
|
15
|
+
const language = child.getAttribute("srclang");
|
|
16
|
+
found.push(_objectSpread2(_objectSpread2(_objectSpread2({
|
|
17
|
+
url,
|
|
18
|
+
kind: (_child$getAttribute = child.getAttribute("kind")) !== null && _child$getAttribute !== void 0 ? _child$getAttribute : "alternative"
|
|
19
|
+
}, type === null ? {} : { type }), label === null ? {} : { label }), language === null ? {} : { language }));
|
|
20
|
+
}
|
|
21
|
+
return found;
|
|
22
|
+
}
|
|
23
|
+
/** The source a version loads as. Without EME it brings no DRM, as a source does not. */
|
|
24
|
+
function versionSource(track, eme) {
|
|
25
|
+
return _objectSpread2(_objectSpread2({ url: track.url }, track.type === void 0 ? {} : { type: track.type }), eme && track.drm !== void 0 ? { drm: track.drm } : {});
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Puts the new load where the old one was: the same position, and playing
|
|
29
|
+
* when it played. A position on a live source means nothing on another
|
|
30
|
+
* stream's timeline, so `at` is null there and the load joins at its edge.
|
|
31
|
+
* A load that empties the video before its metadata drops the wait.
|
|
32
|
+
*/
|
|
33
|
+
function resume(media, at, playing) {
|
|
34
|
+
const go = () => {
|
|
35
|
+
media.removeEventListener("emptied", drop);
|
|
36
|
+
if (at !== null) media.currentTime = at;
|
|
37
|
+
if (playing) media.play().catch(() => void 0);
|
|
38
|
+
};
|
|
39
|
+
const drop = () => {
|
|
40
|
+
media.removeEventListener("loadedmetadata", go);
|
|
41
|
+
};
|
|
42
|
+
if (media.readyState >= 1) {
|
|
43
|
+
go();
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
media.addEventListener("loadedmetadata", go, { once: true });
|
|
47
|
+
media.addEventListener("emptied", drop, { once: true });
|
|
48
|
+
}
|
|
49
|
+
function chosen(engine) {
|
|
50
|
+
if (engine === null) return null;
|
|
51
|
+
return {
|
|
52
|
+
audio: engine.tracks.active("audio"),
|
|
53
|
+
text: engine.tracks.active("text")
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/** The same language, and the same audio description or SDH flag. */
|
|
57
|
+
function same(a, b) {
|
|
58
|
+
return a.lang === b.lang && isAudioDescription(a) === isAudioDescription(b) && isSdh(a) === isSdh(b) && a.forced === b.forced;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Selects on `engine` the tracks that match what the viewer had, once its
|
|
62
|
+
* manifest lists them. A track with no match keeps the engine's default.
|
|
63
|
+
*/
|
|
64
|
+
function restore(engine, had) {
|
|
65
|
+
if (engine === null || had === null) return;
|
|
66
|
+
const apply = () => {
|
|
67
|
+
const { available } = engine.tracks;
|
|
68
|
+
for (const [contentType, track] of [["audio", had.audio], ["text", had.text]]) {
|
|
69
|
+
if (track === null) {
|
|
70
|
+
if (contentType === "text") engine.tracks.deselect("text");
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
const match = available.find((t) => t.contentType === contentType && engine.tracks.selectable(t.id) && same(t, track));
|
|
74
|
+
if (match !== void 0) engine.tracks.select(match.id);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
if (engine.tracks.available.length > 0) {
|
|
78
|
+
apply();
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const off = engine.on("tracks:changed", () => {
|
|
82
|
+
off();
|
|
83
|
+
apply();
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Shows the frame on screen as the poster of `media` while the next load has
|
|
88
|
+
* none: a new load empties the video, which then shows its poster, so the
|
|
89
|
+
* picture would flash to the poster and back. Returns the function that puts
|
|
90
|
+
* the poster back, or null when there is no frame to hold or the canvas
|
|
91
|
+
* cannot export it, as for a video from another origin without CORS.
|
|
92
|
+
*/
|
|
93
|
+
function holdFrame(media) {
|
|
94
|
+
if (media.readyState < 2 || media.videoWidth === 0) return null;
|
|
95
|
+
const canvas = document.createElement("canvas");
|
|
96
|
+
canvas.width = media.videoWidth;
|
|
97
|
+
canvas.height = media.videoHeight;
|
|
98
|
+
let frame;
|
|
99
|
+
try {
|
|
100
|
+
var _canvas$getContext;
|
|
101
|
+
(_canvas$getContext = canvas.getContext("2d")) === null || _canvas$getContext === void 0 || _canvas$getContext.drawImage(media, 0, 0);
|
|
102
|
+
frame = canvas.toDataURL("image/jpeg", .9);
|
|
103
|
+
} catch (_unused) {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
const poster = media.getAttribute("poster");
|
|
107
|
+
media.setAttribute("poster", frame);
|
|
108
|
+
return () => {
|
|
109
|
+
if (media.getAttribute("poster") !== frame) return;
|
|
110
|
+
if (poster === null) media.removeAttribute("poster");
|
|
111
|
+
else media.setAttribute("poster", poster);
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Calls `release` once the new load shows a frame where `resume` put it:
|
|
116
|
+
* after the seek to `at`, or on the first frame when it joins a live edge,
|
|
117
|
+
* or when playback starts.
|
|
118
|
+
*/
|
|
119
|
+
function onNextFrame(media, at, release) {
|
|
120
|
+
const events = ["playing", at === null ? "loadeddata" : "seeked"];
|
|
121
|
+
const done = () => {
|
|
122
|
+
for (const type of events) media.removeEventListener(type, done);
|
|
123
|
+
release();
|
|
124
|
+
};
|
|
125
|
+
for (const type of events) media.addEventListener(type, done);
|
|
126
|
+
}
|
|
127
|
+
export { VIDEO_TRACK, chosen, holdFrame, markupVideoTracks, onNextFrame, restore, resume, versionSource };
|
package/dist/host.d.ts
CHANGED
|
@@ -8,17 +8,65 @@
|
|
|
8
8
|
* This is the whole surface a control gets. A control that needs more
|
|
9
9
|
* has found a gap in the player's public API, and the gap is the bug.
|
|
10
10
|
*/
|
|
11
|
-
import type { Player, PlayerError } from '@mattebox/player-core';
|
|
11
|
+
import type { Block, Player, PlayerError, Programme, ProgrammeSource, Source, SourceVideoTrack } from '@mattebox/player-core';
|
|
12
12
|
import type { Mattebox } from 'mattebox';
|
|
13
13
|
import type { Markers } from './controls/markers.js';
|
|
14
|
+
import type { Messages } from './messages.js';
|
|
15
|
+
export type { Block };
|
|
16
|
+
export interface Tracker {
|
|
17
|
+
/** What the diagnostics panel calls it. */
|
|
18
|
+
readonly name: string;
|
|
19
|
+
/** The id of the tracker's current session, which the diagnostics panel shows for support. */
|
|
20
|
+
readonly session?: string | undefined;
|
|
21
|
+
/** The id of the device the tracker reports, which the diagnostics panel shows too. */
|
|
22
|
+
readonly device?: string | undefined;
|
|
23
|
+
/** At the start of each programme, or at once when added during one. */
|
|
24
|
+
start(programme: Programme, player: PlayerHost): void;
|
|
25
|
+
/** At the end of the programme, at unload, or when removed during one. */
|
|
26
|
+
stop(): void;
|
|
27
|
+
}
|
|
28
|
+
export interface Trackers {
|
|
29
|
+
/** Adds a tracker; during a programme, it starts at once. */
|
|
30
|
+
add(tracker: Tracker): void;
|
|
31
|
+
/** Removes a tracker; during a programme, it stops at once. False when it was not there. */
|
|
32
|
+
delete(tracker: Tracker): boolean;
|
|
33
|
+
has(tracker: Tracker): boolean;
|
|
34
|
+
/** The trackers, in the order they were added. */
|
|
35
|
+
readonly list: readonly Tracker[];
|
|
36
|
+
}
|
|
14
37
|
export interface PlayerHost extends HTMLElement {
|
|
15
38
|
readonly video: HTMLVideoElement;
|
|
16
39
|
readonly engine: Mattebox | null;
|
|
17
40
|
readonly player: Player | null;
|
|
18
41
|
/** The fatal error of the current load, or null: a control attached after the event still sees it. */
|
|
19
42
|
readonly error: PlayerError | null;
|
|
43
|
+
/** What `block()` set, or null: a control attached after `blockchange` still sees it. */
|
|
44
|
+
readonly blocked: Block | null;
|
|
20
45
|
/** The ranges the page named: credits to skip, parts that must not play. */
|
|
21
46
|
readonly markers: Markers;
|
|
47
|
+
/** What the current load resolved to, with what a connector said of the programme; null without one. */
|
|
48
|
+
readonly programme: Programme | null;
|
|
49
|
+
/** The sources to load when there is no `src` attribute; setting it loads them. */
|
|
50
|
+
sources: readonly ProgrammeSource[] | null;
|
|
51
|
+
/** The page's trackers, started at each programme. */
|
|
52
|
+
readonly trackers: Trackers;
|
|
53
|
+
/** Loads the sources again, in the order a load reads them. */
|
|
54
|
+
retry(): void;
|
|
55
|
+
/** The other versions of the picture the source names at their own URLs. */
|
|
56
|
+
readonly videoSources: readonly SourceVideoTrack[];
|
|
57
|
+
/** The version of `videoSources` that plays, or null for the source itself. */
|
|
58
|
+
readonly videoSource: SourceVideoTrack | null;
|
|
59
|
+
selectVideoSource(track: SourceVideoTrack | null): void;
|
|
60
|
+
/** Loads another source of the same programme in place, holding the frame and the controls. */
|
|
61
|
+
switchSource(source: Source): void;
|
|
62
|
+
/** The language tag the words come from, or empty for English. */
|
|
63
|
+
readonly locale: string;
|
|
64
|
+
/**
|
|
65
|
+
* The word of `id` in the player's language, or undefined, where the
|
|
66
|
+
* control's own English applies. The player fires `localechange` when
|
|
67
|
+
* the words change.
|
|
68
|
+
*/
|
|
69
|
+
message(id: keyof Messages): string | undefined;
|
|
22
70
|
}
|
|
23
71
|
/**
|
|
24
72
|
* The nearest player above `node`, through shadow hosts, or null outside
|
package/dist/host.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EACV,KAAK,EACL,MAAM,EACN,WAAW,EACX,SAAS,EACT,eAAe,EACf,MAAM,EACN,gBAAgB,EACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAG9C,YAAY,EAAE,KAAK,EAAE,CAAC;AAEtB,MAAM,WAAW,OAAO;IACtB,2CAA2C;IAC3C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,8FAA8F;IAC9F,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,uFAAuF;IACvF,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,wEAAwE;IACxE,KAAK,CAAC,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,GAAG,IAAI,CAAC;IACtD,0EAA0E;IAC1E,IAAI,IAAI,IAAI,CAAC;CACd;AAED,MAAM,WAAW,QAAQ;IACvB,6DAA6D;IAC7D,GAAG,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IAC5B,4FAA4F;IAC5F,MAAM,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC;IAClC,GAAG,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC;IAC/B,kDAAkD;IAClD,QAAQ,CAAC,IAAI,EAAE,SAAS,OAAO,EAAE,CAAC;CACnC;AAED,MAAM,WAAW,UAAW,SAAQ,WAAW;IAC7C,QAAQ,CAAC,KAAK,EAAE,gBAAgB,CAAC;IACjC,QAAQ,CAAC,MAAM,EAAE,QAAQ,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,sGAAsG;IACtG,QAAQ,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,CAAC;IACnC,yFAAyF;IACzF,QAAQ,CAAC,OAAO,EAAE,KAAK,GAAG,IAAI,CAAC;IAC/B,4EAA4E;IAC5E,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,wGAAwG;IACxG,QAAQ,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI,CAAC;IACrC,mFAAmF;IACnF,OAAO,EAAE,SAAS,eAAe,EAAE,GAAG,IAAI,CAAC;IAC3C,sDAAsD;IACtD,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,+DAA+D;IAC/D,KAAK,IAAI,IAAI,CAAC;IACd,4EAA4E;IAC5E,QAAQ,CAAC,YAAY,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACnD,+EAA+E;IAC/E,QAAQ,CAAC,WAAW,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC9C,iBAAiB,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI,GAAG,IAAI,CAAC;IACxD,+FAA+F;IAC/F,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,kEAAkE;IAClE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,OAAO,CAAC,EAAE,EAAE,MAAM,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC;CACjD;AASD;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,WAAW,GAAG,IAAI,CAOzD"}
|
package/dist/host.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./tags.js";
|
|
2
|
-
|
|
2
|
+
// src/host.ts
|
|
3
3
|
/** The parent, or the host of the shadow root `node` sits in, or null at the document. */
|
|
4
4
|
function above(node) {
|
|
5
5
|
const parent = node.parentNode;
|
|
@@ -19,7 +19,6 @@ function findPlayer(node) {
|
|
|
19
19
|
}
|
|
20
20
|
return null;
|
|
21
21
|
}
|
|
22
|
-
//#endregion
|
|
23
22
|
export { findPlayer };
|
|
24
23
|
|
|
25
24
|
//# sourceMappingURL=host.js.map
|
package/dist/host.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host.js","names":[],"sources":["../src/host.ts"],"sourcesContent":["/**\n * What a control sees of the player it sits in: the video, the engine, the\n * core, and the element itself for its events and attributes. Declared\n * here and not imported from the element, because the element registers\n * the controls and a control that imported the element would close a cycle.\n * `MatteboxPlayerElement` implements it.\n *\n * This is the whole surface a control gets. A control that needs more\n * has found a gap in the player's public API, and the gap is the bug.\n */\nimport type {
|
|
1
|
+
{"version":3,"file":"host.js","names":[],"sources":["../src/host.ts"],"sourcesContent":["/**\n * What a control sees of the player it sits in: the video, the engine, the\n * core, and the element itself for its events and attributes. Declared\n * here and not imported from the element, because the element registers\n * the controls and a control that imported the element would close a cycle.\n * `MatteboxPlayerElement` implements it.\n *\n * This is the whole surface a control gets. A control that needs more\n * has found a gap in the player's public API, and the gap is the bug.\n */\nimport type {\n Block,\n Player,\n PlayerError,\n Programme,\n ProgrammeSource,\n Source,\n SourceVideoTrack,\n} from '@mattebox/player-core';\nimport type { Mattebox } from 'mattebox';\nimport type { Markers } from './controls/markers.js';\nimport type { Messages } from './messages.js';\nimport { PLAYER } from './tags.js';\n\nexport type { Block };\n\nexport interface Tracker {\n /** What the diagnostics panel calls it. */\n readonly name: string;\n /** The id of the tracker's current session, which the diagnostics panel shows for support. */\n readonly session?: string | undefined;\n /** The id of the device the tracker reports, which the diagnostics panel shows too. */\n readonly device?: string | undefined;\n /** At the start of each programme, or at once when added during one. */\n start(programme: Programme, player: PlayerHost): void;\n /** At the end of the programme, at unload, or when removed during one. */\n stop(): void;\n}\n\nexport interface Trackers {\n /** Adds a tracker; during a programme, it starts at once. */\n add(tracker: Tracker): void;\n /** Removes a tracker; during a programme, it stops at once. False when it was not there. */\n delete(tracker: Tracker): boolean;\n has(tracker: Tracker): boolean;\n /** The trackers, in the order they were added. */\n readonly list: readonly Tracker[];\n}\n\nexport interface PlayerHost extends HTMLElement {\n readonly video: HTMLVideoElement;\n readonly engine: Mattebox | null;\n readonly player: Player | null;\n /** The fatal error of the current load, or null: a control attached after the event still sees it. */\n readonly error: PlayerError | null;\n /** What `block()` set, or null: a control attached after `blockchange` still sees it. */\n readonly blocked: Block | null;\n /** The ranges the page named: credits to skip, parts that must not play. */\n readonly markers: Markers;\n /** What the current load resolved to, with what a connector said of the programme; null without one. */\n readonly programme: Programme | null;\n /** The sources to load when there is no `src` attribute; setting it loads them. */\n sources: readonly ProgrammeSource[] | null;\n /** The page's trackers, started at each programme. */\n readonly trackers: Trackers;\n /** Loads the sources again, in the order a load reads them. */\n retry(): void;\n /** The other versions of the picture the source names at their own URLs. */\n readonly videoSources: readonly SourceVideoTrack[];\n /** The version of `videoSources` that plays, or null for the source itself. */\n readonly videoSource: SourceVideoTrack | null;\n selectVideoSource(track: SourceVideoTrack | null): void;\n /** Loads another source of the same programme in place, holding the frame and the controls. */\n switchSource(source: Source): void;\n /** The language tag the words come from, or empty for English. */\n readonly locale: string;\n /**\n * The word of `id` in the player's language, or undefined, where the\n * control's own English applies. The player fires `localechange` when\n * the words change.\n */\n message(id: keyof Messages): string | undefined;\n}\n\n/** The parent, or the host of the shadow root `node` sits in, or null at the document. */\nfunction above(node: Node): Node | null {\n const parent = node.parentNode;\n if (parent !== null) return parent;\n return node instanceof ShadowRoot ? node.host : null;\n}\n\n/**\n * The nearest player above `node`, through shadow hosts, or null outside\n * one. The element found may not be upgraded yet; the caller waits for the\n * definition before reading it.\n */\nexport function findPlayer(node: Node): HTMLElement | null {\n let current: Node | null = node;\n while (current !== null) {\n if (current instanceof HTMLElement && current.localName === PLAYER) return current;\n current = above(current);\n }\n return null;\n}\n"],"mappings":";;;AAqFA,SAAS,MAAM,MAAyB;CACtC,MAAM,SAAS,KAAK;CACpB,IAAI,WAAW,MAAM,OAAO;CAC5B,OAAO,gBAAgB,aAAa,KAAK,OAAO;AAClD;;;;;;AAOA,SAAgB,WAAW,MAAgC;CACzD,IAAI,UAAuB;CAC3B,OAAO,YAAY,MAAM;EACvB,IAAI,mBAAmB,eAAe,QAAQ,cAAA,mBAAsB,OAAO;EAC3E,UAAU,MAAM,OAAO;CACzB;CACA,OAAO;AACT"}
|
package/dist/ids.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ids for trackers: a new one for each session, and one per device that
|
|
3
|
+
* stays across visits. Built on `crypto.getRandomValues`, since
|
|
4
|
+
* `crypto.randomUUID` is newer than the TVs the player runs on.
|
|
5
|
+
*/
|
|
6
|
+
/** A random UUID, version 4 (RFC 9562 §5.4). */
|
|
7
|
+
export declare function sessionId(): string;
|
|
8
|
+
export interface DeviceIdOptions {
|
|
9
|
+
/** The storage key the id lives under. */
|
|
10
|
+
readonly key: string;
|
|
11
|
+
/** localStorage by default. */
|
|
12
|
+
readonly storage?: Pick<Storage, 'getItem' | 'setItem'>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The id stored under `key`, or a new one stored there. A browser that
|
|
16
|
+
* blocks storage gets a new id at each call.
|
|
17
|
+
*/
|
|
18
|
+
export declare function deviceId(options: DeviceIdOptions): string;
|
|
19
|
+
//# sourceMappingURL=ids.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ids.d.ts","sourceRoot":"","sources":["../src/ids.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,gDAAgD;AAChD,wBAAgB,SAAS,IAAI,MAAM,CAOlC;AAED,MAAM,WAAW,eAAe;IAC9B,0CAA0C;IAC1C,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,+BAA+B;IAC/B,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,SAAS,GAAG,SAAS,CAAC,CAAC;CACzD;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,CAgBzD"}
|
package/dist/ids.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// src/ids.ts
|
|
2
|
+
/**
|
|
3
|
+
* Ids for trackers: a new one for each session, and one per device that
|
|
4
|
+
* stays across visits. Built on `crypto.getRandomValues`, since
|
|
5
|
+
* `crypto.randomUUID` is newer than the TVs the player runs on.
|
|
6
|
+
*/
|
|
7
|
+
/** A random UUID, version 4 (RFC 9562 §5.4). */
|
|
8
|
+
function sessionId() {
|
|
9
|
+
const bytes = crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(16));
|
|
10
|
+
bytes[6] = bytes[6] & 15 | 64;
|
|
11
|
+
bytes[8] = bytes[8] & 63 | 128;
|
|
12
|
+
const hex = Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
13
|
+
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The id stored under `key`, or a new one stored there. A browser that
|
|
17
|
+
* blocks storage gets a new id at each call.
|
|
18
|
+
*/
|
|
19
|
+
function deviceId(options) {
|
|
20
|
+
let storage = null;
|
|
21
|
+
try {
|
|
22
|
+
storage = options.storage ?? window.localStorage;
|
|
23
|
+
const known = storage.getItem(options.key);
|
|
24
|
+
if (known !== null && known !== "") return known;
|
|
25
|
+
} catch {}
|
|
26
|
+
const id = sessionId();
|
|
27
|
+
try {
|
|
28
|
+
storage?.setItem(options.key, id);
|
|
29
|
+
} catch {}
|
|
30
|
+
return id;
|
|
31
|
+
}
|
|
32
|
+
export { deviceId, sessionId };
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=ids.js.map
|