@mattebox/player 0.1.0 → 0.3.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/README.md +4 -3
- package/dist/cdn/mattebox-player.min.js +222 -198
- package/dist/compose.d.ts +5 -0
- package/dist/compose.d.ts.map +1 -0
- package/dist/compose.js +31 -0
- package/dist/compose.js.map +1 -0
- package/dist/controls/chapters.d.ts +29 -0
- package/dist/controls/chapters.d.ts.map +1 -0
- package/dist/controls/chapters.js +81 -0
- package/dist/controls/chapters.js.map +1 -0
- package/dist/controls/cues.d.ts +8 -3
- package/dist/controls/cues.d.ts.map +1 -1
- package/dist/controls/cues.js +44 -10
- package/dist/controls/cues.js.map +1 -1
- package/dist/controls/fullscreen.d.ts +9 -9
- package/dist/controls/fullscreen.d.ts.map +1 -1
- package/dist/controls/fullscreen.js +17 -21
- package/dist/controls/fullscreen.js.map +1 -1
- package/dist/controls/icons.d.ts +1 -3
- package/dist/controls/icons.d.ts.map +1 -1
- package/dist/controls/icons.js +3 -6
- package/dist/controls/icons.js.map +1 -1
- package/dist/controls/menu.d.ts +14 -11
- package/dist/controls/menu.d.ts.map +1 -1
- package/dist/controls/menu.js +39 -34
- package/dist/controls/menu.js.map +1 -1
- package/dist/controls/session.d.ts +27 -0
- package/dist/controls/session.d.ts.map +1 -0
- package/dist/controls/session.js +36 -0
- package/dist/controls/session.js.map +1 -0
- package/dist/controls/slider.d.ts +6 -6
- package/dist/controls/slider.d.ts.map +1 -1
- package/dist/controls/slider.js +18 -13
- package/dist/controls/slider.js.map +1 -1
- package/dist/dom.d.ts +4 -10
- package/dist/dom.d.ts.map +1 -1
- package/dist/dom.js +4 -24
- package/dist/dom.js.map +1 -1
- package/dist/element-entry.d.ts +4 -0
- package/dist/element-entry.d.ts.map +1 -0
- package/dist/element-entry.js +9 -0
- package/dist/element-entry.js.map +1 -0
- package/dist/element.d.ts +54 -14
- package/dist/element.d.ts.map +1 -1
- package/dist/element.js +154 -73
- package/dist/element.js.map +1 -1
- package/dist/elements/audio-menu.d.ts +24 -0
- package/dist/elements/audio-menu.d.ts.map +1 -0
- package/dist/elements/audio-menu.js +70 -0
- package/dist/elements/audio-menu.js.map +1 -0
- package/dist/elements/chapters-menu.d.ts +12 -0
- package/dist/elements/chapters-menu.d.ts.map +1 -0
- package/dist/elements/chapters-menu.js +67 -0
- package/dist/elements/chapters-menu.js.map +1 -0
- package/dist/elements/component.d.ts +45 -0
- package/dist/elements/component.d.ts.map +1 -0
- package/dist/elements/component.js +90 -0
- package/dist/elements/component.js.map +1 -0
- package/dist/elements/control-bar.d.ts +75 -0
- package/dist/elements/control-bar.d.ts.map +1 -0
- package/dist/elements/control-bar.js +339 -0
- package/dist/elements/control-bar.js.map +1 -0
- package/dist/elements/current-time.d.ts +5 -0
- package/dist/elements/current-time.d.ts.map +1 -0
- package/dist/elements/current-time.js +27 -0
- package/dist/elements/current-time.js.map +1 -0
- package/dist/elements/drm-badge.d.ts +29 -0
- package/dist/elements/drm-badge.d.ts.map +1 -0
- package/dist/elements/drm-badge.js +145 -0
- package/dist/elements/drm-badge.js.map +1 -0
- package/dist/elements/duration.d.ts +6 -0
- package/dist/elements/duration.d.ts.map +1 -0
- package/dist/elements/duration.js +23 -0
- package/dist/elements/duration.js.map +1 -0
- package/dist/elements/error-screen.d.ts +17 -0
- package/dist/elements/error-screen.d.ts.map +1 -0
- package/dist/elements/error-screen.js +103 -0
- package/dist/elements/error-screen.js.map +1 -0
- package/dist/elements/fullscreen-button.d.ts +19 -0
- package/dist/elements/fullscreen-button.d.ts.map +1 -0
- package/dist/elements/fullscreen-button.js +55 -0
- package/dist/elements/fullscreen-button.js.map +1 -0
- package/dist/elements/live-button.d.ts +12 -0
- package/dist/elements/live-button.d.ts.map +1 -0
- package/dist/elements/live-button.js +96 -0
- package/dist/elements/live-button.js.map +1 -0
- package/dist/elements/menu-element.d.ts +22 -0
- package/dist/elements/menu-element.d.ts.map +1 -0
- package/dist/elements/menu-element.js +31 -0
- package/dist/elements/menu-element.js.map +1 -0
- package/dist/elements/mute-button.d.ts +12 -0
- package/dist/elements/mute-button.d.ts.map +1 -0
- package/dist/elements/mute-button.js +61 -0
- package/dist/elements/mute-button.js.map +1 -0
- package/dist/elements/panels.d.ts +15 -0
- package/dist/elements/panels.d.ts.map +1 -0
- package/dist/elements/panels.js +55 -0
- package/dist/elements/panels.js.map +1 -0
- package/dist/elements/pip-button.d.ts +13 -0
- package/dist/elements/pip-button.d.ts.map +1 -0
- package/dist/elements/pip-button.js +56 -0
- package/dist/elements/pip-button.js.map +1 -0
- package/dist/elements/play-button.d.ts +12 -0
- package/dist/elements/play-button.d.ts.map +1 -0
- package/dist/elements/play-button.js +60 -0
- package/dist/elements/play-button.js.map +1 -0
- package/dist/elements/quality-menu.d.ts +11 -0
- package/dist/elements/quality-menu.d.ts.map +1 -0
- package/dist/elements/quality-menu.js +72 -0
- package/dist/elements/quality-menu.js.map +1 -0
- package/dist/elements/remaining-time.d.ts +6 -0
- package/dist/elements/remaining-time.d.ts.map +1 -0
- package/dist/elements/remaining-time.js +26 -0
- package/dist/elements/remaining-time.js.map +1 -0
- package/dist/elements/seek-bar.d.ts +83 -0
- package/dist/elements/seek-bar.d.ts.map +1 -0
- package/dist/elements/seek-bar.js +352 -0
- package/dist/elements/seek-bar.js.map +1 -0
- package/dist/elements/shared.d.ts +27 -0
- package/dist/elements/shared.d.ts.map +1 -0
- package/dist/elements/shared.js +155 -0
- package/dist/elements/shared.js.map +1 -0
- package/dist/elements/skip-button.d.ts +14 -0
- package/dist/elements/skip-button.d.ts.map +1 -0
- package/dist/elements/skip-button.js +60 -0
- package/dist/elements/skip-button.js.map +1 -0
- package/dist/elements/spacer.d.ts +4 -0
- package/dist/elements/spacer.d.ts.map +1 -0
- package/dist/elements/spacer.js +9 -0
- package/dist/elements/spacer.js.map +1 -0
- package/dist/elements/speed-menu.d.ts +18 -0
- package/dist/elements/speed-menu.d.ts.map +1 -0
- package/dist/elements/speed-menu.js +56 -0
- package/dist/elements/speed-menu.js.map +1 -0
- package/dist/elements/start-button.d.ts +23 -0
- package/dist/elements/start-button.d.ts.map +1 -0
- package/dist/elements/start-button.js +120 -0
- package/dist/elements/start-button.js.map +1 -0
- package/dist/elements/subtitles-menu.d.ts +17 -0
- package/dist/elements/subtitles-menu.d.ts.map +1 -0
- package/dist/elements/subtitles-menu.js +108 -0
- package/dist/elements/subtitles-menu.js.map +1 -0
- package/dist/elements/time-element.d.ts +14 -0
- package/dist/elements/time-element.d.ts.map +1 -0
- package/dist/elements/time-element.js +29 -0
- package/dist/elements/time-element.js.map +1 -0
- package/dist/elements/volume-slider.d.ts +10 -0
- package/dist/elements/volume-slider.d.ts.map +1 -0
- package/dist/elements/volume-slider.js +46 -0
- package/dist/elements/volume-slider.js.map +1 -0
- package/dist/elements/volume.d.ts +9 -0
- package/dist/elements/volume.d.ts.map +1 -0
- package/dist/elements/volume.js +52 -0
- package/dist/elements/volume.js.map +1 -0
- package/dist/entries/audio-menu.d.ts +5 -0
- package/dist/entries/audio-menu.d.ts.map +1 -0
- package/dist/entries/audio-menu.js +8 -0
- package/dist/entries/audio-menu.js.map +1 -0
- package/dist/entries/chapters-menu.d.ts +5 -0
- package/dist/entries/chapters-menu.d.ts.map +1 -0
- package/dist/entries/chapters-menu.js +9 -0
- package/dist/entries/chapters-menu.js.map +1 -0
- package/dist/entries/control-bar.d.ts +5 -0
- package/dist/entries/control-bar.d.ts.map +1 -0
- package/dist/entries/control-bar.js +8 -0
- package/dist/entries/control-bar.js.map +1 -0
- package/dist/entries/current-time.d.ts +5 -0
- package/dist/entries/current-time.d.ts.map +1 -0
- package/dist/entries/current-time.js +8 -0
- package/dist/entries/current-time.js.map +1 -0
- package/dist/entries/drm-badge.d.ts +5 -0
- package/dist/entries/drm-badge.d.ts.map +1 -0
- package/dist/entries/drm-badge.js +8 -0
- package/dist/entries/drm-badge.js.map +1 -0
- package/dist/entries/duration.d.ts +5 -0
- package/dist/entries/duration.d.ts.map +1 -0
- package/dist/entries/duration.js +8 -0
- package/dist/entries/duration.js.map +1 -0
- package/dist/entries/error-screen.d.ts +5 -0
- package/dist/entries/error-screen.d.ts.map +1 -0
- package/dist/entries/error-screen.js +8 -0
- package/dist/entries/error-screen.js.map +1 -0
- package/dist/entries/fullscreen-button.d.ts +5 -0
- package/dist/entries/fullscreen-button.d.ts.map +1 -0
- package/dist/entries/fullscreen-button.js +8 -0
- package/dist/entries/fullscreen-button.js.map +1 -0
- package/dist/entries/live-button.d.ts +5 -0
- package/dist/entries/live-button.d.ts.map +1 -0
- package/dist/entries/live-button.js +8 -0
- package/dist/entries/live-button.js.map +1 -0
- package/dist/entries/mute-button.d.ts +5 -0
- package/dist/entries/mute-button.d.ts.map +1 -0
- package/dist/entries/mute-button.js +8 -0
- package/dist/entries/mute-button.js.map +1 -0
- package/dist/entries/panels.d.ts +5 -0
- package/dist/entries/panels.d.ts.map +1 -0
- package/dist/entries/panels.js +8 -0
- package/dist/entries/panels.js.map +1 -0
- package/dist/entries/pip-button.d.ts +5 -0
- package/dist/entries/pip-button.d.ts.map +1 -0
- package/dist/entries/pip-button.js +8 -0
- package/dist/entries/pip-button.js.map +1 -0
- package/dist/entries/play-button.d.ts +5 -0
- package/dist/entries/play-button.d.ts.map +1 -0
- package/dist/entries/play-button.js +8 -0
- package/dist/entries/play-button.js.map +1 -0
- package/dist/entries/quality-menu.d.ts +5 -0
- package/dist/entries/quality-menu.d.ts.map +1 -0
- package/dist/entries/quality-menu.js +8 -0
- package/dist/entries/quality-menu.js.map +1 -0
- package/dist/entries/remaining-time.d.ts +5 -0
- package/dist/entries/remaining-time.d.ts.map +1 -0
- package/dist/entries/remaining-time.js +9 -0
- package/dist/entries/remaining-time.js.map +1 -0
- package/dist/entries/seek-bar.d.ts +5 -0
- package/dist/entries/seek-bar.d.ts.map +1 -0
- package/dist/entries/seek-bar.js +8 -0
- package/dist/entries/seek-bar.js.map +1 -0
- package/dist/entries/skip-button.d.ts +5 -0
- package/dist/entries/skip-button.d.ts.map +1 -0
- package/dist/entries/skip-button.js +8 -0
- package/dist/entries/skip-button.js.map +1 -0
- package/dist/entries/spacer.d.ts +5 -0
- package/dist/entries/spacer.d.ts.map +1 -0
- package/dist/entries/spacer.js +8 -0
- package/dist/entries/spacer.js.map +1 -0
- package/dist/entries/speed-menu.d.ts +5 -0
- package/dist/entries/speed-menu.d.ts.map +1 -0
- package/dist/entries/speed-menu.js +8 -0
- package/dist/entries/speed-menu.js.map +1 -0
- package/dist/entries/start-button.d.ts +5 -0
- package/dist/entries/start-button.d.ts.map +1 -0
- package/dist/entries/start-button.js +8 -0
- package/dist/entries/start-button.js.map +1 -0
- package/dist/entries/subtitles-menu.d.ts +5 -0
- package/dist/entries/subtitles-menu.d.ts.map +1 -0
- package/dist/entries/subtitles-menu.js +8 -0
- package/dist/entries/subtitles-menu.js.map +1 -0
- package/dist/entries/volume-slider.d.ts +5 -0
- package/dist/entries/volume-slider.d.ts.map +1 -0
- package/dist/entries/volume-slider.js +8 -0
- package/dist/entries/volume-slider.js.map +1 -0
- package/dist/entries/volume.d.ts +7 -0
- package/dist/entries/volume.d.ts.map +1 -0
- package/dist/entries/volume.js +10 -0
- package/dist/entries/volume.js.map +1 -0
- package/dist/es2015/compose.js +33 -0
- package/dist/es2015/controls/chapters.js +61 -0
- package/dist/es2015/controls/cues.js +39 -11
- package/dist/es2015/controls/fullscreen.js +25 -23
- package/dist/es2015/controls/icons.js +5 -9
- package/dist/es2015/controls/menu.js +39 -35
- package/dist/es2015/controls/session.js +40 -0
- package/dist/es2015/controls/slider.js +18 -13
- package/dist/es2015/controls/time.js +1 -5
- package/dist/es2015/dom.js +5 -25
- package/dist/es2015/element-entry.js +10 -0
- package/dist/es2015/element.js +118 -65
- package/dist/es2015/elements/audio-menu.js +68 -0
- package/dist/es2015/elements/chapters-menu.js +68 -0
- package/dist/es2015/elements/component.js +85 -0
- package/dist/es2015/elements/control-bar.js +299 -0
- package/dist/es2015/elements/current-time.js +27 -0
- package/dist/es2015/elements/drm-badge.js +138 -0
- package/dist/es2015/elements/duration.js +23 -0
- package/dist/es2015/elements/error-screen.js +97 -0
- package/dist/es2015/elements/fullscreen-button.js +49 -0
- package/dist/es2015/elements/live-button.js +97 -0
- package/dist/es2015/elements/menu-element.js +39 -0
- package/dist/es2015/elements/mute-button.js +60 -0
- package/dist/es2015/elements/panels.js +52 -0
- package/dist/es2015/elements/pip-button.js +56 -0
- package/dist/es2015/elements/play-button.js +68 -0
- package/dist/es2015/elements/quality-menu.js +68 -0
- package/dist/es2015/elements/remaining-time.js +26 -0
- package/dist/es2015/elements/seek-bar.js +314 -0
- package/dist/es2015/elements/shared.js +155 -0
- package/dist/es2015/elements/skip-button.js +59 -0
- package/dist/es2015/elements/spacer.js +11 -0
- package/dist/es2015/elements/speed-menu.js +60 -0
- package/dist/es2015/elements/start-button.js +124 -0
- package/dist/es2015/elements/subtitles-menu.js +103 -0
- package/dist/es2015/elements/time-element.js +38 -0
- package/dist/es2015/elements/volume-slider.js +47 -0
- package/dist/es2015/elements/volume.js +52 -0
- package/dist/es2015/entries/audio-menu.js +7 -0
- package/dist/es2015/entries/chapters-menu.js +7 -0
- package/dist/es2015/entries/control-bar.js +7 -0
- package/dist/es2015/entries/current-time.js +7 -0
- package/dist/es2015/entries/drm-badge.js +7 -0
- package/dist/es2015/entries/duration.js +7 -0
- package/dist/es2015/entries/error-screen.js +7 -0
- package/dist/es2015/entries/fullscreen-button.js +7 -0
- package/dist/es2015/entries/live-button.js +7 -0
- package/dist/es2015/entries/mute-button.js +7 -0
- package/dist/es2015/entries/panels.js +7 -0
- package/dist/es2015/entries/pip-button.js +7 -0
- package/dist/es2015/entries/play-button.js +7 -0
- package/dist/es2015/entries/quality-menu.js +7 -0
- package/dist/es2015/entries/remaining-time.js +7 -0
- package/dist/es2015/entries/seek-bar.js +7 -0
- package/dist/es2015/entries/skip-button.js +7 -0
- package/dist/es2015/entries/spacer.js +7 -0
- package/dist/es2015/entries/speed-menu.js +7 -0
- package/dist/es2015/entries/start-button.js +7 -0
- package/dist/es2015/entries/subtitles-menu.js +7 -0
- package/dist/es2015/entries/volume-slider.js +7 -0
- package/dist/es2015/entries/volume.js +9 -0
- package/dist/es2015/host.js +23 -0
- package/dist/es2015/index.js +48 -9
- package/dist/es2015/labels.js +14 -0
- package/dist/es2015/style.js +40 -292
- package/dist/es2015/{panels/error.js → surface.js} +3 -3
- package/dist/es2015/tags.js +28 -0
- package/dist/host.d.ts +26 -0
- package/dist/host.d.ts.map +1 -0
- package/dist/host.js +23 -0
- package/dist/host.js.map +1 -0
- package/dist/index.d.ts +84 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +24 -8
- package/dist/index.js.map +1 -1
- package/dist/labels.d.ts +7 -0
- package/dist/labels.d.ts.map +1 -0
- package/dist/labels.js +12 -0
- package/dist/labels.js.map +1 -0
- package/dist/style.d.ts +10 -2
- package/dist/style.d.ts.map +1 -1
- package/dist/style.js +40 -292
- package/dist/style.js.map +1 -1
- package/dist/surface.d.ts +15 -0
- package/dist/surface.d.ts.map +1 -0
- package/dist/{panels/error.js → surface.js} +3 -3
- package/dist/surface.js.map +1 -0
- package/dist/tags.d.ts +26 -0
- package/dist/tags.d.ts.map +1 -0
- package/dist/tags.js +26 -0
- package/dist/tags.js.map +1 -0
- package/package.json +22 -2
- package/dist/controls/bar.d.ts +0 -56
- package/dist/controls/bar.d.ts.map +0 -1
- package/dist/controls/bar.js +0 -245
- package/dist/controls/bar.js.map +0 -1
- package/dist/controls/buttons.d.ts +0 -13
- package/dist/controls/buttons.d.ts.map +0 -1
- package/dist/controls/buttons.js +0 -157
- package/dist/controls/buttons.js.map +0 -1
- package/dist/controls/control.d.ts +0 -12
- package/dist/controls/control.d.ts.map +0 -1
- package/dist/controls/control.js +0 -2
- package/dist/controls/control.js.map +0 -1
- package/dist/controls/keys.d.ts +0 -26
- package/dist/controls/keys.d.ts.map +0 -1
- package/dist/controls/keys.js +0 -66
- package/dist/controls/keys.js.map +0 -1
- package/dist/controls/live.d.ts +0 -10
- package/dist/controls/live.d.ts.map +0 -1
- package/dist/controls/live.js +0 -59
- package/dist/controls/live.js.map +0 -1
- package/dist/controls/menus.d.ts +0 -43
- package/dist/controls/menus.d.ts.map +0 -1
- package/dist/controls/menus.js +0 -262
- package/dist/controls/menus.js.map +0 -1
- package/dist/controls/options.d.ts +0 -44
- package/dist/controls/options.d.ts.map +0 -1
- package/dist/controls/options.js +0 -54
- package/dist/controls/options.js.map +0 -1
- package/dist/controls/screens.d.ts +0 -22
- package/dist/controls/screens.d.ts.map +0 -1
- package/dist/controls/screens.js +0 -69
- package/dist/controls/screens.js.map +0 -1
- package/dist/controls/seek.d.ts +0 -52
- package/dist/controls/seek.d.ts.map +0 -1
- package/dist/controls/seek.js +0 -215
- package/dist/controls/seek.js.map +0 -1
- package/dist/controls/speed.d.ts +0 -8
- package/dist/controls/speed.d.ts.map +0 -1
- package/dist/controls/speed.js +0 -34
- package/dist/controls/speed.js.map +0 -1
- package/dist/controls/volume.d.ts +0 -8
- package/dist/controls/volume.d.ts.map +0 -1
- package/dist/controls/volume.js +0 -29
- package/dist/controls/volume.js.map +0 -1
- package/dist/es2015/controls/bar.js +0 -227
- package/dist/es2015/controls/buttons.js +0 -146
- package/dist/es2015/controls/keys.js +0 -60
- package/dist/es2015/controls/live.js +0 -60
- package/dist/es2015/controls/menus.js +0 -258
- package/dist/es2015/controls/options.js +0 -46
- package/dist/es2015/controls/screens.js +0 -74
- package/dist/es2015/controls/seek.js +0 -203
- package/dist/es2015/controls/speed.js +0 -41
- package/dist/es2015/controls/volume.js +0 -30
- package/dist/es2015/panels/drm.js +0 -29
- package/dist/es2015/panels/live.js +0 -48
- package/dist/es2015/panels/quality.js +0 -52
- package/dist/es2015/panels/tracks.js +0 -47
- package/dist/panels/drm.d.ts +0 -8
- package/dist/panels/drm.d.ts.map +0 -1
- package/dist/panels/drm.js +0 -36
- package/dist/panels/drm.js.map +0 -1
- package/dist/panels/error.d.ts +0 -13
- package/dist/panels/error.d.ts.map +0 -1
- package/dist/panels/error.js.map +0 -1
- package/dist/panels/live.d.ts +0 -3
- package/dist/panels/live.d.ts.map +0 -1
- package/dist/panels/live.js +0 -56
- package/dist/panels/live.js.map +0 -1
- package/dist/panels/panel.d.ts +0 -13
- package/dist/panels/panel.d.ts.map +0 -1
- package/dist/panels/panel.js +0 -2
- package/dist/panels/panel.js.map +0 -1
- package/dist/panels/quality.d.ts +0 -3
- package/dist/panels/quality.d.ts.map +0 -1
- package/dist/panels/quality.js +0 -59
- package/dist/panels/quality.js.map +0 -1
- package/dist/panels/tracks.d.ts +0 -3
- package/dist/panels/tracks.d.ts.map +0 -1
- package/dist/panels/tracks.js +0 -49
- package/dist/panels/tracks.js.map +0 -1
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { el } from '../dom.js';
|
|
2
|
+
import { Component } from './component.js';
|
|
3
|
+
import { style } from './shared.js';
|
|
4
|
+
const STYLE = `
|
|
5
|
+
:host {
|
|
6
|
+
position: absolute;
|
|
7
|
+
inset: 0;
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
padding: 16px;
|
|
12
|
+
background: rgba(0, 0, 0, 0.75);
|
|
13
|
+
color: var(--mbx-text);
|
|
14
|
+
font: 400 15px/1.4 var(--mbx-font);
|
|
15
|
+
text-align: center;
|
|
16
|
+
}
|
|
17
|
+
:host([hidden]) { display: none; }
|
|
18
|
+
[part~="box"] { display: flex; flex-direction: column; align-items: center; gap: 8px; }
|
|
19
|
+
[part~="title"] { font-size: 18px; font-weight: 600; }
|
|
20
|
+
[part~="detail"] { font-family: monospace; font-size: 13px; color: var(--mbx-error); }
|
|
21
|
+
[part~="retry"] {
|
|
22
|
+
height: 36px;
|
|
23
|
+
padding: 0 16px;
|
|
24
|
+
font: inherit;
|
|
25
|
+
font-weight: 600;
|
|
26
|
+
color: inherit;
|
|
27
|
+
background: transparent;
|
|
28
|
+
border: 1px solid currentColor;
|
|
29
|
+
border-radius: var(--mbx-radius);
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
}
|
|
32
|
+
[part~="retry"]:focus-visible { outline: 2px solid var(--mbx-accent); outline-offset: -2px; }
|
|
33
|
+
`;
|
|
34
|
+
export class MbxErrorScreen extends Component {
|
|
35
|
+
static get observedAttributes() {
|
|
36
|
+
return ['label-title', 'label-retry'];
|
|
37
|
+
}
|
|
38
|
+
constructor() {
|
|
39
|
+
super();
|
|
40
|
+
const root = this.attachShadow({ mode: 'open' });
|
|
41
|
+
const box = el('div', 'box');
|
|
42
|
+
this.title_ = el('div', 'title');
|
|
43
|
+
this.category = el('span', 'category');
|
|
44
|
+
this.code = el('span', 'code');
|
|
45
|
+
const detail = el('div', 'detail');
|
|
46
|
+
detail.append(this.category, el('span', 'separator', ' · '), this.code);
|
|
47
|
+
this.retry = el('button', 'retry');
|
|
48
|
+
this.retry.type = 'button';
|
|
49
|
+
this.retry.addEventListener('click', () => {
|
|
50
|
+
const player = this.player;
|
|
51
|
+
const src = player?.getAttribute('src');
|
|
52
|
+
if (player !== null && player !== undefined && src !== null && src !== undefined) {
|
|
53
|
+
player.setAttribute('src', src);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
box.append(this.title_, detail, this.retry);
|
|
57
|
+
root.append(style(STYLE), box);
|
|
58
|
+
}
|
|
59
|
+
/** Hidden and named before attaching: a constructor must not add attributes. */
|
|
60
|
+
connectedCallback() {
|
|
61
|
+
if (this.player === null)
|
|
62
|
+
this.hidden = true;
|
|
63
|
+
if (!this.hasAttribute('role'))
|
|
64
|
+
this.setAttribute('role', 'alert');
|
|
65
|
+
super.connectedCallback();
|
|
66
|
+
}
|
|
67
|
+
show(error) {
|
|
68
|
+
this.category.textContent = error.category;
|
|
69
|
+
this.code.textContent = error.code;
|
|
70
|
+
this.hidden = false;
|
|
71
|
+
}
|
|
72
|
+
attach(player) {
|
|
73
|
+
const failure = (event) => {
|
|
74
|
+
const error = event.detail;
|
|
75
|
+
if (error.fatal)
|
|
76
|
+
this.show(error);
|
|
77
|
+
};
|
|
78
|
+
player.addEventListener('error', failure);
|
|
79
|
+
this.keep(() => {
|
|
80
|
+
player.removeEventListener('error', failure);
|
|
81
|
+
});
|
|
82
|
+
// Not `emptied`: the old session's teardown fires it after the new
|
|
83
|
+
// source's error, and would hide the error it should leave.
|
|
84
|
+
this.listen(player.video, ['playing', 'loadstart'], () => {
|
|
85
|
+
this.hidden = true;
|
|
86
|
+
});
|
|
87
|
+
this.listen(player, ['sourcechange'], () => {
|
|
88
|
+
this.hidden = true;
|
|
89
|
+
});
|
|
90
|
+
// The error may have come before this element did.
|
|
91
|
+
if (player.error !== null)
|
|
92
|
+
this.show(player.error);
|
|
93
|
+
this.render();
|
|
94
|
+
}
|
|
95
|
+
detach() {
|
|
96
|
+
this.hidden = true;
|
|
97
|
+
}
|
|
98
|
+
render() {
|
|
99
|
+
this.title_.textContent = this.getAttribute('label-title') ?? 'Playback failed';
|
|
100
|
+
this.retry.textContent = this.getAttribute('label-retry') ?? 'Retry';
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=error-screen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-screen.js","sourceRoot":"","sources":["../../src/elements/error-screen.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AAE/B,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,MAAM,KAAK,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6Bb,CAAC;AAEF,MAAM,OAAO,cAAe,SAAQ,SAAS;IAC3C,MAAM,KAAK,kBAAkB;QAC3B,OAAO,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;IACxC,CAAC;IAOD;QACE,KAAK,EAAE,CAAC;QACR,MAAM,IAAI,GAAG,IAAI,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AC,MAAM,GAAG,IAAI,CAAC;QACrB,CAAC,CAAC,CAAC;QACH,mDAAmD;QACnD,IAAI,MAAM,CAAC,KAAK,KAAK,IAAI;YAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACnD,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;IAEkB,MAAM;QACvB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;IACrB,CAAC;IAEkB,MAAM;QACvB,IAAI,CAAC,MAAM,CAAC,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,IAAI,iBAAiB,CAAC;QAChF,IAAI,CAAC,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,IAAI,OAAO,CAAC;IACvE,CAAC;CACF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* <mbx-fullscreen-button>: fullscreen on the player, through whichever
|
|
3
|
+
* API the browser has, and hidden where there is none. The glyph is
|
|
4
|
+
* `icon-enter` or `icon-exit`, the name `label-enter` or `label-exit`,
|
|
5
|
+
* and the element sets `fullscreen` on the player while it is in.
|
|
6
|
+
*/
|
|
7
|
+
import type { PlayerHost } from '../host.js';
|
|
8
|
+
import { Component } from './component.js';
|
|
9
|
+
export declare class MbxFullscreenButton extends Component {
|
|
10
|
+
static get observedAttributes(): readonly string[];
|
|
11
|
+
private readonly button;
|
|
12
|
+
private readonly slots;
|
|
13
|
+
private api;
|
|
14
|
+
constructor();
|
|
15
|
+
protected attach(player: PlayerHost): void;
|
|
16
|
+
protected detach(): void;
|
|
17
|
+
protected render(): void;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=fullscreen-button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fullscreen-button.d.ts","sourceRoot":"","sources":["../../src/elements/fullscreen-button.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAM3C,qBAAa,mBAAoB,SAAQ,SAAS;IAChD,MAAM,KAAK,kBAAkB,IAAI,SAAS,MAAM,EAAE,CAEjD;IAED,iBAAyB,MAAM,CAAoB;IACnD,iBAAyB,KAAK,CAAiC;IAC/D,QAAgB,GAAG,CAAoB;;cAmBpB,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI;cAYhC,MAAM,IAAI,IAAI;cAId,MAAM,IAAI,IAAI;CAalC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* <mbx-fullscreen-button>: fullscreen on the player, through whichever
|
|
3
|
+
* API the browser has, and hidden where there is none. The glyph is
|
|
4
|
+
* `icon-enter` or `icon-exit`, the name `label-enter` or `label-exit`,
|
|
5
|
+
* and the element sets `fullscreen` on the player while it is in.
|
|
6
|
+
*/
|
|
7
|
+
import { fullscreen } from '../controls/fullscreen.js';
|
|
8
|
+
import { icon } from '../controls/icons.js';
|
|
9
|
+
import { Component } from './component.js';
|
|
10
|
+
import { BUTTON_STYLE, iconSlots, show, style } from './shared.js';
|
|
11
|
+
const STATES = ['enter', 'exit'];
|
|
12
|
+
export class MbxFullscreenButton extends Component {
|
|
13
|
+
static get observedAttributes() {
|
|
14
|
+
return ['label-enter', 'label-exit'];
|
|
15
|
+
}
|
|
16
|
+
constructor() {
|
|
17
|
+
super();
|
|
18
|
+
this.api = null;
|
|
19
|
+
const root = this.attachShadow({ mode: 'open' });
|
|
20
|
+
this.button = document.createElement('button');
|
|
21
|
+
this.button.type = 'button';
|
|
22
|
+
this.button.setAttribute('part', 'button');
|
|
23
|
+
this.slots = iconSlots(STATES, (state) => icon(state === 'enter' ? 'fullscreen' : 'fullscreen-exit'));
|
|
24
|
+
for (const state of STATES)
|
|
25
|
+
this.button.append(this.slots[state]);
|
|
26
|
+
this.button.addEventListener('click', () => {
|
|
27
|
+
this.api?.toggle();
|
|
28
|
+
});
|
|
29
|
+
root.append(style(BUTTON_STYLE), this.button);
|
|
30
|
+
}
|
|
31
|
+
attach(player) {
|
|
32
|
+
const api = fullscreen(player, player.video);
|
|
33
|
+
this.api = api;
|
|
34
|
+
this.hidden = !api.supported;
|
|
35
|
+
this.keep(api.watch(() => {
|
|
36
|
+
this.render();
|
|
37
|
+
}));
|
|
38
|
+
this.render();
|
|
39
|
+
}
|
|
40
|
+
detach() {
|
|
41
|
+
this.api = null;
|
|
42
|
+
}
|
|
43
|
+
render() {
|
|
44
|
+
const player = this.player;
|
|
45
|
+
if (player === null || this.api === null)
|
|
46
|
+
return;
|
|
47
|
+
const active = this.api.active();
|
|
48
|
+
show(this.slots, active ? 'exit' : 'enter');
|
|
49
|
+
this.button.setAttribute('aria-label', active
|
|
50
|
+
? (this.getAttribute('label-exit') ?? 'Exit fullscreen')
|
|
51
|
+
: (this.getAttribute('label-enter') ?? 'Enter fullscreen'));
|
|
52
|
+
player.toggleAttribute('fullscreen', active);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=fullscreen-button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fullscreen-button.js","sourceRoot":"","sources":["../../src/elements/fullscreen-button.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAE5C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGnE,MAAM,MAAM,GAAqB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AAEnD,MAAM,OAAO,mBAAoB,SAAQ,SAAS;IAChD,MAAM,KAAK,kBAAkB;QAC3B,OAAO,C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,EAAE;YACb,IAAI,CAAC,MAAM,EAAE,CAAC;QAChB,CAAC,CAAC,CACH,CAAC;QACF,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;IAEkB,MAAM;QACvB,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC;IAClB,CAAC;IAEkB,MAAM;QACvB,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC3B,IAAI,MAAM,KAAK,IAAI,IAAI,IAAI,CAAC,GAAG,KAAK,IAAI;YAAE,OAAO;QACjD,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;QACjC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QAC5C,IAAI,CAAC,MAAM,CAAC,YAAY,CACtB,YAAY,EACZ,MAAM;YACJ,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,IAAI,iBAAiB,CAAC;YACxD,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,IAAI,kBAAkB,CAAC,CAC7D,CAAC;QACF,MAAM,CAAC,eAAe,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IAC/C,CAAC;CACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PlayerHost } from '../host.js';
|
|
2
|
+
import { Component } from './component.js';
|
|
3
|
+
export declare class MbxLiveButton extends Component {
|
|
4
|
+
static get observedAttributes(): readonly string[];
|
|
5
|
+
private readonly button;
|
|
6
|
+
private readonly text;
|
|
7
|
+
constructor();
|
|
8
|
+
connectedCallback(): void;
|
|
9
|
+
protected attach(player: PlayerHost): void;
|
|
10
|
+
protected render(): void;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=live-button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"live-button.d.ts","sourceRoot":"","sources":["../../src/elements/live-button.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAiC3C,qBAAa,aAAc,SAAQ,SAAS;IAC1C,MAAM,KAAK,kBAAkB,IAAI,SAAS,MAAM,EAAE,CAEjD;IAED,iBAAyB,MAAM,CAAoB;IACnD,iBAAyB,IAAI,CAAc;;IAelC,iBAAiB,IAAI,IAAI;cAKf,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI;cAUhC,MAAM,IAAI,IAAI;CAoBlC"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* <mbx-live-button>: a dot and the word, the dot red at the edge and grey
|
|
3
|
+
* behind it, the way viewers read it everywhere. Shown once the stream has
|
|
4
|
+
* an availability window, which is what makes it live; disabled at the
|
|
5
|
+
* edge, where there is nowhere to go; a click seeks to the edge, the one
|
|
6
|
+
* engine write the row makes. The element carries `at-edge` meanwhile.
|
|
7
|
+
*
|
|
8
|
+
* Without a seek bar, when the player says the stream is not seekable,
|
|
9
|
+
* there is nowhere to come back from either: the dot stays red and the
|
|
10
|
+
* button stays inert, whatever the playhead does. The word comes from
|
|
11
|
+
* `text`, the name from `label-live` and `label-at-edge`. It sits in the
|
|
12
|
+
* bar's seek row unless the page says otherwise.
|
|
13
|
+
*/
|
|
14
|
+
import { live } from '../controls/session.js';
|
|
15
|
+
import { el } from '../dom.js';
|
|
16
|
+
import { Component } from './component.js';
|
|
17
|
+
import { seekRow, style } from './shared.js';
|
|
18
|
+
const STYLE = `
|
|
19
|
+
:host { display: inline-flex; }
|
|
20
|
+
:host([hidden]) { display: none; }
|
|
21
|
+
[part~="button"] {
|
|
22
|
+
display: inline-flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
gap: 6px;
|
|
25
|
+
height: 40px;
|
|
26
|
+
padding: 0 8px;
|
|
27
|
+
font: inherit;
|
|
28
|
+
font-size: 12px;
|
|
29
|
+
font-weight: 700;
|
|
30
|
+
letter-spacing: 0.06em;
|
|
31
|
+
color: inherit;
|
|
32
|
+
background: transparent;
|
|
33
|
+
border: 0;
|
|
34
|
+
border-radius: var(--mbx-radius);
|
|
35
|
+
cursor: pointer;
|
|
36
|
+
opacity: 0.9;
|
|
37
|
+
}
|
|
38
|
+
[part~="button"]:hover { opacity: 1; }
|
|
39
|
+
[part~="button"]:disabled { cursor: default; opacity: 1; }
|
|
40
|
+
[part~="button"]:focus-visible { outline: 2px solid var(--mbx-accent); outline-offset: -2px; }
|
|
41
|
+
[part~="dot"] { width: 10px; height: 10px; border-radius: 50%; background: var(--mbx-muted); transition: background 0.2s; }
|
|
42
|
+
:host([at-edge]) [part~="dot"] { background: var(--mbx-live); box-shadow: 0 0 6px var(--mbx-live); }
|
|
43
|
+
@media (prefers-reduced-motion: reduce) {
|
|
44
|
+
[part~="dot"] { transition: none; }
|
|
45
|
+
}
|
|
46
|
+
`;
|
|
47
|
+
export class MbxLiveButton extends Component {
|
|
48
|
+
static get observedAttributes() {
|
|
49
|
+
return ['text', 'label-live', 'label-at-edge'];
|
|
50
|
+
}
|
|
51
|
+
constructor() {
|
|
52
|
+
super();
|
|
53
|
+
const root = this.attachShadow({ mode: 'open' });
|
|
54
|
+
this.button = el('button', 'button');
|
|
55
|
+
this.button.type = 'button';
|
|
56
|
+
this.text = el('span', 'text');
|
|
57
|
+
this.button.append(el('span', 'dot'), this.text);
|
|
58
|
+
this.button.addEventListener('click', () => {
|
|
59
|
+
live(this.player?.engine ?? null)?.seekToEdge();
|
|
60
|
+
});
|
|
61
|
+
root.append(style(STYLE), this.button);
|
|
62
|
+
}
|
|
63
|
+
connectedCallback() {
|
|
64
|
+
seekRow(this);
|
|
65
|
+
super.connectedCallback();
|
|
66
|
+
}
|
|
67
|
+
attach(player) {
|
|
68
|
+
const tick = () => {
|
|
69
|
+
this.render();
|
|
70
|
+
};
|
|
71
|
+
this.listen(player.video, ['timeupdate', 'emptied'], tick);
|
|
72
|
+
this.listen(player, ['sourcechange'], tick);
|
|
73
|
+
this.observe(player, ['live', 'seekable'], tick);
|
|
74
|
+
this.render();
|
|
75
|
+
}
|
|
76
|
+
render() {
|
|
77
|
+
const player = this.player;
|
|
78
|
+
if (player === null)
|
|
79
|
+
return;
|
|
80
|
+
const api = live(player.engine);
|
|
81
|
+
this.hidden = api === undefined;
|
|
82
|
+
this.text.textContent = this.getAttribute('text') ?? 'LIVE';
|
|
83
|
+
if (api === undefined)
|
|
84
|
+
return;
|
|
85
|
+
// The seek bar decides seekability; while the player says live and not
|
|
86
|
+
// seekable there is no bar to come back from.
|
|
87
|
+
const stuck = player.hasAttribute('live') && !player.hasAttribute('seekable');
|
|
88
|
+
const atEdge = stuck || api.atEdge;
|
|
89
|
+
this.button.disabled = atEdge;
|
|
90
|
+
this.toggleAttribute('at-edge', atEdge);
|
|
91
|
+
this.button.setAttribute('aria-label', atEdge
|
|
92
|
+
? (this.getAttribute('label-at-edge') ?? 'At the live edge')
|
|
93
|
+
: (this.getAttribute('label-live') ?? 'Go to the live edge'));
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=live-button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"live-button.js","sourceRoot":"","sources":["../../src/elements/live-button.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AAE/B,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,KAAK,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4Bb,CAAC;AAEF,MAAM,OAAO,aAAc,SAAQ,SAAS;IAC1C,MAAM,KAAK,kBAAkB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,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE,IAAI,CAAC,CAAC;QACjD,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;IAEkB,MAAM;QACvB,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC3B,IAAI,MAAM,KAAK,IAAI;YAAE,OAAO;QAC5B,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAChC,IAAI,CAAC,MAAM,GAAG,GAAG,KAAK,SAAS,CAAC;QAChC,IAAI,CAAC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC;QAC5D,IAAI,GAAG,KAAK,SAAS;YAAE,OAAO;QAC9B,uEAAuE;QACvE,8CAA8C;QAC9C,MAAM,KAAK,GAAG,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;QAC9E,MAAM,MAAM,GAAG,KAAK,IAAI,GAAG,CAAC,MAAM,CAAC;QACnC,IAAI,CAAC,MAAM,CAAC,QAAQ,GAAG,MAAM,CAAC;QAC9B,IAAI,CAAC,eAAe,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QACxC,IAAI,CAAC,MAAM,CAAC,YAAY,CACtB,YAAY,EACZ,MAAM;YACJ,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,IAAI,kBAAkB,CAAC;YAC5D,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,IAAI,qBAAqB,CAAC,CAC/D,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the menus share: the primitive in the shadow root, the glyph slots
|
|
3
|
+
* on its button, the name from `label`, the Back item's name from
|
|
4
|
+
* `label-back`, and the popup fitted under the top of the picture. A
|
|
5
|
+
* subclass fills the entries in `render()`, which runs on attach, on every
|
|
6
|
+
* observed attribute, and whenever it asks.
|
|
7
|
+
*/
|
|
8
|
+
import type { IconName } from '../controls/icons.js';
|
|
9
|
+
import type { Menu } from '../controls/menu.js';
|
|
10
|
+
import { Component } from './component.js';
|
|
11
|
+
export declare abstract class MenuElement<S extends string = 'default'> extends Component {
|
|
12
|
+
protected readonly menu: Menu;
|
|
13
|
+
protected readonly slots: Record<S, HTMLSlotElement>;
|
|
14
|
+
constructor(states: readonly S[], glyphs: (state: S) => SVGSVGElement);
|
|
15
|
+
/** The default name of the button. */
|
|
16
|
+
protected abstract name(): string;
|
|
17
|
+
protected detach(): void;
|
|
18
|
+
protected render(): void;
|
|
19
|
+
}
|
|
20
|
+
/** A glyph that never changes, for a menu of one state. */
|
|
21
|
+
export declare function single(name: IconName): [readonly ['default'], () => SVGSVGElement];
|
|
22
|
+
//# sourceMappingURL=menu-element.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"menu-element.d.ts","sourceRoot":"","sources":["../../src/elements/menu-element.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAGhD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAG3C,8BAAsB,WAAW,CAAC,CAAC,SAAS,MAAM,GAAG,SAAS,CAAE,SAAQ,SAAS;IAC/E,mBAA2B,IAAI,EAAE,IAAI,CAAC;IACtC,mBAA2B,KAAK,EAAE,MAAM,CAAC,CAAC,EAAE,eAAe,CAAC,CAAC;gBAEjD,MAAM,EAAE,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,aAAa;IAarE,sCAAsC;IACtC,SAAS,CAAC,QAAQ,CAAC,IAAI,IAAI,MAAM;cAEd,MAAM,IAAI,IAAI;cAId,MAAM,IAAI,IAAI;CAGlC;AAED,2DAA2D;AAC3D,wBAAgB,MAAM,CAAC,IAAI,EAAE,QAAQ,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,MAAM,aAAa,CAAC,CAElF"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { icon } from '../controls/icons.js';
|
|
2
|
+
import { menu } from '../controls/menu.js';
|
|
3
|
+
import { fill } from '../labels.js';
|
|
4
|
+
import { Component } from './component.js';
|
|
5
|
+
import { iconSlots, MENU_STYLE, style } from './shared.js';
|
|
6
|
+
export class MenuElement extends Component {
|
|
7
|
+
constructor(states, glyphs) {
|
|
8
|
+
super();
|
|
9
|
+
const root = this.attachShadow({ mode: 'open' });
|
|
10
|
+
this.menu = menu({
|
|
11
|
+
host: this,
|
|
12
|
+
ceiling: () => this.player?.video.getBoundingClientRect().top ?? null,
|
|
13
|
+
back: (page) => fill(this.getAttribute('label-back') ?? 'Back from {page}', { page }),
|
|
14
|
+
});
|
|
15
|
+
this.slots = iconSlots(states, glyphs);
|
|
16
|
+
for (const state of states)
|
|
17
|
+
this.menu.button.append(this.slots[state]);
|
|
18
|
+
root.append(style(MENU_STYLE), this.menu.button, this.menu.popup);
|
|
19
|
+
}
|
|
20
|
+
detach() {
|
|
21
|
+
this.menu.close();
|
|
22
|
+
}
|
|
23
|
+
render() {
|
|
24
|
+
this.menu.label(this.getAttribute('label') ?? this.name());
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/** A glyph that never changes, for a menu of one state. */
|
|
28
|
+
export function single(name) {
|
|
29
|
+
return [['default'], () => icon(name)];
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=menu-element.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"menu-element.js","sourceRoot":"","sources":["../../src/elements/menu-element.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAE5C,O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CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IAC7D,CAAC;CACF;AAED,2DAA2D;AAC3D,MAAM,UAAU,MAAM,CAAC,IAAc;IACnC,OAAO,CAAC,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PlayerHost } from '../host.js';
|
|
2
|
+
import { Component } from './component.js';
|
|
3
|
+
export declare class MbxMuteButton extends Component {
|
|
4
|
+
static get observedAttributes(): readonly string[];
|
|
5
|
+
private readonly button;
|
|
6
|
+
private readonly slots;
|
|
7
|
+
constructor();
|
|
8
|
+
private toggle;
|
|
9
|
+
protected attach(player: PlayerHost): void;
|
|
10
|
+
protected render(): void;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=mute-button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mute-button.d.ts","sourceRoot":"","sources":["../../src/elements/mute-button.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAM3C,qBAAa,aAAc,SAAQ,SAAS;IAC1C,MAAM,KAAK,kBAAkB,IAAI,SAAS,MAAM,EAAE,CAEjD;IAED,iBAAyB,MAAM,CAAoB;IACnD,iBAAyB,KAAK,CAAiC;;IAkB/D,OAAO,CAAC,MAAM;cAWK,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI;cAOhC,MAAM,IAAI,IAAI;CAalC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* <mbx-mute-button>: mute and unmute, with the level drawn in the glyph:
|
|
3
|
+
* `icon-mute` while muted or at zero, `icon-low` up to half, `icon-high`
|
|
4
|
+
* above. Unmuting at zero volume would change nothing the viewer can
|
|
5
|
+
* hear, so it brings the volume up too. The name comes from `label-mute`
|
|
6
|
+
* and `label-unmute`, and `aria-pressed` says which state it is in.
|
|
7
|
+
*/
|
|
8
|
+
import { icon } from '../controls/icons.js';
|
|
9
|
+
import { Component } from './component.js';
|
|
10
|
+
import { BUTTON_STYLE, iconSlots, show, style } from './shared.js';
|
|
11
|
+
const LEVELS = ['mute', 'low', 'high'];
|
|
12
|
+
export class MbxMuteButton extends Component {
|
|
13
|
+
static get observedAttributes() {
|
|
14
|
+
return ['label-mute', 'label-unmute'];
|
|
15
|
+
}
|
|
16
|
+
constructor() {
|
|
17
|
+
super();
|
|
18
|
+
const root = this.attachShadow({ mode: 'open' });
|
|
19
|
+
this.button = document.createElement('button');
|
|
20
|
+
this.button.type = 'button';
|
|
21
|
+
this.button.setAttribute('part', 'button');
|
|
22
|
+
this.slots = iconSlots(LEVELS, (level) => icon(level === 'mute' ? 'mute' : level === 'low' ? 'volume-low' : 'volume-high'));
|
|
23
|
+
for (const level of LEVELS)
|
|
24
|
+
this.button.append(this.slots[level]);
|
|
25
|
+
this.button.addEventListener('click', () => {
|
|
26
|
+
this.toggle();
|
|
27
|
+
});
|
|
28
|
+
root.append(style(BUTTON_STYLE), this.button);
|
|
29
|
+
}
|
|
30
|
+
toggle() {
|
|
31
|
+
const video = this.player?.video;
|
|
32
|
+
if (video === undefined)
|
|
33
|
+
return;
|
|
34
|
+
if (video.muted) {
|
|
35
|
+
video.muted = false;
|
|
36
|
+
if (video.volume === 0)
|
|
37
|
+
video.volume = 1;
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
video.muted = true;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
attach(player) {
|
|
44
|
+
this.listen(player.video, ['volumechange', 'emptied'], () => {
|
|
45
|
+
this.render();
|
|
46
|
+
});
|
|
47
|
+
this.render();
|
|
48
|
+
}
|
|
49
|
+
render() {
|
|
50
|
+
const video = this.player?.video;
|
|
51
|
+
if (video === undefined)
|
|
52
|
+
return;
|
|
53
|
+
const silent = video.muted || video.volume === 0;
|
|
54
|
+
show(this.slots, silent ? 'mute' : video.volume <= 0.5 ? 'low' : 'high');
|
|
55
|
+
this.button.setAttribute('aria-label', silent
|
|
56
|
+
? (this.getAttribute('label-unmute') ?? 'Unmute')
|
|
57
|
+
: (this.getAttribute('label-mute') ?? 'Mute'));
|
|
58
|
+
this.button.setAttribute('aria-pressed', String(video.muted));
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=mute-button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mute-button.js","sourceRoot":"","sources":["../../src/elements/mute-button.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAE5C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGnE,MAAM,MAAM,GAAqB,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;AAEzD,MAAM,OAAO,aAAc,SAAQ,SAAS;IAC1C,MAAM,KAAK,kBAAkB;QAC3B,OAAO,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;IACxC,CAAC;IAKD;QACE,KAAK,EAAE,CAAC;QACR,MAAM,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;QACjD,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAC/C,IAAI,CAAC,MAAM,CAAC,IAAI,GAAG,QAAQ,CAAC;QAC5B,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAC3C,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,MAA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C;QACjC,IAAI,KAAK,KAAK,SAAS;YAAE,OAAO;QAChC,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC;QACjD,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;QACzE,IAAI,CAAC,MAAM,CAAC,YAAY,CACtB,YAAY,EACZ,MAAM;YACJ,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,cAAc,CAAC,IAAI,QAAQ,CAAC;YACjD,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,IAAI,MAAM,CAAC,CAChD,CAAC;QACF,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,cAAc,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IAChE,CAAC;CACF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* <mbx-panels>: the row under the video for what native controls cannot
|
|
3
|
+
* show. It sits in the player beside the video, in flow, so it lands
|
|
4
|
+
* under the picture, and lays its children out in a row: the quality,
|
|
5
|
+
* audio and subtitles menus, the live button, the lock. Each child hides
|
|
6
|
+
* itself when its session has nothing for it, and the row hides when
|
|
7
|
+
* every child has, so a native session shows no strip at all.
|
|
8
|
+
*/
|
|
9
|
+
import { Component } from './component.js';
|
|
10
|
+
export declare class MbxPanels extends Component {
|
|
11
|
+
constructor();
|
|
12
|
+
private empty;
|
|
13
|
+
protected attach(): void;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=panels.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"panels.d.ts","sourceRoot":"","sources":["../../src/elements/panels.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAiB3C,qBAAa,SAAU,SAAQ,SAAS;;IAOtC,OAAO,CAAC,KAAK;cAIM,MAAM,IAAI,IAAI;CAoBlC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* <mbx-panels>: the row under the video for what native controls cannot
|
|
3
|
+
* show. It sits in the player beside the video, in flow, so it lands
|
|
4
|
+
* under the picture, and lays its children out in a row: the quality,
|
|
5
|
+
* audio and subtitles menus, the live button, the lock. Each child hides
|
|
6
|
+
* itself when its session has nothing for it, and the row hides when
|
|
7
|
+
* every child has, so a native session shows no strip at all.
|
|
8
|
+
*/
|
|
9
|
+
import { Component } from './component.js';
|
|
10
|
+
import { style } from './shared.js';
|
|
11
|
+
const STYLE = `
|
|
12
|
+
:host {
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-wrap: wrap;
|
|
15
|
+
align-items: center;
|
|
16
|
+
gap: var(--mbx-gap);
|
|
17
|
+
padding: var(--mbx-pad);
|
|
18
|
+
background: var(--mbx-surface);
|
|
19
|
+
color: var(--mbx-text);
|
|
20
|
+
font: 400 13px/1.4 var(--mbx-font);
|
|
21
|
+
}
|
|
22
|
+
:host([hidden]) { display: none; }
|
|
23
|
+
`;
|
|
24
|
+
export class MbxPanels extends Component {
|
|
25
|
+
constructor() {
|
|
26
|
+
super();
|
|
27
|
+
const root = this.attachShadow({ mode: 'open' });
|
|
28
|
+
root.append(style(STYLE), document.createElement('slot'));
|
|
29
|
+
}
|
|
30
|
+
empty() {
|
|
31
|
+
return ![...this.children].some((child) => !child.hidden);
|
|
32
|
+
}
|
|
33
|
+
attach() {
|
|
34
|
+
const tick = () => {
|
|
35
|
+
const empty = this.empty();
|
|
36
|
+
// Only on a change: the observer sees the row's own attribute too, and
|
|
37
|
+
// a write it did not need would wake it again without end.
|
|
38
|
+
if (this.hidden !== empty)
|
|
39
|
+
this.hidden = empty;
|
|
40
|
+
};
|
|
41
|
+
// The children say `hidden` on themselves; the row follows the last of them.
|
|
42
|
+
const observer = new MutationObserver(tick);
|
|
43
|
+
observer.observe(this, {
|
|
44
|
+
childList: true,
|
|
45
|
+
subtree: true,
|
|
46
|
+
attributes: true,
|
|
47
|
+
attributeFilter: ['hidden'],
|
|
48
|
+
});
|
|
49
|
+
this.keep(() => {
|
|
50
|
+
observer.disconnect();
|
|
51
|
+
});
|
|
52
|
+
tick();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=panels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"panels.js","sourceRoot":"","sources":["../../src/elements/panels.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,MAAM,KAAK,GAAG;;;;;;;;;;;;CAYb,CAAC;AAEF,MAAM,OAAO,SAAU,SAAQ,SAAS;IACtC;QACE,KAAK,EAAE,CAAC;QACR,MAAM,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;QACjD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;IAC5D,CAAC;IAEO,KAAK;QACX,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAE,KAAqB,CAAC,MAAM,CAAC,CAAC;IAC7E,CAAC;IAEkB,MAAM;QACvB,MAAM,IAAI,GAAG,GAAS,EAAE;YACtB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;YAC3B,uEAAuE;YACvE,2DAA2D;YAC3D,IAAI,IAAI,CAAC,MAAM,KAAK,KAAK;gBAAE,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACjD,CAAC,CAAC;QACF,6EAA6E;QAC7E,MAAM,QAAQ,GAAG,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAC5C,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE;YACrB,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,IAAI;YACb,UAAU,EAAE,IAAI;YAChB,eAAe,EAAE,CAAC,QAAQ,CAAC;SAC5B,CAAC,CAAC;QACH,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE;YACb,QAAQ,CAAC,UAAU,EAAE,CAAC;QACxB,CAAC,CAAC,CAAC;QACH,IAAI,EAAE,CAAC;IACT,CAAC;CACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { PlayerHost } from '../host.js';
|
|
2
|
+
import { Component } from './component.js';
|
|
3
|
+
export declare class MbxPipButton extends Component {
|
|
4
|
+
static get observedAttributes(): readonly string[];
|
|
5
|
+
private readonly button;
|
|
6
|
+
private readonly slots;
|
|
7
|
+
private api;
|
|
8
|
+
constructor();
|
|
9
|
+
protected attach(player: PlayerHost): void;
|
|
10
|
+
protected detach(player: PlayerHost): void;
|
|
11
|
+
protected render(): void;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=pip-button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pip-button.d.ts","sourceRoot":"","sources":["../../src/elements/pip-button.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAM3C,qBAAa,YAAa,SAAQ,SAAS;IACzC,MAAM,KAAK,kBAAkB,IAAI,SAAS,MAAM,EAAE,CAEjD;IAED,iBAAyB,MAAM,CAAoB;IACnD,iBAAyB,KAAK,CAAiC;IAC/D,QAAgB,GAAG,CAA0B;;cAmB1B,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI;cAYhC,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI;cAKhC,MAAM,IAAI,IAAI;CAalC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* <mbx-pip-button>: picture in picture, through whichever API the browser
|
|
3
|
+
* has, and hidden where there is none. The glyph is `icon-enter` or
|
|
4
|
+
* `icon-exit`, the name `label-enter` or `label-exit`, and the element
|
|
5
|
+
* sets `pip` on the player while the video is in the floating window.
|
|
6
|
+
*/
|
|
7
|
+
import { icon } from '../controls/icons.js';
|
|
8
|
+
import { pictureInPicture } from '../controls/pip.js';
|
|
9
|
+
import { Component } from './component.js';
|
|
10
|
+
import { BUTTON_STYLE, iconSlots, show, style } from './shared.js';
|
|
11
|
+
const STATES = ['enter', 'exit'];
|
|
12
|
+
export class MbxPipButton extends Component {
|
|
13
|
+
static get observedAttributes() {
|
|
14
|
+
return ['label-enter', 'label-exit'];
|
|
15
|
+
}
|
|
16
|
+
constructor() {
|
|
17
|
+
super();
|
|
18
|
+
this.api = null;
|
|
19
|
+
const root = this.attachShadow({ mode: 'open' });
|
|
20
|
+
this.button = document.createElement('button');
|
|
21
|
+
this.button.type = 'button';
|
|
22
|
+
this.button.setAttribute('part', 'button');
|
|
23
|
+
this.slots = iconSlots(STATES, (state) => icon(state === 'enter' ? 'picture-in-picture' : 'picture-in-picture-exit'));
|
|
24
|
+
for (const state of STATES)
|
|
25
|
+
this.button.append(this.slots[state]);
|
|
26
|
+
this.button.addEventListener('click', () => {
|
|
27
|
+
this.api?.toggle();
|
|
28
|
+
});
|
|
29
|
+
root.append(style(BUTTON_STYLE), this.button);
|
|
30
|
+
}
|
|
31
|
+
attach(player) {
|
|
32
|
+
const api = pictureInPicture(player.video);
|
|
33
|
+
this.api = api;
|
|
34
|
+
this.hidden = !api.supported;
|
|
35
|
+
this.keep(api.watch(() => {
|
|
36
|
+
this.render();
|
|
37
|
+
}));
|
|
38
|
+
this.render();
|
|
39
|
+
}
|
|
40
|
+
detach(player) {
|
|
41
|
+
this.api = null;
|
|
42
|
+
player.removeAttribute('pip');
|
|
43
|
+
}
|
|
44
|
+
render() {
|
|
45
|
+
const player = this.player;
|
|
46
|
+
if (player === null || this.api === null)
|
|
47
|
+
return;
|
|
48
|
+
const active = this.api.active();
|
|
49
|
+
show(this.slots, active ? 'exit' : 'enter');
|
|
50
|
+
this.button.setAttribute('aria-label', active
|
|
51
|
+
? (this.getAttribute('label-exit') ?? 'Leave picture in picture')
|
|
52
|
+
: (this.getAttribute('label-enter') ?? 'Picture in picture'));
|
|
53
|
+
player.toggleAttribute('pip', active);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=pip-button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pip-button.js","sourceRoot":"","sources":["../../src/elements/pip-button.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAE5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGnE,MAAM,MAAM,GAAqB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AAEnD,MAAM,OAAO,YAAa,SAAQ,SAAS;IACzC,MAAM,KAAK,kBAAkB;QAC3B,OAAO,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC;IACvC,CAAC;IAMD;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC;QAChB,MAAM,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;QACjD,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,aAAa,CAA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MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC3B,IAAI,MAAM,KAAK,IAAI,IAAI,IAAI,CAAC,GAAG,KAAK,IAAI;YAAE,OAAO;QACjD,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;QACjC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QAC5C,IAAI,CAAC,MAAM,CAAC,YAAY,CACtB,YAAY,EACZ,MAAM;YACJ,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,IAAI,0BAA0B,CAAC;YACjE,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,IAAI,oBAAoB,CAAC,CAC/D,CAAC;QACF,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACxC,CAAC;CACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PlayerHost } from '../host.js';
|
|
2
|
+
import { Component } from './component.js';
|
|
3
|
+
export declare class MbxPlayButton extends Component {
|
|
4
|
+
static get observedAttributes(): readonly string[];
|
|
5
|
+
private readonly button;
|
|
6
|
+
private readonly slots;
|
|
7
|
+
constructor();
|
|
8
|
+
private toggle;
|
|
9
|
+
protected attach(player: PlayerHost): void;
|
|
10
|
+
protected render(): void;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=play-button.d.ts.map
|