@mattebox/player 0.6.0 → 0.7.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 (241) 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 +1 -1
  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/menu.d.ts +7 -4
  19. package/dist/controls/menu.d.ts.map +1 -1
  20. package/dist/controls/menu.js +241 -223
  21. package/dist/controls/menu.js.map +1 -1
  22. package/dist/controls/pip.js +35 -49
  23. package/dist/controls/pip.js.map +1 -1
  24. package/dist/controls/ranges.js +42 -37
  25. package/dist/controls/ranges.js.map +1 -1
  26. package/dist/controls/session.d.ts +6 -1
  27. package/dist/controls/session.d.ts.map +1 -1
  28. package/dist/controls/session.js +41 -26
  29. package/dist/controls/session.js.map +1 -1
  30. package/dist/controls/slider.d.ts +2 -2
  31. package/dist/controls/slider.d.ts.map +1 -1
  32. package/dist/controls/slider.js +151 -159
  33. package/dist/controls/slider.js.map +1 -1
  34. package/dist/controls/time.js +17 -17
  35. package/dist/controls/time.js.map +1 -1
  36. package/dist/dom.d.ts +6 -0
  37. package/dist/dom.d.ts.map +1 -1
  38. package/dist/dom.js +28 -19
  39. package/dist/dom.js.map +1 -1
  40. package/dist/element-entry.js +9 -6
  41. package/dist/element-entry.js.map +1 -1
  42. package/dist/element.d.ts +4 -2
  43. package/dist/element.d.ts.map +1 -1
  44. package/dist/element.js +384 -443
  45. package/dist/element.js.map +1 -1
  46. package/dist/elements/airplay-button.js +51 -53
  47. package/dist/elements/airplay-button.js.map +1 -1
  48. package/dist/elements/audio-menu.js +62 -63
  49. package/dist/elements/audio-menu.js.map +1 -1
  50. package/dist/elements/chapters-menu.d.ts.map +1 -1
  51. package/dist/elements/chapters-menu.js +75 -65
  52. package/dist/elements/chapters-menu.js.map +1 -1
  53. package/dist/elements/component.d.ts +1 -1
  54. package/dist/elements/component.d.ts.map +1 -1
  55. package/dist/elements/component.js +86 -89
  56. package/dist/elements/component.js.map +1 -1
  57. package/dist/elements/control-bar.d.ts +18 -5
  58. package/dist/elements/control-bar.d.ts.map +1 -1
  59. package/dist/elements/control-bar.js +282 -319
  60. package/dist/elements/control-bar.js.map +1 -1
  61. package/dist/elements/current-time.js +26 -25
  62. package/dist/elements/current-time.js.map +1 -1
  63. package/dist/elements/drm-badge.d.ts.map +1 -1
  64. package/dist/elements/drm-badge.js +107 -141
  65. package/dist/elements/drm-badge.js.map +1 -1
  66. package/dist/elements/duration.d.ts.map +1 -1
  67. package/dist/elements/duration.js +24 -21
  68. package/dist/elements/duration.js.map +1 -1
  69. package/dist/elements/error-screen.d.ts.map +1 -1
  70. package/dist/elements/error-screen.js +68 -102
  71. package/dist/elements/error-screen.js.map +1 -1
  72. package/dist/elements/fullscreen-button.js +48 -54
  73. package/dist/elements/fullscreen-button.js.map +1 -1
  74. package/dist/elements/live-button.d.ts.map +1 -1
  75. package/dist/elements/live-button.js +67 -94
  76. package/dist/elements/live-button.js.map +1 -1
  77. package/dist/elements/menu-element.js +31 -28
  78. package/dist/elements/menu-element.js.map +1 -1
  79. package/dist/elements/mute-button.js +58 -59
  80. package/dist/elements/mute-button.js.map +1 -1
  81. package/dist/elements/pip-button.js +54 -54
  82. package/dist/elements/pip-button.js.map +1 -1
  83. package/dist/elements/play-button.d.ts.map +1 -1
  84. package/dist/elements/play-button.js +73 -58
  85. package/dist/elements/play-button.js.map +1 -1
  86. package/dist/elements/quality-menu.js +66 -69
  87. package/dist/elements/quality-menu.js.map +1 -1
  88. package/dist/elements/remaining-time.d.ts.map +1 -1
  89. package/dist/elements/remaining-time.js +27 -24
  90. package/dist/elements/remaining-time.js.map +1 -1
  91. package/dist/elements/scan-button.d.ts +17 -0
  92. package/dist/elements/scan-button.d.ts.map +1 -0
  93. package/dist/elements/scan-button.js +117 -0
  94. package/dist/elements/scan-button.js.map +1 -0
  95. package/dist/elements/seek-bar.d.ts +93 -14
  96. package/dist/elements/seek-bar.d.ts.map +1 -1
  97. package/dist/elements/seek-bar.js +475 -335
  98. package/dist/elements/seek-bar.js.map +1 -1
  99. package/dist/elements/shared.d.ts +3 -11
  100. package/dist/elements/shared.d.ts.map +1 -1
  101. package/dist/elements/shared.js +44 -144
  102. package/dist/elements/shared.js.map +1 -1
  103. package/dist/elements/skip-button.d.ts.map +1 -1
  104. package/dist/elements/skip-button.js +54 -55
  105. package/dist/elements/skip-button.js.map +1 -1
  106. package/dist/elements/spacer.d.ts.map +1 -1
  107. package/dist/elements/spacer.js +12 -7
  108. package/dist/elements/spacer.js.map +1 -1
  109. package/dist/elements/speed-menu.js +60 -55
  110. package/dist/elements/speed-menu.js.map +1 -1
  111. package/dist/elements/spinner.d.ts.map +1 -1
  112. package/dist/elements/spinner.js +52 -78
  113. package/dist/elements/spinner.js.map +1 -1
  114. package/dist/elements/start-button.d.ts.map +1 -1
  115. package/dist/elements/start-button.js +107 -120
  116. package/dist/elements/start-button.js.map +1 -1
  117. package/dist/elements/subtitles-menu.js +95 -103
  118. package/dist/elements/subtitles-menu.js.map +1 -1
  119. package/dist/elements/time-element.d.ts.map +1 -1
  120. package/dist/elements/time-element.js +36 -28
  121. package/dist/elements/time-element.js.map +1 -1
  122. package/dist/elements/title.d.ts.map +1 -1
  123. package/dist/elements/title.js +105 -137
  124. package/dist/elements/title.js.map +1 -1
  125. package/dist/elements/volume-slider.d.ts.map +1 -1
  126. package/dist/elements/volume-slider.js +47 -45
  127. package/dist/elements/volume-slider.js.map +1 -1
  128. package/dist/elements/volume.d.ts.map +1 -1
  129. package/dist/elements/volume.js +42 -50
  130. package/dist/elements/volume.js.map +1 -1
  131. package/dist/entries/airplay-button.js +7 -7
  132. package/dist/entries/airplay-button.js.map +1 -1
  133. package/dist/entries/audio-menu.js +7 -6
  134. package/dist/entries/audio-menu.js.map +1 -1
  135. package/dist/entries/chapters-menu.js +7 -7
  136. package/dist/entries/chapters-menu.js.map +1 -1
  137. package/dist/entries/control-bar.js +7 -6
  138. package/dist/entries/control-bar.js.map +1 -1
  139. package/dist/entries/current-time.js +7 -6
  140. package/dist/entries/current-time.js.map +1 -1
  141. package/dist/entries/drm-badge.js +7 -6
  142. package/dist/entries/drm-badge.js.map +1 -1
  143. package/dist/entries/duration.js +7 -6
  144. package/dist/entries/duration.js.map +1 -1
  145. package/dist/entries/error-screen.js +7 -6
  146. package/dist/entries/error-screen.js.map +1 -1
  147. package/dist/entries/fullscreen-button.js +7 -6
  148. package/dist/entries/fullscreen-button.js.map +1 -1
  149. package/dist/entries/live-button.js +7 -6
  150. package/dist/entries/live-button.js.map +1 -1
  151. package/dist/entries/mute-button.js +7 -6
  152. package/dist/entries/mute-button.js.map +1 -1
  153. package/dist/entries/pip-button.js +7 -6
  154. package/dist/entries/pip-button.js.map +1 -1
  155. package/dist/entries/play-button.js +7 -6
  156. package/dist/entries/play-button.js.map +1 -1
  157. package/dist/entries/quality-menu.js +7 -6
  158. package/dist/entries/quality-menu.js.map +1 -1
  159. package/dist/entries/remaining-time.js +7 -7
  160. package/dist/entries/remaining-time.js.map +1 -1
  161. package/dist/entries/scan-button.d.ts +5 -0
  162. package/dist/entries/scan-button.d.ts.map +1 -0
  163. package/dist/entries/scan-button.js +9 -0
  164. package/dist/entries/scan-button.js.map +1 -0
  165. package/dist/entries/seek-bar.js +7 -6
  166. package/dist/entries/seek-bar.js.map +1 -1
  167. package/dist/entries/skip-button.js +7 -6
  168. package/dist/entries/skip-button.js.map +1 -1
  169. package/dist/entries/spacer.js +7 -6
  170. package/dist/entries/spacer.js.map +1 -1
  171. package/dist/entries/speed-menu.js +7 -6
  172. package/dist/entries/speed-menu.js.map +1 -1
  173. package/dist/entries/spinner.js +7 -7
  174. package/dist/entries/spinner.js.map +1 -1
  175. package/dist/entries/start-button.js +7 -6
  176. package/dist/entries/start-button.js.map +1 -1
  177. package/dist/entries/subtitles-menu.js +7 -6
  178. package/dist/entries/subtitles-menu.js.map +1 -1
  179. package/dist/entries/title.js +7 -7
  180. package/dist/entries/title.js.map +1 -1
  181. package/dist/entries/volume-slider.js +7 -6
  182. package/dist/entries/volume-slider.js.map +1 -1
  183. package/dist/entries/volume.js +9 -8
  184. package/dist/entries/volume.js.map +1 -1
  185. package/dist/es2015/controls/chapters.js +40 -7
  186. package/dist/es2015/controls/cues.js +1 -8
  187. package/dist/es2015/controls/icons.js +3 -1
  188. package/dist/es2015/controls/menu.js +27 -8
  189. package/dist/es2015/controls/session.js +16 -4
  190. package/dist/es2015/controls/slider.js +5 -4
  191. package/dist/es2015/dom.js +10 -1
  192. package/dist/es2015/element.js +23 -7
  193. package/dist/es2015/elements/chapters-menu.js +18 -10
  194. package/dist/es2015/elements/control-bar.js +41 -35
  195. package/dist/es2015/elements/drm-badge.js +1 -25
  196. package/dist/es2015/elements/duration.js +2 -1
  197. package/dist/es2015/elements/error-screen.js +1 -30
  198. package/dist/es2015/elements/live-button.js +1 -29
  199. package/dist/es2015/elements/menu-element.js +2 -2
  200. package/dist/es2015/elements/play-button.js +10 -3
  201. package/dist/es2015/elements/remaining-time.js +2 -1
  202. package/dist/es2015/elements/scan-button.js +118 -0
  203. package/dist/es2015/elements/seek-bar.js +264 -71
  204. package/dist/es2015/elements/shared.js +5 -106
  205. package/dist/es2015/elements/skip-button.js +2 -1
  206. package/dist/es2015/elements/spacer.js +2 -1
  207. package/dist/es2015/elements/spinner.js +1 -32
  208. package/dist/es2015/elements/start-button.js +8 -26
  209. package/dist/es2015/elements/time-element.js +1 -4
  210. package/dist/es2015/elements/title.js +1 -45
  211. package/dist/es2015/elements/volume-slider.js +2 -1
  212. package/dist/es2015/elements/volume.js +1 -11
  213. package/dist/es2015/entries/scan-button.js +7 -0
  214. package/dist/es2015/index.js +3 -1
  215. package/dist/es2015/style.js +1 -101
  216. package/dist/es2015/tags.js +2 -1
  217. package/dist/host.js +19 -17
  218. package/dist/host.js.map +1 -1
  219. package/dist/index.d.ts +3 -0
  220. package/dist/index.d.ts.map +1 -1
  221. package/dist/index.js +55 -27
  222. package/dist/labels.js +13 -9
  223. package/dist/labels.js.map +1 -1
  224. package/dist/namespaces.d.ts +9 -26
  225. package/dist/namespaces.d.ts.map +1 -1
  226. package/dist/namespaces.js +6 -2
  227. package/dist/namespaces.js.map +1 -1
  228. package/dist/presets.js +33 -28
  229. package/dist/presets.js.map +1 -1
  230. package/dist/style.d.ts +1 -20
  231. package/dist/style.d.ts.map +1 -1
  232. package/dist/style.js +4 -100
  233. package/dist/style.js.map +1 -1
  234. package/dist/surface.js +25 -21
  235. package/dist/surface.js.map +1 -1
  236. package/dist/tags.d.ts +1 -0
  237. package/dist/tags.d.ts.map +1 -1
  238. package/dist/tags.js +31 -26
  239. package/dist/tags.js.map +1 -1
  240. package/package.json +4 -4
  241. package/dist/index.js.map +0 -1
@@ -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,CAA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;QAC3B,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;YACpB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;YACnB,OAAO;QACT,CAAC;QACD,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;QAC/B,MAAM,KAAK,GAAqC;YAC9C,CAAC,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,IAAI,MAAM,CAAC;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`. A rendition\n * reads as its height when the manifest declared one, its bitrate\n * otherwise.\n */\nimport type { Mattebox, Rendition } from 'mattebox';\nimport type { PlayerHost } from '../host.js';\nimport { MenuElement, single } from './menu-element.js';\nimport { show } from './shared.js';\n\nconst AUTO = 'auto';\n\nfunction renditionLabel(rendition: Rendition): string {\n if (rendition.height !== undefined) return `${rendition.height}p`;\n return `${Math.round(rendition.bitrate / 1000)} kbps`;\n}\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\n constructor() {\n super(...single('settings'));\n this.engine = null;\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 const offs = [\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 const items: Array<readonly [string, string]> = [\n [AUTO, this.getAttribute('label-auto') ?? 'Auto'],\n ];\n for (const rendition of quality.renditions) {\n items.push([rendition.id, renditionLabel(rendition)]);\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 = quality.renditions.length === 0;\n }\n}\n"],"mappings":";;;AAYA,MAAM,OAAO;AAEb,SAAS,eAAe,WAA8B;CACpD,IAAI,UAAU,WAAW,KAAA,GAAW,OAAO,GAAG,UAAU,OAAO;CAC/D,OAAO,GAAG,KAAK,MAAM,UAAU,UAAU,GAAI,EAAE;AACjD;AAEA,IAAa,iBAAb,cAAoC,YAAY;CAC9C,WAAW,qBAAwC;EACjD,OAAO;GAAC;GAAS;GAAc;EAAY;CAC7C;CAIA,cAAc;EACZ,MAAM,GAAG,OAAO,UAAU,CAAC;EAC3B,KAAK,SAAS;EACd,KAAK,KAAK,OAAO,SAAS;CAC5B;CAEA,OAAkC;EAChC,OAAO;CACT;CAEA,OAA0B,QAA0B;EAClD,KAAK,OAAO,SAAS,WAAW;GAC9B,KAAK,SAAS;GACd,KAAK,OAAO;GACZ,IAAI,WAAW,MAAM,OAAO,KAAA;GAC5B,MAAM,aAAmB;IACvB,KAAK,OAAO;GACd;GACA,MAAM,OAAO;IACX,OAAO,GAAG,kBAAkB,IAAI;IAChC,OAAO,GAAG,qCAAqC,IAAI;IACnD,OAAO,GAAG,6BAA6B,IAAI;GAC7C;GACA,aAAa;IACX,KAAK,MAAM,OAAO,MAAM,IAAI;GAC9B;EACF,CAAC;CACH;CAEA,SAAkC;EAChC,MAAM,OAAO;EACb,MAAM,SAAS,KAAK;EACpB,IAAI,WAAW,MAAM;GACnB,KAAK,SAAS;GACd;EACF;EACA,MAAM,UAAU,OAAO;EACvB,MAAM,QAA0C,CAC9C,CAAC,MAAM,KAAK,aAAa,YAAY,KAAK,MAAM,CAClD;EACA,KAAK,MAAM,aAAa,QAAQ,YAC9B,MAAM,KAAK,CAAC,UAAU,IAAI,eAAe,SAAS,CAAC,CAAC;EAEtD,KAAK,KAAK,KAAK,CACb;GACE,MAAM;GACN;GACA,OAAO,QAAQ,UAAU;GACzB,WAAW,UAAU;IACnB,IAAI,UAAU,MAAM,QAAQ,KAAK;SAC5B,QAAQ,IAAI,KAAK;IACtB,KAAK,OAAO;GACd;EACF,CACF,CAAC;EACD,KAAK,SAAS,QAAQ,WAAW,WAAW;CAC9C;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,GAAA,QAAA,MAAA;EACA,KAAA,MAAA,SAAA;EACA,KAAA,OAAA,OAAA,KAAA,OAAA,KAAA,KAAA;EACA,KAAA,OAAA,iBAAA,eAAA;GACA,KAAA,KAAA;EACA,CAAA;EACA,KAAA,OAAA,MAAA,KAAA,GAAA,KAAA,MAAA;CACA;CAEA,oBAAA;EAGA,KAAA,SAAA;EACA,MAAA,kBAAA;CACA;CAEA,WAAA;EACA,OAAA,KAAA,aAAA,WAAA,MAAA;CACA;;CAGA,QAAA;EACA,MAAA,OAAA,KAAA,aAAA,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A,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.
@@ -47,6 +68,21 @@ export declare class MbxSeekBar extends Component {
47
68
  private readonly tile;
48
69
  private readonly time;
49
70
  private readonly caption;
71
+ private readonly frameCanvas;
72
+ private drag;
73
+ /** The last position of the drag, which a cancelled drag settles at. */
74
+ private dragged;
75
+ /** Whether the video played when a seeking drag began, so the release resumes it. */
76
+ private resume;
77
+ /** Frames asked for, and the newest one on screen, so a late frame never replaces a newer one. */
78
+ private asked;
79
+ /** Under `key-mode="preview"`: where the keys aim, not yet sought to, or null. */
80
+ private target;
81
+ private commitTimer;
82
+ /** The moves of the current hold, and when the last one came. */
83
+ private moves;
84
+ private lastMove;
85
+ private shown;
50
86
  private range;
51
87
  /** The chapters as last drawn, so the mask is written only when they change. */
52
88
  private divided;
@@ -56,7 +92,7 @@ export declare class MbxSeekBar extends Component {
56
92
  constructor();
57
93
  connectedCallback(): void;
58
94
  private isLive;
59
- /** Whether the chapters divide the track and name the preview. */
95
+ /** Whether the chapters do `use`: `divided` the track, or name the preview with their `titles`. */
60
96
  private chaptered;
61
97
  /** The gaps at the chapter boundaries, on every layer of the track at once. */
62
98
  private paintChapters;
@@ -64,17 +100,60 @@ export declare class MbxSeekBar extends Component {
64
100
  private say;
65
101
  /** What the preview shows at a time. */
66
102
  private label;
103
+ /** Scrubs when the session has an I-frame track and the page allows it; seeks otherwise. */
104
+ private dragStart;
105
+ /**
106
+ * The pointer let go. A release writes its own input next, in the same
107
+ * task, and that settles the drag. A cancelled drag writes none, so the
108
+ * drag settles at its last position once the task is over.
109
+ */
110
+ private dragEnd;
111
+ /** Ends the drag at `value`, or where it stands when there is none. */
112
+ private settle;
113
+ /** Whether keys aim a target with the preview instead of seeking at once. */
114
+ private previewing;
115
+ /** The step for a key on the slider itself. */
116
+ private keyStep;
117
+ /**
118
+ * How many steps a key moves the target under `key-mode="preview"`. It
119
+ * grows while the viewer holds the key, so a long film takes seconds to
120
+ * cross, not minutes; a pause restarts it.
121
+ */
122
+ private growth;
123
+ /**
124
+ * Aims at `value` without seeking: the thumb and the preview show it, and
125
+ * the seek comes on Enter or once the keys pause. A TV decodes slowly, so
126
+ * a seek per key would stutter where the preview already shows the place.
127
+ */
128
+ private aim;
129
+ /** Seeks to the target, if there is one. */
130
+ private commit;
131
+ /** Drops the target: the thumb goes back to the playhead. */
132
+ private cancel;
133
+ private stopAiming;
67
134
  private input;
68
135
  private flush;
69
136
  /** The width the page asked for through the token, or the default. */
70
137
  private previewWidth;
71
- /** The tile for a time, if the track has one, drawn at its size and scaled to fit. */
138
+ /** The preview's picture sources from `preview`, in order of preference: frames then tiles by default. */
139
+ private sources;
140
+ /** `tile`, or none, drawn at its size and scaled to fit. */
72
141
  private paintTile;
142
+ /**
143
+ * The picture in the preview, from the sources `preview` names, the first
144
+ * that answers winning. A decoded frame arrives later than a tile, so
145
+ * while frames lead, the tile stands in until one is on screen, and the
146
+ * last frame stays until the next one arrives. A scrub already shows the
147
+ * position in the video, so the preview shows none meanwhile.
148
+ */
149
+ private paintPicture;
73
150
  private paintBuffered;
74
151
  /** Whether a live window is wide enough to be worth a bar. */
75
152
  private worthSeeking;
76
153
  /** The hover marker and the preview follow the pointer, clamped to the bar. */
77
154
  private point;
155
+ /** The preview over `part` of the bar: the time, the chapter, and the picture. */
156
+ private previewAt;
78
157
  private leave;
79
158
  protected attach(player: PlayerHost): void;
80
159
  protected detach(player: PlayerHost): void;
@@ -1 +1 @@
1
- {"version":3,"file":"seek-bar.d.ts","sourceRoot":"","sources":["../../src/elements/seek-bar.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAWH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AA8E3C,qBAAa,UAAW,SAAQ,SAAS;IACvC,MAAM,KAAK,kBAAkB,IAAI,SAAS,MAAM,EAAE,CAEjD;IAED,iBAAyB,GAAG,CAAS;IACrC,iBAAyB,QAAQ,CAAc;IAC/C,iBAAyB,KAAK,CAAc;IAC5C,iBAAyB,IAAI,CAAc;IAC3C,iBAAyB,OAAO,CAAc;IAC9C,iBAAyB,KAAK,CAAc;IAC5C,iBAAyB,IAAI,CAAc;IAC3C,iBAAyB,IAAI,CAAc;IAC3C,iBAAyB,OAAO,CAAc;IAC9C,QAAgB,KAAK,CAAO;IAC5B,gFAAgF;IAChF,QAAgB,OAAO,CAAS;IAChC,QAAgB,IAAI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