@mattebox/player 0.6.0 → 0.8.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.
Files changed (290) hide show
  1. package/dist/cdn/mattebox-player.min.js +3 -435
  2. package/dist/controls/airplay.js +28 -44
  3. package/dist/controls/airplay.js.map +1 -1
  4. package/dist/controls/chapters.d.ts +22 -11
  5. package/dist/controls/chapters.d.ts.map +1 -1
  6. package/dist/controls/chapters.js +87 -73
  7. package/dist/controls/chapters.js.map +1 -1
  8. package/dist/controls/cues.d.ts +0 -22
  9. package/dist/controls/cues.d.ts.map +1 -1
  10. package/dist/controls/cues.js +161 -191
  11. package/dist/controls/cues.js.map +1 -1
  12. package/dist/controls/fullscreen.js +52 -70
  13. package/dist/controls/fullscreen.js.map +1 -1
  14. package/dist/controls/icons.d.ts +4 -2
  15. package/dist/controls/icons.d.ts.map +1 -1
  16. package/dist/controls/icons.js +46 -70
  17. package/dist/controls/icons.js.map +1 -1
  18. package/dist/controls/markers.d.ts +39 -0
  19. package/dist/controls/markers.d.ts.map +1 -0
  20. package/dist/controls/markers.js +38 -0
  21. package/dist/controls/markers.js.map +1 -0
  22. package/dist/controls/menu.d.ts +8 -4
  23. package/dist/controls/menu.d.ts.map +1 -1
  24. package/dist/controls/menu.js +261 -223
  25. package/dist/controls/menu.js.map +1 -1
  26. package/dist/controls/native-tracks.d.ts +28 -0
  27. package/dist/controls/native-tracks.d.ts.map +1 -0
  28. package/dist/controls/native-tracks.js +30 -0
  29. package/dist/controls/native-tracks.js.map +1 -0
  30. package/dist/controls/pip.js +35 -49
  31. package/dist/controls/pip.js.map +1 -1
  32. package/dist/controls/quality-names.d.ts +15 -0
  33. package/dist/controls/quality-names.d.ts.map +1 -0
  34. package/dist/controls/quality-names.js +62 -0
  35. package/dist/controls/quality-names.js.map +1 -0
  36. package/dist/controls/ranges.js +42 -37
  37. package/dist/controls/ranges.js.map +1 -1
  38. package/dist/controls/session.d.ts +6 -1
  39. package/dist/controls/session.d.ts.map +1 -1
  40. package/dist/controls/session.js +41 -26
  41. package/dist/controls/session.js.map +1 -1
  42. package/dist/controls/slider.d.ts +2 -2
  43. package/dist/controls/slider.d.ts.map +1 -1
  44. package/dist/controls/slider.js +151 -159
  45. package/dist/controls/slider.js.map +1 -1
  46. package/dist/controls/time.js +17 -17
  47. package/dist/controls/time.js.map +1 -1
  48. package/dist/controls/track-names.d.ts +40 -0
  49. package/dist/controls/track-names.d.ts.map +1 -0
  50. package/dist/controls/track-names.js +59 -0
  51. package/dist/controls/track-names.js.map +1 -0
  52. package/dist/dom.d.ts +6 -0
  53. package/dist/dom.d.ts.map +1 -1
  54. package/dist/dom.js +28 -19
  55. package/dist/dom.js.map +1 -1
  56. package/dist/element-entry.js +9 -6
  57. package/dist/element-entry.js.map +1 -1
  58. package/dist/element.d.ts +28 -2
  59. package/dist/element.d.ts.map +1 -1
  60. package/dist/element.js +426 -442
  61. package/dist/element.js.map +1 -1
  62. package/dist/elements/airplay-button.js +51 -53
  63. package/dist/elements/airplay-button.js.map +1 -1
  64. package/dist/elements/audio-menu.d.ts +19 -8
  65. package/dist/elements/audio-menu.d.ts.map +1 -1
  66. package/dist/elements/audio-menu.js +103 -65
  67. package/dist/elements/audio-menu.js.map +1 -1
  68. package/dist/elements/chapters-menu.d.ts.map +1 -1
  69. package/dist/elements/chapters-menu.js +75 -65
  70. package/dist/elements/chapters-menu.js.map +1 -1
  71. package/dist/elements/component.d.ts +1 -1
  72. package/dist/elements/component.d.ts.map +1 -1
  73. package/dist/elements/component.js +86 -89
  74. package/dist/elements/component.js.map +1 -1
  75. package/dist/elements/control-bar.d.ts +18 -5
  76. package/dist/elements/control-bar.d.ts.map +1 -1
  77. package/dist/elements/control-bar.js +282 -319
  78. package/dist/elements/control-bar.js.map +1 -1
  79. package/dist/elements/current-time.js +26 -25
  80. package/dist/elements/current-time.js.map +1 -1
  81. package/dist/elements/drm-badge.d.ts +3 -2
  82. package/dist/elements/drm-badge.d.ts.map +1 -1
  83. package/dist/elements/drm-badge.js +109 -141
  84. package/dist/elements/drm-badge.js.map +1 -1
  85. package/dist/elements/duration.d.ts.map +1 -1
  86. package/dist/elements/duration.js +24 -21
  87. package/dist/elements/duration.js.map +1 -1
  88. package/dist/elements/error-screen.d.ts.map +1 -1
  89. package/dist/elements/error-screen.js +68 -102
  90. package/dist/elements/error-screen.js.map +1 -1
  91. package/dist/elements/fullscreen-button.js +48 -54
  92. package/dist/elements/fullscreen-button.js.map +1 -1
  93. package/dist/elements/live-button.d.ts.map +1 -1
  94. package/dist/elements/live-button.js +67 -94
  95. package/dist/elements/live-button.js.map +1 -1
  96. package/dist/elements/marker-button.d.ts +22 -0
  97. package/dist/elements/marker-button.d.ts.map +1 -0
  98. package/dist/elements/marker-button.js +99 -0
  99. package/dist/elements/marker-button.js.map +1 -0
  100. package/dist/elements/menu-element.js +31 -28
  101. package/dist/elements/menu-element.js.map +1 -1
  102. package/dist/elements/mute-button.js +58 -59
  103. package/dist/elements/mute-button.js.map +1 -1
  104. package/dist/elements/pip-button.js +54 -54
  105. package/dist/elements/pip-button.js.map +1 -1
  106. package/dist/elements/play-button.d.ts.map +1 -1
  107. package/dist/elements/play-button.js +73 -58
  108. package/dist/elements/play-button.js.map +1 -1
  109. package/dist/elements/quality-menu.d.ts +4 -0
  110. package/dist/elements/quality-menu.d.ts.map +1 -1
  111. package/dist/elements/quality-menu.js +82 -71
  112. package/dist/elements/quality-menu.js.map +1 -1
  113. package/dist/elements/remaining-time.d.ts.map +1 -1
  114. package/dist/elements/remaining-time.js +27 -24
  115. package/dist/elements/remaining-time.js.map +1 -1
  116. package/dist/elements/scan-button.d.ts +17 -0
  117. package/dist/elements/scan-button.d.ts.map +1 -0
  118. package/dist/elements/scan-button.js +117 -0
  119. package/dist/elements/scan-button.js.map +1 -0
  120. package/dist/elements/seek-bar.d.ts +99 -15
  121. package/dist/elements/seek-bar.d.ts.map +1 -1
  122. package/dist/elements/seek-bar.js +487 -336
  123. package/dist/elements/seek-bar.js.map +1 -1
  124. package/dist/elements/shared.d.ts +3 -11
  125. package/dist/elements/shared.d.ts.map +1 -1
  126. package/dist/elements/shared.js +44 -144
  127. package/dist/elements/shared.js.map +1 -1
  128. package/dist/elements/skip-button.d.ts.map +1 -1
  129. package/dist/elements/skip-button.js +54 -55
  130. package/dist/elements/skip-button.js.map +1 -1
  131. package/dist/elements/spacer.d.ts.map +1 -1
  132. package/dist/elements/spacer.js +12 -7
  133. package/dist/elements/spacer.js.map +1 -1
  134. package/dist/elements/speed-menu.js +60 -55
  135. package/dist/elements/speed-menu.js.map +1 -1
  136. package/dist/elements/spinner.d.ts.map +1 -1
  137. package/dist/elements/spinner.js +52 -78
  138. package/dist/elements/spinner.js.map +1 -1
  139. package/dist/elements/start-button.d.ts.map +1 -1
  140. package/dist/elements/start-button.js +107 -120
  141. package/dist/elements/start-button.js.map +1 -1
  142. package/dist/elements/subtitles-menu.d.ts +2 -0
  143. package/dist/elements/subtitles-menu.d.ts.map +1 -1
  144. package/dist/elements/subtitles-menu.js +119 -103
  145. package/dist/elements/subtitles-menu.js.map +1 -1
  146. package/dist/elements/time-element.d.ts.map +1 -1
  147. package/dist/elements/time-element.js +36 -28
  148. package/dist/elements/time-element.js.map +1 -1
  149. package/dist/elements/title.d.ts.map +1 -1
  150. package/dist/elements/title.js +105 -137
  151. package/dist/elements/title.js.map +1 -1
  152. package/dist/elements/volume-slider.d.ts.map +1 -1
  153. package/dist/elements/volume-slider.js +47 -45
  154. package/dist/elements/volume-slider.js.map +1 -1
  155. package/dist/elements/volume.d.ts.map +1 -1
  156. package/dist/elements/volume.js +42 -50
  157. package/dist/elements/volume.js.map +1 -1
  158. package/dist/entries/airplay-button.js +7 -7
  159. package/dist/entries/airplay-button.js.map +1 -1
  160. package/dist/entries/audio-menu.js +7 -6
  161. package/dist/entries/audio-menu.js.map +1 -1
  162. package/dist/entries/chapters-menu.js +7 -7
  163. package/dist/entries/chapters-menu.js.map +1 -1
  164. package/dist/entries/control-bar.js +7 -6
  165. package/dist/entries/control-bar.js.map +1 -1
  166. package/dist/entries/current-time.js +7 -6
  167. package/dist/entries/current-time.js.map +1 -1
  168. package/dist/entries/drm-badge.js +7 -6
  169. package/dist/entries/drm-badge.js.map +1 -1
  170. package/dist/entries/duration.js +7 -6
  171. package/dist/entries/duration.js.map +1 -1
  172. package/dist/entries/error-screen.js +7 -6
  173. package/dist/entries/error-screen.js.map +1 -1
  174. package/dist/entries/fullscreen-button.js +7 -6
  175. package/dist/entries/fullscreen-button.js.map +1 -1
  176. package/dist/entries/live-button.js +7 -6
  177. package/dist/entries/live-button.js.map +1 -1
  178. package/dist/entries/marker-button.d.ts +5 -0
  179. package/dist/entries/marker-button.d.ts.map +1 -0
  180. package/dist/entries/marker-button.js +9 -0
  181. package/dist/entries/marker-button.js.map +1 -0
  182. package/dist/entries/mute-button.js +7 -6
  183. package/dist/entries/mute-button.js.map +1 -1
  184. package/dist/entries/pip-button.js +7 -6
  185. package/dist/entries/pip-button.js.map +1 -1
  186. package/dist/entries/play-button.js +7 -6
  187. package/dist/entries/play-button.js.map +1 -1
  188. package/dist/entries/quality-menu.js +7 -6
  189. package/dist/entries/quality-menu.js.map +1 -1
  190. package/dist/entries/remaining-time.js +7 -7
  191. package/dist/entries/remaining-time.js.map +1 -1
  192. package/dist/entries/scan-button.d.ts +5 -0
  193. package/dist/entries/scan-button.d.ts.map +1 -0
  194. package/dist/entries/scan-button.js +9 -0
  195. package/dist/entries/scan-button.js.map +1 -0
  196. package/dist/entries/seek-bar.js +7 -6
  197. package/dist/entries/seek-bar.js.map +1 -1
  198. package/dist/entries/skip-button.js +7 -6
  199. package/dist/entries/skip-button.js.map +1 -1
  200. package/dist/entries/spacer.js +7 -6
  201. package/dist/entries/spacer.js.map +1 -1
  202. package/dist/entries/speed-menu.js +7 -6
  203. package/dist/entries/speed-menu.js.map +1 -1
  204. package/dist/entries/spinner.js +7 -7
  205. package/dist/entries/spinner.js.map +1 -1
  206. package/dist/entries/start-button.js +7 -6
  207. package/dist/entries/start-button.js.map +1 -1
  208. package/dist/entries/subtitles-menu.js +7 -6
  209. package/dist/entries/subtitles-menu.js.map +1 -1
  210. package/dist/entries/title.js +7 -7
  211. package/dist/entries/title.js.map +1 -1
  212. package/dist/entries/volume-slider.js +7 -6
  213. package/dist/entries/volume-slider.js.map +1 -1
  214. package/dist/entries/volume.js +9 -8
  215. package/dist/entries/volume.js.map +1 -1
  216. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/asyncToGenerator.js +1 -1
  217. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/defineProperty.js +1 -1
  218. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/objectSpread2.js +1 -1
  219. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/toPrimitive.js +1 -1
  220. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/toPropertyKey.js +1 -1
  221. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.150.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/typeof.js +1 -1
  222. package/dist/es2015/controls/chapters.js +40 -7
  223. package/dist/es2015/controls/cues.js +1 -8
  224. package/dist/es2015/controls/icons.js +27 -25
  225. package/dist/es2015/controls/markers.js +36 -0
  226. package/dist/es2015/controls/menu.js +49 -10
  227. package/dist/es2015/controls/native-tracks.js +29 -0
  228. package/dist/es2015/controls/quality-names.js +67 -0
  229. package/dist/es2015/controls/session.js +16 -4
  230. package/dist/es2015/controls/slider.js +5 -4
  231. package/dist/es2015/controls/track-names.js +57 -0
  232. package/dist/es2015/dom.js +10 -1
  233. package/dist/es2015/element.js +71 -13
  234. package/dist/es2015/elements/audio-menu.js +62 -19
  235. package/dist/es2015/elements/chapters-menu.js +18 -10
  236. package/dist/es2015/elements/control-bar.js +41 -35
  237. package/dist/es2015/elements/drm-badge.js +12 -33
  238. package/dist/es2015/elements/duration.js +2 -1
  239. package/dist/es2015/elements/error-screen.js +1 -30
  240. package/dist/es2015/elements/live-button.js +1 -29
  241. package/dist/es2015/elements/marker-button.js +100 -0
  242. package/dist/es2015/elements/menu-element.js +2 -2
  243. package/dist/es2015/elements/play-button.js +10 -3
  244. package/dist/es2015/elements/quality-menu.js +22 -7
  245. package/dist/es2015/elements/remaining-time.js +2 -1
  246. package/dist/es2015/elements/scan-button.js +118 -0
  247. package/dist/es2015/elements/seek-bar.js +295 -90
  248. package/dist/es2015/elements/shared.js +5 -106
  249. package/dist/es2015/elements/skip-button.js +2 -1
  250. package/dist/es2015/elements/spacer.js +2 -1
  251. package/dist/es2015/elements/spinner.js +1 -32
  252. package/dist/es2015/elements/start-button.js +8 -26
  253. package/dist/es2015/elements/subtitles-menu.js +39 -11
  254. package/dist/es2015/elements/time-element.js +1 -4
  255. package/dist/es2015/elements/title.js +1 -45
  256. package/dist/es2015/elements/volume-slider.js +2 -1
  257. package/dist/es2015/elements/volume.js +1 -11
  258. package/dist/es2015/entries/marker-button.js +7 -0
  259. package/dist/es2015/entries/scan-button.js +7 -0
  260. package/dist/es2015/index.js +5 -1
  261. package/dist/es2015/presets.js +1 -1
  262. package/dist/es2015/style.js +1 -101
  263. package/dist/es2015/tags.js +3 -1
  264. package/dist/host.d.ts +3 -0
  265. package/dist/host.d.ts.map +1 -1
  266. package/dist/host.js +19 -17
  267. package/dist/host.js.map +1 -1
  268. package/dist/index.d.ts +7 -0
  269. package/dist/index.d.ts.map +1 -1
  270. package/dist/index.js +57 -27
  271. package/dist/labels.js +13 -9
  272. package/dist/labels.js.map +1 -1
  273. package/dist/namespaces.d.ts +9 -26
  274. package/dist/namespaces.d.ts.map +1 -1
  275. package/dist/namespaces.js +6 -2
  276. package/dist/namespaces.js.map +1 -1
  277. package/dist/presets.js +33 -28
  278. package/dist/presets.js.map +1 -1
  279. package/dist/style.d.ts +1 -20
  280. package/dist/style.d.ts.map +1 -1
  281. package/dist/style.js +4 -100
  282. package/dist/style.js.map +1 -1
  283. package/dist/surface.js +25 -21
  284. package/dist/surface.js.map +1 -1
  285. package/dist/tags.d.ts +2 -0
  286. package/dist/tags.d.ts.map +1 -1
  287. package/dist/tags.js +32 -26
  288. package/dist/tags.js.map +1 -1
  289. package/package.json +4 -4
  290. package/dist/index.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"play-button.js","sourceRoot":"","sources":["../../src/elements/play-button.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;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,OAAO,EAAE,QAAQ,CAAC,CAAC;AAC7D,MAAM,MAAM,GAAoC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;AAEnG,MAAM,OAAO,aAAc,SAAQ,SAAS;IAC1C,MAAM,KAAK,kBAAkB;QAC3B,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,SAAS,KAAK,EAAE,CAAC,CAAC;IACjD,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,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AAK,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;QAC9E,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QACxB,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,YAAY,EAAE,IAAI,CAAC,YAAY,CAAC,SAAS,KAAK,EAAE,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IAC/F,CAAC;CACF"}
1
+ {"version":3,"file":"play-button.js","names":[],"sources":["../../src/elements/play-button.ts"],"sourcesContent":["/**\n * <mbx-play-button>: play, pause, or replay once the media has ended. It\n * reads the video on the events the video already fires and writes one\n * thing back on click. The glyph is a slot per state, so a page drops its\n * own SVG into `icon-play`, `icon-pause` or `icon-replay`; the name is on\n * the button, from `label-play`, `label-pause` and `label-replay`, where a\n * screen reader reads it. While the seek bar holds the video paused for a\n * drag, the button shows the state from before the drag, which the player\n * carries as `scrubbing`.\n */\nimport { icon } from '../controls/icons.js';\nimport type { PlayerHost } from '../host.js';\nimport { Component } from './component.js';\nimport { BUTTON_STYLE, iconSlots, show, style } from './shared.js';\n\ntype State = 'play' | 'pause' | 'replay';\nconst STATES: readonly State[] = ['play', 'pause', 'replay'];\nconst LABELS: Readonly<Record<State, string>> = { play: 'Play', pause: 'Pause', replay: 'Replay' };\n\nexport class MbxPlayButton extends Component {\n static get observedAttributes(): readonly string[] {\n return STATES.map((state) => `label-${state}`);\n }\n\n declare private readonly button: HTMLButtonElement;\n declare private readonly slots: Record<State, HTMLSlotElement>;\n\n constructor() {\n super();\n const root = this.attachShadow({ mode: 'open' });\n this.button = document.createElement('button');\n this.button.type = 'button';\n this.button.setAttribute('part', 'button');\n this.slots = iconSlots(STATES, icon);\n for (const state of STATES) this.button.append(this.slots[state]);\n this.button.addEventListener('click', () => {\n this.toggle();\n });\n root.append(style(BUTTON_STYLE), this.button);\n }\n\n private toggle(): void {\n const video = this.player?.video;\n if (video === undefined) return;\n if (video.paused) {\n // Rejected outside a user gesture on an unmuted video, which the\n // browser reports on the video's own error path; nothing to add.\n video.play().catch(() => undefined);\n } else {\n video.pause();\n }\n }\n\n protected override attach(player: PlayerHost): void {\n this.listen(player.video, ['play', 'pause', 'ended', 'emptied'], () => {\n this.render();\n });\n this.observe(player, ['scrubbing'], () => {\n this.render();\n });\n this.render();\n }\n\n protected override render(): void {\n const video = this.player?.video;\n if (video === undefined) return;\n const held = this.player?.getAttribute('scrubbing') ?? null;\n const paused = held === null ? video.paused : held === 'paused';\n const state: State = video.ended ? 'replay' : paused ? 'play' : 'pause';\n show(this.slots, state);\n this.button.setAttribute('aria-label', this.getAttribute(`label-${state}`) ?? LABELS[state]);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAgBA,MAAM,SAA2B;CAAC;CAAQ;CAAS;AAAQ;AAC3D,MAAM,SAA0C;CAAE,MAAM;CAAQ,OAAO;CAAS,QAAQ;AAAS;AAEjG,IAAa,gBAAb,cAAmC,UAAU;CAC3C,WAAW,qBAAwC;EACjD,OAAO,OAAO,KAAK,UAAU,SAAS,OAAO;CAC/C;CAKA,cAAc;EACZ,MAAM;EACN,MAAM,OAAO,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;EAC/C,KAAK,SAAS,SAAS,cAAc,QAAQ;EAC7C,KAAK,OAAO,OAAO;EACnB,KAAK,OAAO,aAAa,QAAQ,QAAQ;EACzC,KAAK,QAAQ,UAAU,QAAQ,IAAI;EACnC,KAAK,MAAM,SAAS,QAAQ,KAAK,OAAO,OAAO,KAAK,MAAM,MAAM;EAChE,KAAK,OAAO,iBAAiB,eAAe;GAC1C,KAAK,OAAO;EACd,CAAC;EACD,KAAK,OAAO,MAAM,YAAY,GAAG,KAAK,MAAM;CAC9C;CAEA,SAAuB;EACrB,MAAM,QAAQ,KAAK,QAAQ;EAC3B,IAAI,UAAU,KAAA,GAAW;EACzB,IAAI,MAAM,QAGR,MAAM,KAAK,CAAC,CAAC,YAAY,KAAA,CAAS;OAElC,MAAM,MAAM;CAEhB;CAEA,OAA0B,QAA0B;EAClD,KAAK,OAAO,OAAO,OAAO;GAAC;GAAQ;GAAS;GAAS;EAAS,SAAS;GACrE,KAAK,OAAO;EACd,CAAC;EACD,KAAK,QAAQ,QAAQ,CAAC,WAAW,SAAS;GACxC,KAAK,OAAO;EACd,CAAC;EACD,KAAK,OAAO;CACd;CAEA,SAAkC;EAChC,MAAM,QAAQ,KAAK,QAAQ;EAC3B,IAAI,UAAU,KAAA,GAAW;EACzB,MAAM,OAAO,KAAK,QAAQ,aAAa,WAAW,KAAK;EACvD,MAAM,SAAS,SAAS,OAAO,MAAM,SAAS,SAAS;EACvD,MAAM,QAAe,MAAM,QAAQ,WAAW,SAAS,SAAS;EAChE,KAAK,KAAK,OAAO,KAAK;EACtB,KAAK,OAAO,aAAa,cAAc,KAAK,aAAa,SAAS,OAAO,KAAK,OAAO,MAAM;CAC7F;AACF"}
@@ -3,9 +3,13 @@ import { MenuElement } from './menu-element.js';
3
3
  export declare class MbxQualityMenu extends MenuElement {
4
4
  static get observedAttributes(): readonly string[];
5
5
  private engine;
6
+ /** The name of what plays, as the Auto row last showed it. */
7
+ private playing;
6
8
  constructor();
7
9
  protected name(): string;
8
10
  protected attach(player: PlayerHost): void;
9
11
  protected render(): void;
12
+ /** The name of the rendition that plays, under Auto only: a pin names itself by its tick. */
13
+ private playingName;
10
14
  }
11
15
  //# sourceMappingURL=quality-menu.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"quality-menu.d.ts","sourceRoot":"","sources":["../../src/elements/quality-menu.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAU,MAAM,mBAAmB,CAAC;AAUxD,qBAAa,cAAe,SAAQ,WAAW;IAC7C,MAAM,KAAK,kBAAkB,IAAI,SAAS,MAAM,EAAE,CAEjD;IAED,QAAgB,MAAM,CAAkB;;cAQrB,IAAI,IAAI,MAAM;cAId,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI;cAmBhC,MAAM,IAAI,IAAI;CA4BlC"}
1
+ {"version":3,"file":"quality-menu.d.ts","sourceRoot":"","sources":["../../src/elements/quality-menu.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAU,MAAM,mBAAmB,CAAC;AAKxD,qBAAa,cAAe,SAAQ,WAAW;IAC7C,MAAM,KAAK,kBAAkB,IAAI,SAAS,MAAM,EAAE,CAEjD;IAED,QAAgB,MAAM,CAAkB;IACxC,8DAA8D;IAC9D,QAAgB,OAAO,CAAqB;;cASzB,IAAI,IAAI,MAAM;cAId,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI;cA0BhC,MAAM,IAAI,IAAI;IA4BjC,6FAA6F;IAC7F,OAAO,CAAC,WAAW;CAOpB"}
@@ -1,72 +1,83 @@
1
- import { MenuElement, single } from './menu-element.js';
2
- import { show } from './shared.js';
3
- const AUTO = 'auto';
4
- function renditionLabel(rendition) {
5
- if (rendition.height !== undefined)
6
- return `${rendition.height}p`;
7
- return `${Math.round(rendition.bitrate / 1000)} kbps`;
8
- }
9
- export class MbxQualityMenu extends MenuElement {
10
- static get observedAttributes() {
11
- return ['label', 'label-auto', 'label-back'];
12
- }
13
- constructor() {
14
- super(...single('settings'));
15
- this.engine = null;
16
- show(this.slots, 'default');
17
- }
18
- name() {
19
- return 'Quality';
20
- }
21
- attach(player) {
22
- this.follow(player, (engine) => {
23
- this.engine = engine;
24
- this.render();
25
- if (engine === null)
26
- return undefined;
27
- const tick = () => {
28
- this.render();
29
- };
30
- const offs = [
31
- engine.on('tracks:changed', tick),
32
- engine.on('quality:constraints-unsatisfiable', tick),
33
- engine.on('quality:pin-unsatisfiable', tick),
34
- ];
35
- return () => {
36
- for (const off of offs)
37
- off();
38
- };
39
- });
40
- }
41
- render() {
42
- super.render();
43
- const engine = this.engine;
44
- if (engine === null) {
45
- this.hidden = true;
46
- return;
47
- }
48
- const quality = engine.quality;
49
- const items = [
50
- [AUTO, this.getAttribute('label-auto') ?? 'Auto'],
51
- ];
52
- for (const rendition of quality.renditions) {
53
- items.push([rendition.id, renditionLabel(rendition)]);
54
- }
55
- this.menu.fill([
56
- {
57
- name: 'rendition',
58
- items,
59
- value: quality.pinned ?? AUTO,
60
- onSelect: (value) => {
61
- if (value === AUTO)
62
- quality.auto();
63
- else
64
- quality.pin(value);
65
- this.render();
66
- },
67
- },
68
- ]);
69
- this.hidden = quality.renditions.length === 0;
70
- }
71
- }
1
+ import { show } from "./shared.js";
2
+ import { MenuElement, single } from "./menu-element.js";
3
+ import { qualityLabels, qualityNames } from "../controls/quality-names.js";
4
+ //#region src/elements/quality-menu.ts
5
+ const AUTO = "auto";
6
+ var MbxQualityMenu = class extends MenuElement {
7
+ static get observedAttributes() {
8
+ return [
9
+ "label",
10
+ "label-auto",
11
+ "label-back"
12
+ ];
13
+ }
14
+ constructor() {
15
+ super(...single("settings"));
16
+ this.engine = null;
17
+ this.playing = void 0;
18
+ show(this.slots, "default");
19
+ }
20
+ name() {
21
+ return "Quality";
22
+ }
23
+ attach(player) {
24
+ this.follow(player, (engine) => {
25
+ this.engine = engine;
26
+ this.render();
27
+ if (engine === null) return void 0;
28
+ const tick = () => {
29
+ this.render();
30
+ };
31
+ const clock = () => {
32
+ if (this.playingName() !== this.playing) this.render();
33
+ };
34
+ player.video.addEventListener("timeupdate", clock);
35
+ const offs = [
36
+ () => player.video.removeEventListener("timeupdate", clock),
37
+ engine.on("tracks:changed", tick),
38
+ engine.on("quality:constraints-unsatisfiable", tick),
39
+ engine.on("quality:pin-unsatisfiable", tick)
40
+ ];
41
+ return () => {
42
+ for (const off of offs) off();
43
+ };
44
+ });
45
+ }
46
+ render() {
47
+ super.render();
48
+ const engine = this.engine;
49
+ if (engine === null) {
50
+ this.hidden = true;
51
+ return;
52
+ }
53
+ const quality = engine.quality;
54
+ this.playing = this.playingName();
55
+ const items = [[
56
+ AUTO,
57
+ this.getAttribute("label-auto") ?? "Auto",
58
+ this.playing
59
+ ], ...qualityNames(quality.selectable)];
60
+ this.menu.fill([{
61
+ name: "rendition",
62
+ items,
63
+ value: quality.pinned ?? AUTO,
64
+ onSelect: (value) => {
65
+ if (value === AUTO) quality.auto();
66
+ else quality.pin(value);
67
+ this.render();
68
+ }
69
+ }]);
70
+ this.hidden = items.length === 1;
71
+ }
72
+ /** The name of the rendition that plays, under Auto only: a pin names itself by its tick. */
73
+ playingName() {
74
+ const quality = this.engine?.quality;
75
+ if (quality === void 0 || quality.pinned !== null) return void 0;
76
+ const id = quality.playing?.id;
77
+ return qualityLabels(quality.selectable).find(([candidate]) => candidate === id)?.[1];
78
+ }
79
+ };
80
+ //#endregion
81
+ export { MbxQualityMenu };
82
+
72
83
  //# sourceMappingURL=quality-menu.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"quality-menu.js","sourceRoot":"","sources":["../../src/elements/quality-menu.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,MAAM,IAAI,GAAG,MAAM,CAAC;AAEpB,SAAS,cAAc,CAAC,SAAoB;IAC1C,IAAI,SAAS,CAAC,MAAM,KAAK,SAAS;QAAE,OAAO,GAAG,SAAS,CAAC,MAAM,GAAG,CAAC;IAClE,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;AACxD,CAAC;AAED,MAAM,OAAO,cAAe,SAAQ,WAAW;IAC7C,MAAM,KAAK,kBAAkB;QAC3B,OAAO,CAAC,OAAO,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;IAC/C,CAAC;IAID;QACE,KAAK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AAC;SAClD,CAAC;QACF,KAAK,MAAM,SAAS,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;YAC3C,KAAK,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,EAAE,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QACxD,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;YACb;gBACE,IAAI,EAAE,WAAW;gBACjB,KAAK;gBACL,KAAK,EAAE,OAAO,CAAC,MAAM,IAAI,IAAI;gBAC7B,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;oBAClB,IAAI,KAAK,KAAK,IAAI;wBAAE,OAAO,CAAC,IAAI,EAAE,CAAC;;wBAC9B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;oBACxB,IAAI,CAAC,MAAM,EAAE,CAAC;gBAChB,CAAC;aACF;SACF,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,CAAC;IAChD,CAAC;CACF"}
1
+ {"version":3,"file":"quality-menu.js","names":[],"sources":["../../src/elements/quality-menu.ts"],"sourcesContent":["/**\n * <mbx-quality-menu>: the pin over `engine.quality`, where \"auto\" means\n * none. Hidden without renditions, and for a native session. The name\n * comes from `label`, the word for no pin from `label-auto`. It offers\n * `engine.quality.selectable`, labelled by `qualityNames`. Under Auto, the\n * Auto row names what plays, in its detail.\n */\nimport type { Mattebox } from 'mattebox';\nimport { qualityLabels, qualityNames } from '../controls/quality-names.js';\nimport type { PlayerHost } from '../host.js';\nimport { MenuElement, single } from './menu-element.js';\nimport { show } from './shared.js';\n\nconst AUTO = 'auto';\n\nexport class MbxQualityMenu extends MenuElement {\n static get observedAttributes(): readonly string[] {\n return ['label', 'label-auto', 'label-back'];\n }\n\n declare private engine: Mattebox | null;\n /** The name of what plays, as the Auto row last showed it. */\n declare private playing: string | undefined;\n\n constructor() {\n super(...single('settings'));\n this.engine = null;\n this.playing = undefined;\n show(this.slots, 'default');\n }\n\n protected override name(): string {\n return 'Quality';\n }\n\n protected override attach(player: PlayerHost): void {\n this.follow(player, (engine) => {\n this.engine = engine;\n this.render();\n if (engine === null) return undefined;\n const tick = (): void => {\n this.render();\n };\n // What plays changes as the playhead reaches another rendition's\n // segments, and no event says so: read it on the clock, draw on a change.\n const clock = (): void => {\n if (this.playingName() !== this.playing) this.render();\n };\n player.video.addEventListener('timeupdate', clock);\n const offs = [\n () => player.video.removeEventListener('timeupdate', clock),\n engine.on('tracks:changed', tick),\n engine.on('quality:constraints-unsatisfiable', tick),\n engine.on('quality:pin-unsatisfiable', tick),\n ];\n return () => {\n for (const off of offs) off();\n };\n });\n }\n\n protected override render(): void {\n super.render();\n const engine = this.engine;\n if (engine === null) {\n this.hidden = true;\n return;\n }\n const quality = engine.quality;\n this.playing = this.playingName();\n const items: Array<readonly [string, string, (string | undefined)?]> = [\n [AUTO, this.getAttribute('label-auto') ?? 'Auto', this.playing],\n ...qualityNames(quality.selectable),\n ];\n this.menu.fill([\n {\n name: 'rendition',\n items,\n value: quality.pinned ?? AUTO,\n onSelect: (value) => {\n if (value === AUTO) quality.auto();\n else quality.pin(value);\n this.render();\n },\n },\n ]);\n this.hidden = items.length === 1;\n }\n\n /** The name of the rendition that plays, under Auto only: a pin names itself by its tick. */\n private playingName(): string | undefined {\n const quality = this.engine?.quality;\n if (quality === undefined || quality.pinned !== null) return undefined;\n // Every label, twins too: what plays may be a twin the menu shows once.\n const id = quality.playing?.id;\n return qualityLabels(quality.selectable).find(([candidate]) => candidate === id)?.[1];\n }\n}\n"],"mappings":";;;;AAaA,MAAM,OAAO;AAEb,IAAa,iBAAb,cAAoC,YAAY;CAC9C,WAAW,qBAAwC;EACjD,OAAO;GAAC;GAAS;GAAc;EAAY;CAC7C;CAMA,cAAc;EACZ,MAAM,GAAG,OAAO,UAAU,CAAC;EAC3B,KAAK,SAAS;EACd,KAAK,UAAU,KAAA;EACf,KAAK,KAAK,OAAO,SAA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CAAC,MAAM,CAAC,eAAe,cAAc,EAAE,CAAC,GAAG;CACrF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"remaining-time.d.ts","sourceRoot":"","sources":["../../src/elements/remaining-time.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,qBAAa,gBAAiB,SAAQ,WAAW;;cAK5B,MAAM,IAAI,IAAI;CAUlC"}
1
+ {"version":3,"file":"remaining-time.d.ts","sourceRoot":"","sources":["../../src/elements/remaining-time.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,qBAAa,gBAAiB,SAAQ,WAAW;;cAK5B,MAAM,IAAI,IAAI;CAUlC"}
@@ -1,26 +1,29 @@
1
+ import { format } from "../controls/time.js";
2
+ import { live, span } from "../controls/session.js";
3
+ import { TimeElement } from "./time-element.js";
4
+ //#region src/elements/remaining-time.ts
1
5
  /**
2
- * <mbx-remaining-time>: what is left, "-4:53", once the metadata is in. A
3
- * bar that shows one number shows this one: a viewer asks how much is
4
- * left more often than where they are. A live stream has no end, so the
5
- * element hides while the stream is live, as the duration does.
6
- */
7
- import { live, span } from '../controls/session.js';
8
- import { format } from '../controls/time.js';
9
- import { TimeElement } from './time-element.js';
10
- export class MbxRemainingTime extends TimeElement {
11
- constructor() {
12
- super(':host { text-align: right; }');
13
- }
14
- render() {
15
- const player = this.player;
16
- if (player === null)
17
- return;
18
- const video = player.video;
19
- const engine = player.engine;
20
- const on = live(engine) !== undefined;
21
- this.hidden = on;
22
- if (!on)
23
- this.text.data = `-${format(Math.max(0, span(video, engine).end - video.currentTime))}`;
24
- }
25
- }
6
+ * <mbx-remaining-time>: what is left, "-4:53", once the metadata is in. A
7
+ * bar that shows one number shows this one: a viewer asks how much is
8
+ * left more often than where they are. A live stream has no end, so the
9
+ * element hides while the stream is live, as the duration does.
10
+ */
11
+ const TRAILING = ":host{text-align:right}";
12
+ var MbxRemainingTime = class extends TimeElement {
13
+ constructor() {
14
+ super(TRAILING);
15
+ }
16
+ render() {
17
+ const player = this.player;
18
+ if (player === null) return;
19
+ const video = player.video;
20
+ const engine = player.engine;
21
+ const on = live(engine) !== void 0;
22
+ this.hidden = on;
23
+ if (!on) this.text.data = `-${format(Math.max(0, span(video, engine).end - video.currentTime))}`;
24
+ }
25
+ };
26
+ //#endregion
27
+ export { MbxRemainingTime };
28
+
26
29
  //# sourceMappingURL=remaining-time.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"remaining-time.js","sourceRoot":"","sources":["../../src/elements/remaining-time.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,OAAO,gBAAiB,SAAQ,WAAW;IAC/C;QACE,KAAK,CAAC,8BAA8B,CAAC,CAAC;IACxC,CAAC;IAEkB,MAAM;QACvB,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC3B,IAAI,MAAM,KAAK,IAAI;YAAE,OAAO;QAC5B,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QAC3B,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC7B,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,SAAS,CAAC;QACtC,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,EAAE;YACL,IAAI,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,GAAG,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC;IAC5F,CAAC;CACF"}
1
+ {"version":3,"file":"remaining-time.js","names":[],"sources":["../../src/elements/remaining-time.ts"],"sourcesContent":["/**\n * <mbx-remaining-time>: what is left, \"-4:53\", once the metadata is in. A\n * bar that shows one number shows this one: a viewer asks how much is\n * left more often than where they are. A live stream has no end, so the\n * element hides while the stream is live, as the duration does.\n */\nimport { live, span } from '../controls/session.js';\nimport { format } from '../controls/time.js';\nimport { TimeElement } from './time-element.js';\nimport TRAILING from './trailing-time.css?inline';\n\nexport class MbxRemainingTime extends TimeElement {\n constructor() {\n super(TRAILING);\n }\n\n protected override render(): void {\n const player = this.player;\n if (player === null) return;\n const video = player.video;\n const engine = player.engine;\n const on = live(engine) !== undefined;\n this.hidden = on;\n if (!on)\n this.text.data = `-${format(Math.max(0, span(video, engine).end - video.currentTime))}`;\n }\n}\n"],"mappings":";;;;;;;;;;AASA,MAAA,WAAA;AAEA,IAAA,mBAAA,cAAA,YAAA;CACA,cAAA;EACA,MAAA,QAAA;CACA;CAEA,SAAA;EACA,MAAA,SAAA,KAAA;EACA,IAAA,WAAA,MAAA;EACA,MAAA,QAAA,OAAA;EACA,MAAA,SAAA,OAAA;EACA,MAAA,KAAA,KAAA,MAAA,MAAA,KAAA;EACA,KAAA,SAAA;EACA,IAAA,CAAA,IACA,KAAA,KAAA,OAAA,IAAA,OAAA,KAAA,IAAA,GAAA,KAAA,OAAA,MAAA,CAAA,CAAA,MAAA,MAAA,WAAA,CAAA;CACA;AACA"}
@@ -0,0 +1,17 @@
1
+ import type { PlayerHost } from '../host.js';
2
+ import { Component } from './component.js';
3
+ export declare class MbxScanButton extends Component {
4
+ static get observedAttributes(): readonly string[];
5
+ private readonly button;
6
+ private readonly glyph;
7
+ private readonly badge;
8
+ constructor();
9
+ connectedCallback(): void;
10
+ private backward;
11
+ /** The rates to step through, each above the floor, in the order given. */
12
+ private rates;
13
+ private step;
14
+ protected attach(player: PlayerHost): void;
15
+ protected render(): void;
16
+ }
17
+ //# sourceMappingURL=scan-button.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scan-button.d.ts","sourceRoot":"","sources":["../../src/elements/scan-button.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAkB3C,qBAAa,aAAc,SAAQ,SAAS;IAC1C,MAAM,KAAK,kBAAkB,IAAI,SAAS,MAAM,EAAE,CAEjD;IAED,iBAAyB,MAAM,CAAoB;IACnD,iBAAyB,KAAK,CAAkB;IAChD,iBAAyB,KAAK,CAAc;;IAkBnC,iBAAiB,IAAI,IAAI;IAOlC,OAAO,CAAC,QAAQ;IAIhB,2EAA2E;IAC3E,OAAO,CAAC,KAAK;IAQb,OAAO,CAAC,IAAI;cAYO,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI;cAgBhC,MAAM,IAAI,IAAI;CAgBlC"}
@@ -0,0 +1,117 @@
1
+ import { el, setChildren } from "../dom.js";
2
+ import { icon } from "../controls/icons.js";
3
+ import { Component } from "./component.js";
4
+ import { BUTTON_STYLE, style } from "./shared.js";
5
+ import { optional } from "../controls/session.js";
6
+ //#region src/elements/scan-button.ts
7
+ /**
8
+ * <mbx-scan-button>: fast forward, or rewind with `direction="backward"`,
9
+ * through the I-frame track: `engine.trick.setRate`, see the engine guide's
10
+ * trick play chapter. Each press steps up through `rates`, "4 8 16" by
11
+ * default, and a press past the last one plays at normal speed again. A
12
+ * press while the other button scans starts this one at its first rate.
13
+ * Every rate must be above 2, the engine's own floor for a scan.
14
+ *
15
+ * The button shows only when the session has an I-frame track: without
16
+ * one there is no picture to scan with, and the speed menu covers playback
17
+ * speed. It hides too on a live stream whose window is too short to seek,
18
+ * where the player carries `live` and not `seekable`, as the seek bar does. It carries `aria-pressed` and `scanning` while it scans, and its
19
+ * `rate` part shows the rate, "8×". The name comes from `label`,
20
+ * "Fast forward" or "Rewind".
21
+ */
22
+ const STYLE_CSS = "[part~=button]{position:relative}[part~=rate]{font-variant-numeric:tabular-nums;font-size:10px;font-weight:700;line-height:1;position:absolute;bottom:2px;right:0}[part~=rate][hidden]{display:none}";
23
+ const RATES = [
24
+ 4,
25
+ 8,
26
+ 16
27
+ ];
28
+ /** The engine's floor: a scan rate is above 2 or below -2. */
29
+ const FLOOR = 2;
30
+ /**
31
+ * What changes the rate or whether scanning is possible: every rate change,
32
+ * from either button, the page, or the engine ending a scan, and a new track
33
+ * list, which is when an I-frame track appears.
34
+ */
35
+ const ENGINE_EVENTS = ["trick:rate", "tracks:changed"];
36
+ const STYLE = BUTTON_STYLE + STYLE_CSS;
37
+ var MbxScanButton = class extends Component {
38
+ static get observedAttributes() {
39
+ return [
40
+ "direction",
41
+ "rates",
42
+ "label"
43
+ ];
44
+ }
45
+ constructor() {
46
+ super();
47
+ const root = this.attachShadow({ mode: "open" });
48
+ this.button = el("button", "button");
49
+ this.button.type = "button";
50
+ this.glyph = document.createElement("slot");
51
+ this.glyph.name = "icon";
52
+ this.badge = el("span", "rate");
53
+ this.badge.hidden = true;
54
+ this.button.append(this.glyph, this.badge);
55
+ this.button.addEventListener("click", () => {
56
+ this.step();
57
+ });
58
+ root.append(style(STYLE), this.button);
59
+ }
60
+ connectedCallback() {
61
+ this.hidden = true;
62
+ super.connectedCallback();
63
+ }
64
+ backward() {
65
+ return this.getAttribute("direction") === "backward";
66
+ }
67
+ /** The rates to step through, each above the floor, in the order given. */
68
+ rates() {
69
+ const own = (this.getAttribute("rates") ?? "").split(/\s+/).map(Number).filter((rate) => Number.isFinite(rate) && rate > FLOOR);
70
+ return own.length > 0 ? own : RATES;
71
+ }
72
+ step() {
73
+ const trick = optional(this.player?.engine ?? null).trick;
74
+ if (trick?.available !== true) return;
75
+ const sign = this.backward() ? -1 : 1;
76
+ const rates = this.rates();
77
+ const now = trick.rate * sign;
78
+ const next = now > FLOOR ? rates[rates.indexOf(now) + 1] : rates[0];
79
+ trick.setRate(next === void 0 ? 1 : next * sign);
80
+ this.render();
81
+ }
82
+ attach(player) {
83
+ const tick = () => {
84
+ this.render();
85
+ };
86
+ this.listen(player.video, ["emptied"], tick);
87
+ this.observe(player, ["live", "seekable"], tick);
88
+ this.follow(player, (engine) => {
89
+ tick();
90
+ if (engine === null) return void 0;
91
+ const offs = ENGINE_EVENTS.map((name) => engine.on(name, tick));
92
+ return () => {
93
+ for (const off of offs) off();
94
+ };
95
+ });
96
+ }
97
+ render() {
98
+ const trick = optional(this.player?.engine ?? null).trick;
99
+ const backward = this.backward();
100
+ const player = this.player;
101
+ const unseekable = player?.hasAttribute("live") === true && !player.hasAttribute("seekable");
102
+ this.hidden = trick?.available !== true || unseekable;
103
+ const rate = trick?.rate ?? 1;
104
+ const on = backward ? rate < -2 : rate > FLOOR;
105
+ this.toggleAttribute("scanning", on);
106
+ this.button.setAttribute("aria-pressed", String(on));
107
+ this.badge.hidden = !on;
108
+ this.badge.textContent = on ? `${Math.abs(rate)}×` : "";
109
+ setChildren(this.glyph, icon(backward ? "fast-backward" : "fast-forward"));
110
+ const name = this.getAttribute("label") ?? (backward ? "Rewind" : "Fast forward");
111
+ this.button.setAttribute("aria-label", name);
112
+ }
113
+ };
114
+ //#endregion
115
+ export { MbxScanButton };
116
+
117
+ //# sourceMappingURL=scan-button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scan-button.js","names":[],"sources":["../../src/elements/scan-button.ts"],"sourcesContent":["/**\n * <mbx-scan-button>: fast forward, or rewind with `direction=\"backward\"`,\n * through the I-frame track: `engine.trick.setRate`, see the engine guide's\n * trick play chapter. Each press steps up through `rates`, \"4 8 16\" by\n * default, and a press past the last one plays at normal speed again. A\n * press while the other button scans starts this one at its first rate.\n * Every rate must be above 2, the engine's own floor for a scan.\n *\n * The button shows only when the session has an I-frame track: without\n * one there is no picture to scan with, and the speed menu covers playback\n * speed. It hides too on a live stream whose window is too short to seek,\n * where the player carries `live` and not `seekable`, as the seek bar does. It carries `aria-pressed` and `scanning` while it scans, and its\n * `rate` part shows the rate, \"8×\". The name comes from `label`,\n * \"Fast forward\" or \"Rewind\".\n */\nimport { icon } from '../controls/icons.js';\nimport { optional } from '../controls/session.js';\nimport { el, setChildren } from '../dom.js';\nimport type { PlayerHost } from '../host.js';\nimport { Component } from './component.js';\nimport STYLE_CSS from './scan-button.css?inline';\nimport { BUTTON_STYLE, style } from './shared.js';\n\nconst RATES = [4, 8, 16];\n\n/** The engine's floor: a scan rate is above 2 or below -2. */\nconst FLOOR = 2;\n\n/**\n * What changes the rate or whether scanning is possible: every rate change,\n * from either button, the page, or the engine ending a scan, and a new track\n * list, which is when an I-frame track appears.\n */\nconst ENGINE_EVENTS = ['trick:rate', 'tracks:changed'];\n\nconst STYLE = BUTTON_STYLE + STYLE_CSS;\n\nexport class MbxScanButton extends Component {\n static get observedAttributes(): readonly string[] {\n return ['direction', 'rates', 'label'];\n }\n\n declare private readonly button: HTMLButtonElement;\n declare private readonly glyph: HTMLSlotElement;\n declare private readonly badge: HTMLElement;\n\n constructor() {\n super();\n const root = this.attachShadow({ mode: 'open' });\n this.button = el('button', 'button');\n this.button.type = 'button';\n this.glyph = document.createElement('slot');\n this.glyph.name = 'icon';\n this.badge = el('span', 'rate');\n this.badge.hidden = true;\n this.button.append(this.glyph, this.badge);\n this.button.addEventListener('click', () => {\n this.step();\n });\n root.append(style(STYLE), this.button);\n }\n\n override connectedCallback(): void {\n // Hidden until a session says it has an I-frame track. Not in the\n // constructor: a new custom element must not have attributes.\n this.hidden = true;\n super.connectedCallback();\n }\n\n private backward(): boolean {\n return this.getAttribute('direction') === 'backward';\n }\n\n /** The rates to step through, each above the floor, in the order given. */\n private rates(): number[] {\n const own = (this.getAttribute('rates') ?? '')\n .split(/\\s+/)\n .map(Number)\n .filter((rate) => Number.isFinite(rate) && rate > FLOOR);\n return own.length > 0 ? own : RATES;\n }\n\n private step(): void {\n const trick = optional(this.player?.engine ?? null).trick;\n if (trick?.available !== true) return;\n const sign = this.backward() ? -1 : 1;\n const rates = this.rates();\n const now = trick.rate * sign;\n // Scanning this way: the next rate up, or normal playback past the last.\n const next = now > FLOOR ? rates[rates.indexOf(now) + 1] : rates[0];\n trick.setRate(next === undefined ? 1 : next * sign);\n this.render();\n }\n\n protected override attach(player: PlayerHost): void {\n const tick = (): void => {\n this.render();\n };\n this.listen(player.video, ['emptied'], tick);\n this.observe(player, ['live', 'seekable'], tick);\n this.follow(player, (engine) => {\n tick();\n if (engine === null) return undefined;\n const offs = ENGINE_EVENTS.map((name) => engine.on(name, tick));\n return () => {\n for (const off of offs) off();\n };\n });\n }\n\n protected override render(): void {\n const trick = optional(this.player?.engine ?? null).trick;\n const backward = this.backward();\n const player = this.player;\n const unseekable = player?.hasAttribute('live') === true && !player.hasAttribute('seekable');\n this.hidden = trick?.available !== true || unseekable;\n const rate = trick?.rate ?? 1;\n const on = backward ? rate < -FLOOR : rate > FLOOR;\n this.toggleAttribute('scanning', on);\n this.button.setAttribute('aria-pressed', String(on));\n this.badge.hidden = !on;\n this.badge.textContent = on ? `${Math.abs(rate)}×` : '';\n setChildren(this.glyph, icon(backward ? 'fast-backward' : 'fast-forward'));\n const name = this.getAttribute('label') ?? (backward ? 'Rewind' : 'Fast forward');\n this.button.setAttribute('aria-label', name);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAoBA,MAAA,YAAA;AAGA,MAAA,QAAA;CAAA;CAAA;CAAA;AAAA;;AAGA,MAAA,QAAA;;;;;;AAOA,MAAA,gBAAA,CAAA,cAAA,gBAAA;AAEA,MAAA,QAAA,eAAA;AAEA,IAAA,gBAAA,cAAA,UAAA;CACA,WAAA,qBAAA;EACA,OAAA;GAAA;GAAA;GAAA;EAAA;CACA;CAMA,cAAA;EACA,MAAA;EACA,MAAA,OAAA,KAAA,aAAA,EAAA,MAAA,OAAA,CAAA;EACA,KAAA,SAAA,GAAA,UAAA,QAAA;EACA,KAAA,OAAA,OAAA;EACA,KAAA,QAAA,SAAA,cAAA,MAAA;EACA,KAAA,MAAA,OAAA;EACA,KAAA,QAAA,GA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AA,QAAA,SAAA,KAAA,QAAA,UAAA,IAAA,CAAA,CAAA;EACA,MAAA,WAAA,KAAA,SAAA;EACA,MAAA,SAAA,KAAA;EACA,MAAA,aAAA,QAAA,aAAA,MAAA,MAAA,QAAA,CAAA,OAAA,aAAA,UAAA;EACA,KAAA,SAAA,OAAA,cAAA,QAAA;EACA,MAAA,OAAA,OAAA,QAAA;EACA,MAAA,KAAA,WAAA,OAAA,KAAA,OAAA;EACA,KAAA,gBAAA,YAAA,EAAA;EACA,KAAA,OAAA,aAAA,gBAAA,OAAA,EAAA,CAAA;EACA,KAAA,MAAA,SAAA,CAAA;EACA,KAAA,MAAA,cAAA,KAAA,GAAA,KAAA,IAAA,IAAA,EAAA,KAAA;EACA,YAAA,KAAA,OAAA,KAAA,WAAA,kBAAA,cAAA,CAAA;EACA,MAAA,OAAA,KAAA,aAAA,OAAA,MAAA,WAAA,WAAA;EACA,KAAA,OAAA,aAAA,cAAA,IAAA;CACA;AACA"}
@@ -9,27 +9,48 @@
9
9
  * `live-window` forward buffer goals long, the goal read from the engine.
10
10
  * Below that the bar hides. VOD is always seekable. The element sets
11
11
  * `live` and `seekable` on the player, which the time and the live button
12
- * read.
12
+ * read, and `scrubbing` while a pointer holds the thumb: `playing` or
13
+ * `paused`, the state before the drag, which the play buttons show
14
+ * instead of the drag's own pause.
13
15
  *
14
16
  * Reads happen on the events the video already fires; the live window has
15
17
  * 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.
18
+ * While a pointer holds the thumb, the played layer follows the pointer.
19
+ * The element carries `dragging` meanwhile. With an I-frame track
20
+ * (`engine.trick.available`), the drag scrubs: the video pauses and shows
21
+ * the I-frame at every position, and the release seeks there. See the
22
+ * engine guide's trick play chapter. `scrub="false"` turns this off.
23
+ * Otherwise the video pauses, `currentTime` is written at most once per
24
+ * frame, so the bar never fights a slow seek, and the release resumes
25
+ * playback if it was playing. Thumbnail tiles never drive a drag: they are
26
+ * previews, not frames of the video.
19
27
  *
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.
28
+ * The preview above the pointer carries the time and a picture of that
29
+ * time from the sources `preview` names, in order of preference: `frames`
30
+ * and `tiles`, "frames tiles" by default, `none` for no picture. A frame
31
+ * is the decoded I-frame from `engine.trick.frameAt`, when the track
32
+ * decodes in this browser; the last one stays until the next arrives, so
33
+ * the picture never flickers while the engine decodes. A tile comes from
34
+ * `engine.thumbnails`: a rectangle of a sprite, drawn by background
35
+ * position at the sprite's own size. Both scale to `--mbx-preview-width`,
36
+ * so a page sets the size with one token.
24
37
  *
25
38
  * Chapters divide the track: one gap per chapter boundary, cut through
26
39
  * 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.
40
+ * chapter, and the preview names the chapter under the pointer. They come
41
+ * from the session, see `controls/chapters.ts`. `chapters` lists what the
42
+ * bar does with them: `divided` and `titles`, both by default, one of
43
+ * them alone, or `none`.
30
44
  *
31
45
  * `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
46
+ * Up and Page Down do, in seconds. `key-mode="preview"`, for a TV, makes
47
+ * the keys aim instead of seek: the thumb and the preview show the target,
48
+ * a held key's step grows, and the seek comes on Enter, on leaving the bar,
49
+ * or a second after the last key. Escape or Back drops the target. The
50
+ * control bar's seeking keys, the arrows and fast forward and rewind
51
+ * anywhere in the player, aim the same way: the bar asks through
52
+ * `seekkey`, and the seek bar takes it. The default, `instant`, seeks on
53
+ * every key. The name comes from `label`; what a
33
54
  * screen reader hears at a position from `label-of`, "{current} of
34
55
  * {duration}", and on live from `label-behind`, "{time} behind live". It
35
56
  * sits in the bar's seek row unless the page says otherwise.
@@ -40,6 +61,8 @@ export declare class MbxSeekBar extends Component {
40
61
  static get observedAttributes(): readonly string[];
41
62
  private readonly bar;
42
63
  private readonly buffered;
64
+ /** The ranges the page marked blocked, drawn as a broken line: they never play. */
65
+ private readonly blocked;
43
66
  private readonly hover;
44
67
  private readonly edge;
45
68
  private readonly preview;
@@ -47,6 +70,21 @@ export declare class MbxSeekBar extends Component {
47
70
  private readonly tile;
48
71
  private readonly time;
49
72
  private readonly caption;
73
+ private readonly frameCanvas;
74
+ private drag;
75
+ /** The last position of the drag, which a cancelled drag settles at. */
76
+ private dragged;
77
+ /** Whether the video played when a seeking drag began, so the release resumes it. */
78
+ private resume;
79
+ /** Frames asked for, and the newest one on screen, so a late frame never replaces a newer one. */
80
+ private asked;
81
+ /** Under `key-mode="preview"`: where the keys aim, not yet sought to, or null. */
82
+ private target;
83
+ private commitTimer;
84
+ /** The moves of the current hold, and when the last one came. */
85
+ private moves;
86
+ private lastMove;
87
+ private shown;
50
88
  private range;
51
89
  /** The chapters as last drawn, so the mask is written only when they change. */
52
90
  private divided;
@@ -56,7 +94,7 @@ export declare class MbxSeekBar extends Component {
56
94
  constructor();
57
95
  connectedCallback(): void;
58
96
  private isLive;
59
- /** Whether the chapters divide the track and name the preview. */
97
+ /** Whether the chapters do `use`: `divided` the track, or name the preview with their `titles`. */
60
98
  private chaptered;
61
99
  /** The gaps at the chapter boundaries, on every layer of the track at once. */
62
100
  private paintChapters;
@@ -64,17 +102,63 @@ export declare class MbxSeekBar extends Component {
64
102
  private say;
65
103
  /** What the preview shows at a time. */
66
104
  private label;
105
+ /** Scrubs when the session has an I-frame track and the page allows it; seeks otherwise. */
106
+ private dragStart;
107
+ /**
108
+ * The pointer let go. A release writes its own input next, in the same
109
+ * task, and that settles the drag. A cancelled drag writes none, so the
110
+ * drag settles at its last position once the task is over.
111
+ */
112
+ private dragEnd;
113
+ /** Ends the drag at `value`, or where it stands when there is none. */
114
+ private settle;
115
+ /** Whether keys aim a target with the preview instead of seeking at once. */
116
+ private previewing;
117
+ /** The step for a key on the slider itself. */
118
+ private keyStep;
119
+ /**
120
+ * How many steps a key moves the target under `key-mode="preview"`. It
121
+ * grows while the viewer holds the key, so a long film takes seconds to
122
+ * cross, not minutes; a pause restarts it.
123
+ */
124
+ private growth;
125
+ /**
126
+ * Aims at `value` without seeking: the thumb and the preview show it, and
127
+ * the seek comes on Enter or once the keys pause. A TV decodes slowly, so
128
+ * a seek per key would stutter where the preview already shows the place.
129
+ */
130
+ private aim;
131
+ /** Seeks to the target, if there is one. */
132
+ private commit;
133
+ /** Drops the target: the thumb goes back to the playhead. */
134
+ private cancel;
135
+ private stopAiming;
67
136
  private input;
68
137
  private flush;
69
138
  /** The width the page asked for through the token, or the default. */
70
139
  private previewWidth;
71
- /** The tile for a time, if the track has one, drawn at its size and scaled to fit. */
140
+ /** The preview's picture sources from `preview`, in order of preference: frames then tiles by default. */
141
+ private sources;
142
+ /** `tile`, or none, drawn at its size and scaled to fit. */
72
143
  private paintTile;
73
- private paintBuffered;
144
+ /**
145
+ * The picture in the preview, from the sources `preview` names, the first
146
+ * that answers winning. A decoded frame arrives later than a tile, so
147
+ * while frames lead, the tile stands in until one is on screen, and the
148
+ * last frame stays until the next one arrives. A scrub already shows the
149
+ * position in the video, so the preview shows none meanwhile.
150
+ */
151
+ private paintPicture;
152
+ /** The ranges the page marked blocked. */
153
+ private blockedRanges;
154
+ /** One child of `layer` per range, each named `part`, placed along the track. */
155
+ private paintRanges;
74
156
  /** Whether a live window is wide enough to be worth a bar. */
75
157
  private worthSeeking;
76
158
  /** The hover marker and the preview follow the pointer, clamped to the bar. */
77
159
  private point;
160
+ /** The preview over `part` of the bar: the time, the chapter, and the picture. */
161
+ private previewAt;
78
162
  private leave;
79
163
  protected attach(player: PlayerHost): void;
80
164
  protected detach(player: PlayerHost): void;