@mattebox/player 0.1.0 → 0.2.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 +200 -196
- 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 +46 -0
- package/dist/elements/control-bar.d.ts.map +1 -0
- package/dist/elements/control-bar.js +207 -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/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 +13 -0
- package/dist/elements/start-button.d.ts.map +1 -0
- package/dist/elements/start-button.js +83 -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 +50 -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/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 +84 -0
- package/dist/es2015/elements/control-bar.js +178 -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/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 +87 -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 +50 -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/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 +46 -9
- package/dist/es2015/labels.js +14 -0
- package/dist/es2015/style.js +21 -294
- package/dist/es2015/{panels/error.js → surface.js} +3 -3
- package/dist/es2015/tags.js +27 -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 +81 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -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 +4 -2
- package/dist/style.d.ts.map +1 -1
- package/dist/style.js +21 -294
- 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 +25 -0
- package/dist/tags.d.ts.map +1 -0
- package/dist/tags.js +25 -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,352 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* <mbx-seek-bar>: the bar over the slider primitive, with four layers on
|
|
3
|
+
* its track, every one a part: the buffered ranges from `video.buffered`,
|
|
4
|
+
* the played span, the hover position, and for live the edge from
|
|
5
|
+
* `engine.live`. The span it maps is the availability window for live and
|
|
6
|
+
* the duration for VOD; `controls/session.ts` says which.
|
|
7
|
+
*
|
|
8
|
+
* A live stream is seekable only when the window is worth it: at least
|
|
9
|
+
* `live-window` forward buffer goals long, the goal read from the engine.
|
|
10
|
+
* Below that the bar hides. VOD is always seekable. The element sets
|
|
11
|
+
* `live` and `seekable` on the player, which the time and the live button
|
|
12
|
+
* read.
|
|
13
|
+
*
|
|
14
|
+
* Reads happen on the events the video already fires; the live window has
|
|
15
|
+
* no event of its own and moves with the clock, so `timeupdate` covers it.
|
|
16
|
+
* While a pointer holds the thumb, the played layer follows the pointer and
|
|
17
|
+
* `currentTime` is written at most once per frame, so the bar never fights
|
|
18
|
+
* a slow seek. The element carries `dragging` meanwhile.
|
|
19
|
+
*
|
|
20
|
+
* The preview above the pointer carries the time and, when the session's
|
|
21
|
+
* `engine.thumbnails` answers for that time, the tile: a rectangle of a
|
|
22
|
+
* sprite, drawn by background position at the sprite's own size and scaled
|
|
23
|
+
* down to `--mbx-preview-width`, so a page sets the size with one token.
|
|
24
|
+
*
|
|
25
|
+
* Chapters divide the track: one gap per chapter boundary, cut through
|
|
26
|
+
* every layer with a mask, so the played and the buffered spans read per
|
|
27
|
+
* chapter, and the preview names the chapter under the pointer. They are
|
|
28
|
+
* the video's own chapters track, see `controls/chapters.ts`.
|
|
29
|
+
* `chapters="none"` leaves the track whole and the preview without a name.
|
|
30
|
+
*
|
|
31
|
+
* `step` is what an arrow key moves the playhead by and `page` what Page
|
|
32
|
+
* Up and Page Down do, in seconds. The name comes from `label`; what a
|
|
33
|
+
* screen reader hears at a position from `label-of`, "{current} of
|
|
34
|
+
* {duration}", and on live from `label-behind`, "{time} behind live". It
|
|
35
|
+
* sits in the bar's seek row unless the page says otherwise.
|
|
36
|
+
*/
|
|
37
|
+
import { chapterAt, chapters, followChapters } from '../controls/chapters.js';
|
|
38
|
+
import { at, clip, EMPTY, fraction } from '../controls/ranges.js';
|
|
39
|
+
import { bufferGoal, live, optional, span, wall } from '../controls/session.js';
|
|
40
|
+
import { slider } from '../controls/slider.js';
|
|
41
|
+
import { format } from '../controls/time.js';
|
|
42
|
+
import { el } from '../dom.js';
|
|
43
|
+
import { fill } from '../labels.js';
|
|
44
|
+
import { Component } from './component.js';
|
|
45
|
+
import { number, SLIDER_STYLE, seekRow, style } from './shared.js';
|
|
46
|
+
const STEP = 5;
|
|
47
|
+
const PAGE = 30;
|
|
48
|
+
const LIVE_WINDOW = 3;
|
|
49
|
+
/** What the tile scales down to when the page sets no `--mbx-preview-width`. */
|
|
50
|
+
const PREVIEW_WIDTH = 160;
|
|
51
|
+
/** The buffer goal assumed for a session that reports none. */
|
|
52
|
+
const BUFFER_GOAL = 30;
|
|
53
|
+
/** The gap cut at a chapter boundary, in pixels. */
|
|
54
|
+
const GAP = 2;
|
|
55
|
+
const EVENTS = [
|
|
56
|
+
'timeupdate',
|
|
57
|
+
'progress',
|
|
58
|
+
'durationchange',
|
|
59
|
+
'loadedmetadata',
|
|
60
|
+
'seeking',
|
|
61
|
+
'seeked',
|
|
62
|
+
'emptied',
|
|
63
|
+
];
|
|
64
|
+
const STYLE = `${SLIDER_STYLE}
|
|
65
|
+
:host { flex: 1; }
|
|
66
|
+
[part~="slider"] { flex: 1; }
|
|
67
|
+
[part~="thumb"] { width: 16px; height: 16px; margin: -8px 0 0 -8px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); }
|
|
68
|
+
[part~="buffered"] { position: absolute; top: 0; right: 0; bottom: 0; left: 0; }
|
|
69
|
+
[part~="buffered-range"] { position: absolute; top: 0; bottom: 0; background: rgba(255, 255, 255, 0.3); }
|
|
70
|
+
[part~="hover"] { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--mbx-text); }
|
|
71
|
+
[part~="edge"] { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--mbx-live); }
|
|
72
|
+
[part~="preview"] {
|
|
73
|
+
position: absolute;
|
|
74
|
+
bottom: 100%;
|
|
75
|
+
margin-bottom: 4px;
|
|
76
|
+
transform: translateX(-50%);
|
|
77
|
+
display: flex;
|
|
78
|
+
flex-direction: column;
|
|
79
|
+
align-items: center;
|
|
80
|
+
gap: 2px;
|
|
81
|
+
padding: 2px;
|
|
82
|
+
background: var(--mbx-surface);
|
|
83
|
+
border-radius: var(--mbx-radius);
|
|
84
|
+
font-size: 13px;
|
|
85
|
+
font-variant-numeric: tabular-nums;
|
|
86
|
+
white-space: nowrap;
|
|
87
|
+
pointer-events: none;
|
|
88
|
+
}
|
|
89
|
+
[part~="preview-image"] { position: relative; overflow: hidden; border-radius: 2px; }
|
|
90
|
+
[part~="preview-tile"] { position: absolute; top: 0; left: 0; transform-origin: top left; background-repeat: no-repeat; }
|
|
91
|
+
[part~="preview-time"] { padding: 0 4px; }
|
|
92
|
+
[part~="preview-title"] { max-width: 240px; padding: 0 4px; overflow: hidden; text-overflow: ellipsis; }
|
|
93
|
+
[hidden] { display: none; }
|
|
94
|
+
`;
|
|
95
|
+
function percent(part) {
|
|
96
|
+
return `${part * 100}%`;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* A mask that cuts a gap at each boundary between chapters, as stops along
|
|
100
|
+
* the track: opaque up to a boundary, clear for the gap, opaque after.
|
|
101
|
+
*/
|
|
102
|
+
function gaps(list, span) {
|
|
103
|
+
const stops = ['#000 0'];
|
|
104
|
+
for (const chapter of list.slice(1)) {
|
|
105
|
+
const at = percent(fraction(chapter.start, span));
|
|
106
|
+
const before = `calc(${at} - ${GAP / 2}px)`;
|
|
107
|
+
const after = `calc(${at} + ${GAP / 2}px)`;
|
|
108
|
+
stops.push(`#000 ${before}`, `transparent ${before}`, `transparent ${after}`, `#000 ${after}`);
|
|
109
|
+
}
|
|
110
|
+
stops.push('#000 100%');
|
|
111
|
+
return `linear-gradient(to right, ${stops.join(', ')})`;
|
|
112
|
+
}
|
|
113
|
+
export class MbxSeekBar extends Component {
|
|
114
|
+
static get observedAttributes() {
|
|
115
|
+
return ['label', 'label-of', 'label-behind', 'live-window', 'chapters'];
|
|
116
|
+
}
|
|
117
|
+
constructor() {
|
|
118
|
+
super();
|
|
119
|
+
this.range = EMPTY;
|
|
120
|
+
this.pending = null;
|
|
121
|
+
this.frame = 0;
|
|
122
|
+
this.divided = '';
|
|
123
|
+
this.list = [];
|
|
124
|
+
const root = this.attachShadow({ mode: 'open' });
|
|
125
|
+
this.bar = slider({
|
|
126
|
+
step: () => number(this, 'step', STEP),
|
|
127
|
+
page: () => number(this, 'page', PAGE),
|
|
128
|
+
onInput: (value) => {
|
|
129
|
+
this.input(value);
|
|
130
|
+
},
|
|
131
|
+
onDrag: (on) => {
|
|
132
|
+
this.toggleAttribute('dragging', on);
|
|
133
|
+
},
|
|
134
|
+
});
|
|
135
|
+
this.buffered = el('div', 'buffered');
|
|
136
|
+
this.hover = el('div', 'hover');
|
|
137
|
+
this.edge = el('div', 'edge');
|
|
138
|
+
this.hover.hidden = true;
|
|
139
|
+
this.edge.hidden = true;
|
|
140
|
+
// Under the fill, so what is played reads over what is buffered.
|
|
141
|
+
this.bar.track.prepend(this.buffered);
|
|
142
|
+
this.bar.track.append(this.hover, this.edge);
|
|
143
|
+
this.preview = el('div', 'preview');
|
|
144
|
+
this.image = el('div', 'preview-image');
|
|
145
|
+
this.tile = el('div', 'preview-tile');
|
|
146
|
+
this.time = el('span', 'preview-time');
|
|
147
|
+
this.caption = el('span', 'preview-title');
|
|
148
|
+
this.caption.hidden = true;
|
|
149
|
+
this.image.append(this.tile);
|
|
150
|
+
this.image.hidden = true;
|
|
151
|
+
this.preview.append(this.image, this.caption, this.time);
|
|
152
|
+
this.preview.hidden = true;
|
|
153
|
+
this.bar.root.append(this.preview);
|
|
154
|
+
this.bar.root.addEventListener('pointermove', (event) => {
|
|
155
|
+
this.point(event);
|
|
156
|
+
});
|
|
157
|
+
this.bar.root.addEventListener('pointerleave', () => {
|
|
158
|
+
this.leave();
|
|
159
|
+
});
|
|
160
|
+
root.append(style(STYLE), this.bar.root);
|
|
161
|
+
}
|
|
162
|
+
connectedCallback() {
|
|
163
|
+
seekRow(this);
|
|
164
|
+
super.connectedCallback();
|
|
165
|
+
}
|
|
166
|
+
isLive() {
|
|
167
|
+
return live(this.player?.engine ?? null) !== undefined;
|
|
168
|
+
}
|
|
169
|
+
/** Whether the chapters divide the track and name the preview. */
|
|
170
|
+
chaptered() {
|
|
171
|
+
return this.getAttribute('chapters') !== 'none' && this.list.length > 0;
|
|
172
|
+
}
|
|
173
|
+
/** The gaps at the chapter boundaries, on every layer of the track at once. */
|
|
174
|
+
paintChapters() {
|
|
175
|
+
const mask = this.chaptered() && this.list.length > 1 ? gaps(this.list, this.range) : '';
|
|
176
|
+
const key = `${mask}|${this.range.start}|${this.range.end}`;
|
|
177
|
+
if (key === this.divided)
|
|
178
|
+
return;
|
|
179
|
+
this.divided = key;
|
|
180
|
+
const track = this.bar.track.style;
|
|
181
|
+
// Both spellings: WebKit before 15.4 knows only the prefixed one.
|
|
182
|
+
track.setProperty('mask-image', mask === '' ? '' : mask);
|
|
183
|
+
track.setProperty('-webkit-mask-image', mask === '' ? '' : mask);
|
|
184
|
+
}
|
|
185
|
+
/** What a screen reader hears at a time. */
|
|
186
|
+
say(time) {
|
|
187
|
+
const engine = this.player?.engine ?? null;
|
|
188
|
+
if (!this.isLive()) {
|
|
189
|
+
const template = this.getAttribute('label-of') ?? '{current} of {duration}';
|
|
190
|
+
return Number.isFinite(this.range.end) && this.range.end > 0
|
|
191
|
+
? fill(template, { current: format(time), duration: format(this.range.end) })
|
|
192
|
+
: format(time);
|
|
193
|
+
}
|
|
194
|
+
const behind = fill(this.getAttribute('label-behind') ?? '{time} behind live', {
|
|
195
|
+
time: format(this.range.end - time),
|
|
196
|
+
});
|
|
197
|
+
const clock = wall(engine, time);
|
|
198
|
+
return clock === null ? behind : `${clock}, ${behind}`;
|
|
199
|
+
}
|
|
200
|
+
/** What the preview shows at a time. */
|
|
201
|
+
label(time) {
|
|
202
|
+
if (!this.isLive())
|
|
203
|
+
return format(time);
|
|
204
|
+
return wall(this.player?.engine ?? null, time) ?? `-${format(this.range.end - time)}`;
|
|
205
|
+
}
|
|
206
|
+
input(value) {
|
|
207
|
+
const video = this.player?.video;
|
|
208
|
+
if (video === undefined)
|
|
209
|
+
return;
|
|
210
|
+
this.bar.set(value, this.say(value));
|
|
211
|
+
if (!this.bar.dragging()) {
|
|
212
|
+
// The release, or a key: written now, and it supersedes whatever a
|
|
213
|
+
// frame queued during the drag was about to write.
|
|
214
|
+
this.pending = null;
|
|
215
|
+
video.currentTime = value;
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
this.pending = value;
|
|
219
|
+
if (this.frame === 0) {
|
|
220
|
+
this.frame = requestAnimationFrame(() => {
|
|
221
|
+
this.flush();
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
flush() {
|
|
226
|
+
this.frame = 0;
|
|
227
|
+
const video = this.player?.video;
|
|
228
|
+
if (this.pending === null || video === undefined)
|
|
229
|
+
return;
|
|
230
|
+
video.currentTime = this.pending;
|
|
231
|
+
this.pending = null;
|
|
232
|
+
}
|
|
233
|
+
/** The width the page asked for through the token, or the default. */
|
|
234
|
+
previewWidth() {
|
|
235
|
+
const set = Number.parseFloat(getComputedStyle(this.preview).getPropertyValue('--mbx-preview-width'));
|
|
236
|
+
return Number.isFinite(set) && set > 0 ? set : PREVIEW_WIDTH;
|
|
237
|
+
}
|
|
238
|
+
/** The tile for a time, if the track has one, drawn at its size and scaled to fit. */
|
|
239
|
+
paintTile(when) {
|
|
240
|
+
const found = optional(this.player?.engine ?? null).thumbnails?.at(when) ?? null;
|
|
241
|
+
this.image.hidden = found === null;
|
|
242
|
+
if (found === null)
|
|
243
|
+
return;
|
|
244
|
+
const scale = this.previewWidth() / found.width;
|
|
245
|
+
this.image.style.width = `${found.width * scale}px`;
|
|
246
|
+
this.image.style.height = `${found.height * scale}px`;
|
|
247
|
+
this.tile.style.width = `${found.width}px`;
|
|
248
|
+
this.tile.style.height = `${found.height}px`;
|
|
249
|
+
this.tile.style.backgroundImage = `url("${found.url}")`;
|
|
250
|
+
this.tile.style.backgroundPosition = `-${found.x}px -${found.y}px`;
|
|
251
|
+
this.tile.style.transform = `scale(${scale})`;
|
|
252
|
+
}
|
|
253
|
+
paintBuffered(video) {
|
|
254
|
+
const parts = clip(Array.from({ length: video.buffered.length }, (_, i) => ({
|
|
255
|
+
start: video.buffered.start(i),
|
|
256
|
+
end: video.buffered.end(i),
|
|
257
|
+
})), this.range);
|
|
258
|
+
const buffered = this.buffered;
|
|
259
|
+
while (buffered.childElementCount > parts.length)
|
|
260
|
+
buffered.lastElementChild?.remove();
|
|
261
|
+
while (buffered.childElementCount < parts.length)
|
|
262
|
+
buffered.append(el('div', 'buffered-range'));
|
|
263
|
+
let i = 0;
|
|
264
|
+
for (const child of buffered.children) {
|
|
265
|
+
const part = parts[i];
|
|
266
|
+
i += 1;
|
|
267
|
+
if (part === undefined)
|
|
268
|
+
break;
|
|
269
|
+
const node = child;
|
|
270
|
+
node.style.left = percent(part[0]);
|
|
271
|
+
node.style.width = percent(part[1] - part[0]);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
/** Whether a live window is wide enough to be worth a bar. */
|
|
275
|
+
worthSeeking() {
|
|
276
|
+
const goals = number(this, 'live-window', LIVE_WINDOW);
|
|
277
|
+
if (goals === 0)
|
|
278
|
+
return true;
|
|
279
|
+
const goal = bufferGoal(this.player?.engine ?? null) ?? BUFFER_GOAL;
|
|
280
|
+
return this.range.end - this.range.start >= goals * goal;
|
|
281
|
+
}
|
|
282
|
+
/** The hover marker and the preview follow the pointer, clamped to the bar. */
|
|
283
|
+
point(event) {
|
|
284
|
+
const rect = this.bar.rail.getBoundingClientRect();
|
|
285
|
+
if (rect.width === 0 || this.range.end <= this.range.start)
|
|
286
|
+
return;
|
|
287
|
+
const part = Math.min(1, Math.max(0, (event.clientX - rect.left) / rect.width));
|
|
288
|
+
this.hover.hidden = false;
|
|
289
|
+
this.hover.style.left = percent(part);
|
|
290
|
+
this.preview.hidden = false;
|
|
291
|
+
const when = at(part, this.range);
|
|
292
|
+
this.time.textContent = this.label(when);
|
|
293
|
+
const chapter = this.chaptered() ? this.list[chapterAt(this.list, when)] : undefined;
|
|
294
|
+
this.caption.hidden = chapter === undefined || chapter.title === '';
|
|
295
|
+
this.caption.textContent = chapter?.title ?? '';
|
|
296
|
+
this.paintTile(when);
|
|
297
|
+
const whole = this.bar.root.getBoundingClientRect();
|
|
298
|
+
const half = this.preview.offsetWidth / 2;
|
|
299
|
+
const x = rect.left - whole.left + part * rect.width;
|
|
300
|
+
this.preview.style.left = `${Math.min(whole.width - half, Math.max(half, x))}px`;
|
|
301
|
+
}
|
|
302
|
+
leave() {
|
|
303
|
+
this.hover.hidden = true;
|
|
304
|
+
this.preview.hidden = true;
|
|
305
|
+
}
|
|
306
|
+
attach(player) {
|
|
307
|
+
const tick = () => {
|
|
308
|
+
this.render();
|
|
309
|
+
};
|
|
310
|
+
this.listen(player.video, EVENTS, tick);
|
|
311
|
+
this.keep(followChapters(player.video, tick));
|
|
312
|
+
this.listen(player, ['sourcechange'], () => {
|
|
313
|
+
this.leave();
|
|
314
|
+
this.render();
|
|
315
|
+
});
|
|
316
|
+
this.render();
|
|
317
|
+
}
|
|
318
|
+
detach(player) {
|
|
319
|
+
cancelAnimationFrame(this.frame);
|
|
320
|
+
this.frame = 0;
|
|
321
|
+
this.pending = null;
|
|
322
|
+
this.leave();
|
|
323
|
+
player.removeAttribute('live');
|
|
324
|
+
player.removeAttribute('seekable');
|
|
325
|
+
}
|
|
326
|
+
render() {
|
|
327
|
+
const player = this.player;
|
|
328
|
+
if (player === null)
|
|
329
|
+
return;
|
|
330
|
+
const video = player.video;
|
|
331
|
+
const engine = player.engine;
|
|
332
|
+
const api = live(engine);
|
|
333
|
+
const on = api !== undefined;
|
|
334
|
+
this.range = span(video, engine);
|
|
335
|
+
this.list = chapters(video);
|
|
336
|
+
this.bar.label(this.getAttribute('label') ?? 'Seek');
|
|
337
|
+
this.bar.range(this.range.start, this.range.end);
|
|
338
|
+
this.paintBuffered(video);
|
|
339
|
+
this.paintChapters();
|
|
340
|
+
this.edge.hidden = !on;
|
|
341
|
+
if (api !== undefined && api.edge !== null) {
|
|
342
|
+
this.edge.style.left = percent(fraction(api.edge, this.range));
|
|
343
|
+
}
|
|
344
|
+
const seekable = !on || this.worthSeeking();
|
|
345
|
+
this.hidden = !seekable;
|
|
346
|
+
player.toggleAttribute('live', on);
|
|
347
|
+
player.toggleAttribute('seekable', seekable);
|
|
348
|
+
if (!this.bar.dragging())
|
|
349
|
+
this.bar.set(video.currentTime, this.say(video.currentTime));
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
//# sourceMappingURL=seek-bar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seek-bar.js","sourceRoot":"","sources":["../../src/elements/seek-bar.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAGH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE9E,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,IA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|
|
|
1
|
+
/**
|
|
2
|
+
* The style every button control shares. Each element carries its own
|
|
3
|
+
* copy in its shadow root, so the rules are short and the tokens come
|
|
4
|
+
* through the `--mbx-*` custom properties the player sets, which inherit
|
|
5
|
+
* through light DOM into every control.
|
|
6
|
+
*
|
|
7
|
+
* Nothing carries `!important`: a page's `::part()` rule must win.
|
|
8
|
+
*/
|
|
9
|
+
export declare const BUTTON_STYLE = "\n:host { display: inline-flex; }\n:host([hidden]) { display: none; }\n[part~=\"button\"] {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex: none;\n width: 40px;\n height: 40px;\n padding: 0;\n font: inherit;\n color: inherit;\n background: transparent;\n border: 0;\n border-radius: var(--mbx-radius);\n cursor: pointer;\n opacity: 0.9;\n}\n[part~=\"button\"]:hover { opacity: 1; }\n[part~=\"button\"]:focus-visible { outline: 2px solid var(--mbx-accent); outline-offset: -2px; }\n[part~=\"icon\"], ::slotted(*) { width: 1.75em; height: 1.75em; fill: currentColor; }\nslot[hidden] { display: none; }\n";
|
|
10
|
+
/** The style of a slider: the rail, the track with its fill, and the thumb. */
|
|
11
|
+
export declare const SLIDER_STYLE = "\n:host { display: block; }\n:host([hidden]) { display: none; }\n[part~=\"slider\"] {\n position: relative;\n height: 40px;\n border-radius: var(--mbx-radius);\n cursor: pointer;\n touch-action: none;\n}\n[part~=\"slider\"]:focus-visible { outline: 2px solid var(--mbx-accent); outline-offset: -2px; }\n[part~=\"rail\"] { position: absolute; top: 0; bottom: 0; left: 8px; right: 8px; }\n[part~=\"track\"] {\n position: absolute;\n top: 50%;\n left: 0;\n right: 0;\n height: 4px;\n transform: translateY(-50%);\n background: rgba(255, 255, 255, 0.35);\n border-radius: 2px;\n overflow: hidden;\n}\n[part~=\"fill\"] { position: absolute; top: 0; bottom: 0; left: 0; background: var(--mbx-accent); }\n[part~=\"thumb\"] {\n position: absolute;\n top: 50%;\n width: 12px;\n height: 12px;\n margin: -6px 0 0 -6px;\n border-radius: 50%;\n background: var(--mbx-text);\n pointer-events: none;\n}\n";
|
|
12
|
+
/** A non-negative number from an attribute, else the default. */
|
|
13
|
+
export declare function number(node: Element, name: string, fallback: number): number;
|
|
14
|
+
/** The style of a menu: the button from BUTTON_STYLE, and the popup above it with its items. */
|
|
15
|
+
export declare const MENU_STYLE = "\n:host { display: inline-flex; }\n:host([hidden]) { display: none; }\n[part~=\"button\"] {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex: none;\n width: 40px;\n height: 40px;\n padding: 0;\n font: inherit;\n color: inherit;\n background: transparent;\n border: 0;\n border-radius: var(--mbx-radius);\n cursor: pointer;\n opacity: 0.9;\n}\n[part~=\"button\"]:hover { opacity: 1; }\n[part~=\"button\"]:focus-visible { outline: 2px solid var(--mbx-accent); outline-offset: -2px; }\n[part~=\"icon\"], ::slotted(*) { width: 1.75em; height: 1.75em; fill: currentColor; }\nslot[hidden] { display: none; }\n\n:host { position: relative; }\n[part~=\"popup\"] {\n position: absolute;\n right: 0;\n bottom: 100%;\n margin-bottom: 8px;\n min-width: 160px;\n padding: 6px;\n display: flex;\n flex-direction: column;\n overflow-y: auto;\n overscroll-behavior: contain;\n background: rgba(16, 17, 20, 0.95);\n border-radius: var(--mbx-radius);\n box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);\n font-size: 14px;\n}\n[part~=\"popup\"][hidden] { display: none; }\n[part~=\"section\"] { display: flex; flex-direction: column; }\n[part~=\"section\"] + [part~=\"section\"] { margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(255, 255, 255, 0.12); }\n[part~=\"section-label\"] { padding: 4px 12px 2px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--mbx-muted); }\n[part~=\"item\"] {\n display: flex;\n align-items: center;\n gap: 12px;\n width: 100%;\n padding: 8px 12px 8px 28px;\n font: inherit;\n color: inherit;\n text-align: left;\n white-space: nowrap;\n background: transparent;\n border: 0;\n border-radius: var(--mbx-radius);\n cursor: pointer;\n}\n[part~=\"item\"]:hover { background: rgba(255, 255, 255, 0.12); }\n[part~=\"item-detail\"] { margin-left: auto; color: var(--mbx-muted); font-variant-numeric: tabular-nums; }\n[part~=\"item\"]:focus-visible { outline: 2px solid var(--mbx-accent); outline-offset: -2px; }\n[part~=\"page-item\"] { position: relative; padding-right: 28px; }\n[part~=\"page-item\"]::after { content: \"\"; position: absolute; right: 12px; top: 50%; width: 7px; height: 7px; margin-top: -4px; border: solid currentColor; border-width: 1.5px 1.5px 0 0; transform: rotate(45deg); opacity: 0.7; }\n[part~=\"back-item\"] { position: relative; font-weight: 600; border-bottom: 1px solid rgba(255, 255, 255, 0.12); border-radius: 0; margin-bottom: 6px; }\n[part~=\"back-item\"]::before { content: \"\"; position: absolute; left: 12px; top: 50%; width: 7px; height: 7px; margin-top: -4px; border: solid currentColor; border-width: 1.5px 0 0 1.5px; transform: rotate(-45deg); opacity: 0.7; }\n[part~=\"checked\"] { position: relative; }\n[part~=\"checked\"]::before { content: \"\"; position: absolute; left: 12px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--mbx-accent); }\n";
|
|
16
|
+
/** Puts a control in the bar's seek row when it is in a bar, unless the page wrote a `slot` of its own. */
|
|
17
|
+
export declare function seekRow(node: HTMLElement): void;
|
|
18
|
+
/** A `<style>` with `text`, for a shadow root. */
|
|
19
|
+
export declare function style(text: string): HTMLStyleElement;
|
|
20
|
+
/**
|
|
21
|
+
* A named slot per state with the default glyph as its fallback, so a page
|
|
22
|
+
* drops its own SVG into `slot="icon-<state>"` and the button keeps the
|
|
23
|
+
* name. Returns the slots by state; `show` hides all but one.
|
|
24
|
+
*/
|
|
25
|
+
export declare function iconSlots<S extends string>(states: readonly S[], fallback: (state: S) => SVGSVGElement): Record<S, HTMLSlotElement>;
|
|
26
|
+
export declare function show<S extends string>(slots: Record<S, HTMLSlotElement>, state: S): void;
|
|
27
|
+
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/elements/shared.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,8oBAuBxB,CAAC;AAEF,+EAA+E;AAC/E,eAAO,MAAM,YAAY,o5BAkCxB,CAAC;AAEF,iEAAiE;AACjE,wBAAgB,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAI5E;AAED,gGAAgG;AAChG,eAAO,MAAM,UAAU,45FA8CtB,CAAC;AAEF,2GAA2G;AAC3G,wBAAgB,OAAO,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,CAI/C;AAED,kDAAkD;AAClD,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,CAIpD;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,EACxC,MAAM,EAAE,SAAS,CAAC,EAAE,EACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,aAAa,GACpC,MAAM,CAAC,CAAC,EAAE,eAAe,CAAC,CAU5B;AAED,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,EAAE,eAAe,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAExF"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The style every button control shares. Each element carries its own
|
|
3
|
+
* copy in its shadow root, so the rules are short and the tokens come
|
|
4
|
+
* through the `--mbx-*` custom properties the player sets, which inherit
|
|
5
|
+
* through light DOM into every control.
|
|
6
|
+
*
|
|
7
|
+
* Nothing carries `!important`: a page's `::part()` rule must win.
|
|
8
|
+
*/
|
|
9
|
+
export const BUTTON_STYLE = `
|
|
10
|
+
:host { display: inline-flex; }
|
|
11
|
+
:host([hidden]) { display: none; }
|
|
12
|
+
[part~="button"] {
|
|
13
|
+
display: inline-flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
flex: none;
|
|
17
|
+
width: 40px;
|
|
18
|
+
height: 40px;
|
|
19
|
+
padding: 0;
|
|
20
|
+
font: inherit;
|
|
21
|
+
color: inherit;
|
|
22
|
+
background: transparent;
|
|
23
|
+
border: 0;
|
|
24
|
+
border-radius: var(--mbx-radius);
|
|
25
|
+
cursor: pointer;
|
|
26
|
+
opacity: 0.9;
|
|
27
|
+
}
|
|
28
|
+
[part~="button"]:hover { opacity: 1; }
|
|
29
|
+
[part~="button"]:focus-visible { outline: 2px solid var(--mbx-accent); outline-offset: -2px; }
|
|
30
|
+
[part~="icon"], ::slotted(*) { width: 1.75em; height: 1.75em; fill: currentColor; }
|
|
31
|
+
slot[hidden] { display: none; }
|
|
32
|
+
`;
|
|
33
|
+
/** The style of a slider: the rail, the track with its fill, and the thumb. */
|
|
34
|
+
export const SLIDER_STYLE = `
|
|
35
|
+
:host { display: block; }
|
|
36
|
+
:host([hidden]) { display: none; }
|
|
37
|
+
[part~="slider"] {
|
|
38
|
+
position: relative;
|
|
39
|
+
height: 40px;
|
|
40
|
+
border-radius: var(--mbx-radius);
|
|
41
|
+
cursor: pointer;
|
|
42
|
+
touch-action: none;
|
|
43
|
+
}
|
|
44
|
+
[part~="slider"]:focus-visible { outline: 2px solid var(--mbx-accent); outline-offset: -2px; }
|
|
45
|
+
[part~="rail"] { position: absolute; top: 0; bottom: 0; left: 8px; right: 8px; }
|
|
46
|
+
[part~="track"] {
|
|
47
|
+
position: absolute;
|
|
48
|
+
top: 50%;
|
|
49
|
+
left: 0;
|
|
50
|
+
right: 0;
|
|
51
|
+
height: 4px;
|
|
52
|
+
transform: translateY(-50%);
|
|
53
|
+
background: rgba(255, 255, 255, 0.35);
|
|
54
|
+
border-radius: 2px;
|
|
55
|
+
overflow: hidden;
|
|
56
|
+
}
|
|
57
|
+
[part~="fill"] { position: absolute; top: 0; bottom: 0; left: 0; background: var(--mbx-accent); }
|
|
58
|
+
[part~="thumb"] {
|
|
59
|
+
position: absolute;
|
|
60
|
+
top: 50%;
|
|
61
|
+
width: 12px;
|
|
62
|
+
height: 12px;
|
|
63
|
+
margin: -6px 0 0 -6px;
|
|
64
|
+
border-radius: 50%;
|
|
65
|
+
background: var(--mbx-text);
|
|
66
|
+
pointer-events: none;
|
|
67
|
+
}
|
|
68
|
+
`;
|
|
69
|
+
/** A non-negative number from an attribute, else the default. */
|
|
70
|
+
export function number(node, name, fallback) {
|
|
71
|
+
const raw = node.getAttribute(name);
|
|
72
|
+
const value = raw === null ? Number.NaN : Number(raw);
|
|
73
|
+
return Number.isFinite(value) && value >= 0 ? value : fallback;
|
|
74
|
+
}
|
|
75
|
+
/** The style of a menu: the button from BUTTON_STYLE, and the popup above it with its items. */
|
|
76
|
+
export const MENU_STYLE = `${BUTTON_STYLE}
|
|
77
|
+
:host { position: relative; }
|
|
78
|
+
[part~="popup"] {
|
|
79
|
+
position: absolute;
|
|
80
|
+
right: 0;
|
|
81
|
+
bottom: 100%;
|
|
82
|
+
margin-bottom: 8px;
|
|
83
|
+
min-width: 160px;
|
|
84
|
+
padding: 6px;
|
|
85
|
+
display: flex;
|
|
86
|
+
flex-direction: column;
|
|
87
|
+
overflow-y: auto;
|
|
88
|
+
overscroll-behavior: contain;
|
|
89
|
+
background: rgba(16, 17, 20, 0.95);
|
|
90
|
+
border-radius: var(--mbx-radius);
|
|
91
|
+
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
|
|
92
|
+
font-size: 14px;
|
|
93
|
+
}
|
|
94
|
+
[part~="popup"][hidden] { display: none; }
|
|
95
|
+
[part~="section"] { display: flex; flex-direction: column; }
|
|
96
|
+
[part~="section"] + [part~="section"] { margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(255, 255, 255, 0.12); }
|
|
97
|
+
[part~="section-label"] { padding: 4px 12px 2px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--mbx-muted); }
|
|
98
|
+
[part~="item"] {
|
|
99
|
+
display: flex;
|
|
100
|
+
align-items: center;
|
|
101
|
+
gap: 12px;
|
|
102
|
+
width: 100%;
|
|
103
|
+
padding: 8px 12px 8px 28px;
|
|
104
|
+
font: inherit;
|
|
105
|
+
color: inherit;
|
|
106
|
+
text-align: left;
|
|
107
|
+
white-space: nowrap;
|
|
108
|
+
background: transparent;
|
|
109
|
+
border: 0;
|
|
110
|
+
border-radius: var(--mbx-radius);
|
|
111
|
+
cursor: pointer;
|
|
112
|
+
}
|
|
113
|
+
[part~="item"]:hover { background: rgba(255, 255, 255, 0.12); }
|
|
114
|
+
[part~="item-detail"] { margin-left: auto; color: var(--mbx-muted); font-variant-numeric: tabular-nums; }
|
|
115
|
+
[part~="item"]:focus-visible { outline: 2px solid var(--mbx-accent); outline-offset: -2px; }
|
|
116
|
+
[part~="page-item"] { position: relative; padding-right: 28px; }
|
|
117
|
+
[part~="page-item"]::after { content: ""; position: absolute; right: 12px; top: 50%; width: 7px; height: 7px; margin-top: -4px; border: solid currentColor; border-width: 1.5px 1.5px 0 0; transform: rotate(45deg); opacity: 0.7; }
|
|
118
|
+
[part~="back-item"] { position: relative; font-weight: 600; border-bottom: 1px solid rgba(255, 255, 255, 0.12); border-radius: 0; margin-bottom: 6px; }
|
|
119
|
+
[part~="back-item"]::before { content: ""; position: absolute; left: 12px; top: 50%; width: 7px; height: 7px; margin-top: -4px; border: solid currentColor; border-width: 1.5px 0 0 1.5px; transform: rotate(-45deg); opacity: 0.7; }
|
|
120
|
+
[part~="checked"] { position: relative; }
|
|
121
|
+
[part~="checked"]::before { content: ""; position: absolute; left: 12px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--mbx-accent); }
|
|
122
|
+
`;
|
|
123
|
+
/** Puts a control in the bar's seek row when it is in a bar, unless the page wrote a `slot` of its own. */
|
|
124
|
+
export function seekRow(node) {
|
|
125
|
+
if (node.parentElement?.localName === 'mbx-control-bar' && !node.hasAttribute('slot')) {
|
|
126
|
+
node.slot = 'seek';
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/** A `<style>` with `text`, for a shadow root. */
|
|
130
|
+
export function style(text) {
|
|
131
|
+
const node = document.createElement('style');
|
|
132
|
+
node.textContent = text;
|
|
133
|
+
return node;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* A named slot per state with the default glyph as its fallback, so a page
|
|
137
|
+
* drops its own SVG into `slot="icon-<state>"` and the button keeps the
|
|
138
|
+
* name. Returns the slots by state; `show` hides all but one.
|
|
139
|
+
*/
|
|
140
|
+
export function iconSlots(states, fallback) {
|
|
141
|
+
const out = {};
|
|
142
|
+
for (const state of states) {
|
|
143
|
+
const slot = document.createElement('slot');
|
|
144
|
+
slot.name = `icon-${state}`;
|
|
145
|
+
slot.append(fallback(state));
|
|
146
|
+
slot.hidden = true;
|
|
147
|
+
out[state] = slot;
|
|
148
|
+
}
|
|
149
|
+
return out;
|
|
150
|
+
}
|
|
151
|
+
export function show(slots, state) {
|
|
152
|
+
for (const key of Object.keys(slots))
|
|
153
|
+
slots[key].hidden = key !== state;
|
|
154
|
+
}
|
|
155
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/elements/shared.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;CAuB3B,CAAC;AAEF,+EAA+E;AAC/E,MAAM,CAAC,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkC3B,CAAC;AAEF,iEAAiE;AACjE,MAAM,UAAU,MAAM,CAAC,IAAa,EAAE,IAAY,EAAE,QAAgB;IAClE,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IACpC,MAAM,KAAK,GAAG,GAAG,KAAK,IA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AC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,IAAI,CAAmB,KAAiC,EAAE,KAAQ;IAChF,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAQ;QAAE,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,GAAG,GAAG,KAAK,KAAK,CAAC;AACjF,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { PlayerHost } from '../host.js';
|
|
2
|
+
import { Component } from './component.js';
|
|
3
|
+
export declare class MbxSkipButton extends Component {
|
|
4
|
+
static get observedAttributes(): readonly string[];
|
|
5
|
+
private readonly button;
|
|
6
|
+
private readonly glyph;
|
|
7
|
+
constructor();
|
|
8
|
+
/** The amount, signed. A value that is not a number is the default. */
|
|
9
|
+
private seconds;
|
|
10
|
+
private skip;
|
|
11
|
+
protected attach(_player: PlayerHost): void;
|
|
12
|
+
protected render(): void;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=skip-button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skip-button.d.ts","sourceRoot":"","sources":["../../src/elements/skip-button.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAY3C,qBAAa,aAAc,SAAQ,SAAS;IAC1C,MAAM,KAAK,kBAAkB,IAAI,SAAS,MAAM,EAAE,CAEjD;IAED,iBAAyB,MAAM,CAAoB;IACnD,iBAAyB,KAAK,CAAkB;;IAiBhD,uEAAuE;IACvE,OAAO,CAAC,OAAO;IAKf,OAAO,CAAC,IAAI;cAYO,MAAM,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI;cAIjC,MAAM,IAAI,IAAI;CASlC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { icon } from '../controls/icons.js';
|
|
2
|
+
import { fill } from '../labels.js';
|
|
3
|
+
import { Component } from './component.js';
|
|
4
|
+
import { BUTTON_STYLE, style } from './shared.js';
|
|
5
|
+
const SECONDS = 10;
|
|
6
|
+
/** The glyph for a skip amount: the set draws 10 and 30, and a plain arrow says the rest. */
|
|
7
|
+
function glyphFor(back, amount) {
|
|
8
|
+
const side = back ? 'seek-backward' : 'seek-forward';
|
|
9
|
+
if (amount === 10 || amount === 30)
|
|
10
|
+
return `${side}-${amount}`;
|
|
11
|
+
return side;
|
|
12
|
+
}
|
|
13
|
+
export class MbxSkipButton extends Component {
|
|
14
|
+
static get observedAttributes() {
|
|
15
|
+
return ['seconds', 'label'];
|
|
16
|
+
}
|
|
17
|
+
constructor() {
|
|
18
|
+
super();
|
|
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.glyph = document.createElement('slot');
|
|
24
|
+
this.glyph.name = 'icon';
|
|
25
|
+
this.button.append(this.glyph);
|
|
26
|
+
this.button.addEventListener('click', () => {
|
|
27
|
+
this.skip();
|
|
28
|
+
});
|
|
29
|
+
root.append(style(BUTTON_STYLE), this.button);
|
|
30
|
+
}
|
|
31
|
+
/** The amount, signed. A value that is not a number is the default. */
|
|
32
|
+
seconds() {
|
|
33
|
+
const value = Number(this.getAttribute('seconds') ?? SECONDS);
|
|
34
|
+
return Number.isFinite(value) ? value : SECONDS;
|
|
35
|
+
}
|
|
36
|
+
skip() {
|
|
37
|
+
const video = this.player?.video;
|
|
38
|
+
if (video === undefined)
|
|
39
|
+
return;
|
|
40
|
+
const ranges = video.seekable;
|
|
41
|
+
const end = Number.isFinite(video.duration)
|
|
42
|
+
? video.duration
|
|
43
|
+
: ranges.length > 0
|
|
44
|
+
? ranges.end(ranges.length - 1)
|
|
45
|
+
: video.currentTime;
|
|
46
|
+
video.currentTime = Math.min(end, Math.max(0, video.currentTime + this.seconds()));
|
|
47
|
+
}
|
|
48
|
+
attach(_player) {
|
|
49
|
+
this.render();
|
|
50
|
+
}
|
|
51
|
+
render() {
|
|
52
|
+
const seconds = this.seconds();
|
|
53
|
+
const back = seconds < 0;
|
|
54
|
+
const amount = Math.abs(seconds);
|
|
55
|
+
this.glyph.replaceChildren(icon(glyphFor(back, amount)));
|
|
56
|
+
const template = this.getAttribute('label') ?? (back ? 'Back {seconds} seconds' : 'Forward {seconds} seconds');
|
|
57
|
+
this.button.setAttribute('aria-label', fill(template, { seconds: amount }));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=skip-button.js.map
|