@mattebox/player 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (410) hide show
  1. package/README.md +4 -3
  2. package/dist/cdn/mattebox-player.min.js +200 -196
  3. package/dist/compose.d.ts +5 -0
  4. package/dist/compose.d.ts.map +1 -0
  5. package/dist/compose.js +31 -0
  6. package/dist/compose.js.map +1 -0
  7. package/dist/controls/chapters.d.ts +29 -0
  8. package/dist/controls/chapters.d.ts.map +1 -0
  9. package/dist/controls/chapters.js +81 -0
  10. package/dist/controls/chapters.js.map +1 -0
  11. package/dist/controls/cues.d.ts +8 -3
  12. package/dist/controls/cues.d.ts.map +1 -1
  13. package/dist/controls/cues.js +44 -10
  14. package/dist/controls/cues.js.map +1 -1
  15. package/dist/controls/fullscreen.d.ts +9 -9
  16. package/dist/controls/fullscreen.d.ts.map +1 -1
  17. package/dist/controls/fullscreen.js +17 -21
  18. package/dist/controls/fullscreen.js.map +1 -1
  19. package/dist/controls/icons.d.ts +1 -3
  20. package/dist/controls/icons.d.ts.map +1 -1
  21. package/dist/controls/icons.js +3 -6
  22. package/dist/controls/icons.js.map +1 -1
  23. package/dist/controls/menu.d.ts +14 -11
  24. package/dist/controls/menu.d.ts.map +1 -1
  25. package/dist/controls/menu.js +39 -34
  26. package/dist/controls/menu.js.map +1 -1
  27. package/dist/controls/session.d.ts +27 -0
  28. package/dist/controls/session.d.ts.map +1 -0
  29. package/dist/controls/session.js +36 -0
  30. package/dist/controls/session.js.map +1 -0
  31. package/dist/controls/slider.d.ts +6 -6
  32. package/dist/controls/slider.d.ts.map +1 -1
  33. package/dist/controls/slider.js +18 -13
  34. package/dist/controls/slider.js.map +1 -1
  35. package/dist/dom.d.ts +4 -10
  36. package/dist/dom.d.ts.map +1 -1
  37. package/dist/dom.js +4 -24
  38. package/dist/dom.js.map +1 -1
  39. package/dist/element-entry.d.ts +4 -0
  40. package/dist/element-entry.d.ts.map +1 -0
  41. package/dist/element-entry.js +9 -0
  42. package/dist/element-entry.js.map +1 -0
  43. package/dist/element.d.ts +54 -14
  44. package/dist/element.d.ts.map +1 -1
  45. package/dist/element.js +154 -73
  46. package/dist/element.js.map +1 -1
  47. package/dist/elements/audio-menu.d.ts +24 -0
  48. package/dist/elements/audio-menu.d.ts.map +1 -0
  49. package/dist/elements/audio-menu.js +70 -0
  50. package/dist/elements/audio-menu.js.map +1 -0
  51. package/dist/elements/chapters-menu.d.ts +12 -0
  52. package/dist/elements/chapters-menu.d.ts.map +1 -0
  53. package/dist/elements/chapters-menu.js +67 -0
  54. package/dist/elements/chapters-menu.js.map +1 -0
  55. package/dist/elements/component.d.ts +45 -0
  56. package/dist/elements/component.d.ts.map +1 -0
  57. package/dist/elements/component.js +90 -0
  58. package/dist/elements/component.js.map +1 -0
  59. package/dist/elements/control-bar.d.ts +46 -0
  60. package/dist/elements/control-bar.d.ts.map +1 -0
  61. package/dist/elements/control-bar.js +207 -0
  62. package/dist/elements/control-bar.js.map +1 -0
  63. package/dist/elements/current-time.d.ts +5 -0
  64. package/dist/elements/current-time.d.ts.map +1 -0
  65. package/dist/elements/current-time.js +27 -0
  66. package/dist/elements/current-time.js.map +1 -0
  67. package/dist/elements/drm-badge.d.ts +29 -0
  68. package/dist/elements/drm-badge.d.ts.map +1 -0
  69. package/dist/elements/drm-badge.js +145 -0
  70. package/dist/elements/drm-badge.js.map +1 -0
  71. package/dist/elements/duration.d.ts +6 -0
  72. package/dist/elements/duration.d.ts.map +1 -0
  73. package/dist/elements/duration.js +23 -0
  74. package/dist/elements/duration.js.map +1 -0
  75. package/dist/elements/error-screen.d.ts +17 -0
  76. package/dist/elements/error-screen.d.ts.map +1 -0
  77. package/dist/elements/error-screen.js +103 -0
  78. package/dist/elements/error-screen.js.map +1 -0
  79. package/dist/elements/fullscreen-button.d.ts +19 -0
  80. package/dist/elements/fullscreen-button.d.ts.map +1 -0
  81. package/dist/elements/fullscreen-button.js +55 -0
  82. package/dist/elements/fullscreen-button.js.map +1 -0
  83. package/dist/elements/live-button.d.ts +12 -0
  84. package/dist/elements/live-button.d.ts.map +1 -0
  85. package/dist/elements/live-button.js +96 -0
  86. package/dist/elements/live-button.js.map +1 -0
  87. package/dist/elements/menu-element.d.ts +22 -0
  88. package/dist/elements/menu-element.d.ts.map +1 -0
  89. package/dist/elements/menu-element.js +31 -0
  90. package/dist/elements/menu-element.js.map +1 -0
  91. package/dist/elements/mute-button.d.ts +12 -0
  92. package/dist/elements/mute-button.d.ts.map +1 -0
  93. package/dist/elements/mute-button.js +61 -0
  94. package/dist/elements/mute-button.js.map +1 -0
  95. package/dist/elements/panels.d.ts +15 -0
  96. package/dist/elements/panels.d.ts.map +1 -0
  97. package/dist/elements/panels.js +55 -0
  98. package/dist/elements/panels.js.map +1 -0
  99. package/dist/elements/pip-button.d.ts +13 -0
  100. package/dist/elements/pip-button.d.ts.map +1 -0
  101. package/dist/elements/pip-button.js +56 -0
  102. package/dist/elements/pip-button.js.map +1 -0
  103. package/dist/elements/play-button.d.ts +12 -0
  104. package/dist/elements/play-button.d.ts.map +1 -0
  105. package/dist/elements/play-button.js +60 -0
  106. package/dist/elements/play-button.js.map +1 -0
  107. package/dist/elements/quality-menu.d.ts +11 -0
  108. package/dist/elements/quality-menu.d.ts.map +1 -0
  109. package/dist/elements/quality-menu.js +72 -0
  110. package/dist/elements/quality-menu.js.map +1 -0
  111. package/dist/elements/seek-bar.d.ts +83 -0
  112. package/dist/elements/seek-bar.d.ts.map +1 -0
  113. package/dist/elements/seek-bar.js +352 -0
  114. package/dist/elements/seek-bar.js.map +1 -0
  115. package/dist/elements/shared.d.ts +27 -0
  116. package/dist/elements/shared.d.ts.map +1 -0
  117. package/dist/elements/shared.js +155 -0
  118. package/dist/elements/shared.js.map +1 -0
  119. package/dist/elements/skip-button.d.ts +14 -0
  120. package/dist/elements/skip-button.d.ts.map +1 -0
  121. package/dist/elements/skip-button.js +60 -0
  122. package/dist/elements/skip-button.js.map +1 -0
  123. package/dist/elements/spacer.d.ts +4 -0
  124. package/dist/elements/spacer.d.ts.map +1 -0
  125. package/dist/elements/spacer.js +9 -0
  126. package/dist/elements/spacer.js.map +1 -0
  127. package/dist/elements/speed-menu.d.ts +18 -0
  128. package/dist/elements/speed-menu.d.ts.map +1 -0
  129. package/dist/elements/speed-menu.js +56 -0
  130. package/dist/elements/speed-menu.js.map +1 -0
  131. package/dist/elements/start-button.d.ts +13 -0
  132. package/dist/elements/start-button.d.ts.map +1 -0
  133. package/dist/elements/start-button.js +83 -0
  134. package/dist/elements/start-button.js.map +1 -0
  135. package/dist/elements/subtitles-menu.d.ts +17 -0
  136. package/dist/elements/subtitles-menu.d.ts.map +1 -0
  137. package/dist/elements/subtitles-menu.js +108 -0
  138. package/dist/elements/subtitles-menu.js.map +1 -0
  139. package/dist/elements/time-element.d.ts +14 -0
  140. package/dist/elements/time-element.d.ts.map +1 -0
  141. package/dist/elements/time-element.js +29 -0
  142. package/dist/elements/time-element.js.map +1 -0
  143. package/dist/elements/volume-slider.d.ts +10 -0
  144. package/dist/elements/volume-slider.d.ts.map +1 -0
  145. package/dist/elements/volume-slider.js +46 -0
  146. package/dist/elements/volume-slider.js.map +1 -0
  147. package/dist/elements/volume.d.ts +9 -0
  148. package/dist/elements/volume.d.ts.map +1 -0
  149. package/dist/elements/volume.js +50 -0
  150. package/dist/elements/volume.js.map +1 -0
  151. package/dist/entries/audio-menu.d.ts +5 -0
  152. package/dist/entries/audio-menu.d.ts.map +1 -0
  153. package/dist/entries/audio-menu.js +8 -0
  154. package/dist/entries/audio-menu.js.map +1 -0
  155. package/dist/entries/chapters-menu.d.ts +5 -0
  156. package/dist/entries/chapters-menu.d.ts.map +1 -0
  157. package/dist/entries/chapters-menu.js +9 -0
  158. package/dist/entries/chapters-menu.js.map +1 -0
  159. package/dist/entries/control-bar.d.ts +5 -0
  160. package/dist/entries/control-bar.d.ts.map +1 -0
  161. package/dist/entries/control-bar.js +8 -0
  162. package/dist/entries/control-bar.js.map +1 -0
  163. package/dist/entries/current-time.d.ts +5 -0
  164. package/dist/entries/current-time.d.ts.map +1 -0
  165. package/dist/entries/current-time.js +8 -0
  166. package/dist/entries/current-time.js.map +1 -0
  167. package/dist/entries/drm-badge.d.ts +5 -0
  168. package/dist/entries/drm-badge.d.ts.map +1 -0
  169. package/dist/entries/drm-badge.js +8 -0
  170. package/dist/entries/drm-badge.js.map +1 -0
  171. package/dist/entries/duration.d.ts +5 -0
  172. package/dist/entries/duration.d.ts.map +1 -0
  173. package/dist/entries/duration.js +8 -0
  174. package/dist/entries/duration.js.map +1 -0
  175. package/dist/entries/error-screen.d.ts +5 -0
  176. package/dist/entries/error-screen.d.ts.map +1 -0
  177. package/dist/entries/error-screen.js +8 -0
  178. package/dist/entries/error-screen.js.map +1 -0
  179. package/dist/entries/fullscreen-button.d.ts +5 -0
  180. package/dist/entries/fullscreen-button.d.ts.map +1 -0
  181. package/dist/entries/fullscreen-button.js +8 -0
  182. package/dist/entries/fullscreen-button.js.map +1 -0
  183. package/dist/entries/live-button.d.ts +5 -0
  184. package/dist/entries/live-button.d.ts.map +1 -0
  185. package/dist/entries/live-button.js +8 -0
  186. package/dist/entries/live-button.js.map +1 -0
  187. package/dist/entries/mute-button.d.ts +5 -0
  188. package/dist/entries/mute-button.d.ts.map +1 -0
  189. package/dist/entries/mute-button.js +8 -0
  190. package/dist/entries/mute-button.js.map +1 -0
  191. package/dist/entries/panels.d.ts +5 -0
  192. package/dist/entries/panels.d.ts.map +1 -0
  193. package/dist/entries/panels.js +8 -0
  194. package/dist/entries/panels.js.map +1 -0
  195. package/dist/entries/pip-button.d.ts +5 -0
  196. package/dist/entries/pip-button.d.ts.map +1 -0
  197. package/dist/entries/pip-button.js +8 -0
  198. package/dist/entries/pip-button.js.map +1 -0
  199. package/dist/entries/play-button.d.ts +5 -0
  200. package/dist/entries/play-button.d.ts.map +1 -0
  201. package/dist/entries/play-button.js +8 -0
  202. package/dist/entries/play-button.js.map +1 -0
  203. package/dist/entries/quality-menu.d.ts +5 -0
  204. package/dist/entries/quality-menu.d.ts.map +1 -0
  205. package/dist/entries/quality-menu.js +8 -0
  206. package/dist/entries/quality-menu.js.map +1 -0
  207. package/dist/entries/seek-bar.d.ts +5 -0
  208. package/dist/entries/seek-bar.d.ts.map +1 -0
  209. package/dist/entries/seek-bar.js +8 -0
  210. package/dist/entries/seek-bar.js.map +1 -0
  211. package/dist/entries/skip-button.d.ts +5 -0
  212. package/dist/entries/skip-button.d.ts.map +1 -0
  213. package/dist/entries/skip-button.js +8 -0
  214. package/dist/entries/skip-button.js.map +1 -0
  215. package/dist/entries/spacer.d.ts +5 -0
  216. package/dist/entries/spacer.d.ts.map +1 -0
  217. package/dist/entries/spacer.js +8 -0
  218. package/dist/entries/spacer.js.map +1 -0
  219. package/dist/entries/speed-menu.d.ts +5 -0
  220. package/dist/entries/speed-menu.d.ts.map +1 -0
  221. package/dist/entries/speed-menu.js +8 -0
  222. package/dist/entries/speed-menu.js.map +1 -0
  223. package/dist/entries/start-button.d.ts +5 -0
  224. package/dist/entries/start-button.d.ts.map +1 -0
  225. package/dist/entries/start-button.js +8 -0
  226. package/dist/entries/start-button.js.map +1 -0
  227. package/dist/entries/subtitles-menu.d.ts +5 -0
  228. package/dist/entries/subtitles-menu.d.ts.map +1 -0
  229. package/dist/entries/subtitles-menu.js +8 -0
  230. package/dist/entries/subtitles-menu.js.map +1 -0
  231. package/dist/entries/volume-slider.d.ts +5 -0
  232. package/dist/entries/volume-slider.d.ts.map +1 -0
  233. package/dist/entries/volume-slider.js +8 -0
  234. package/dist/entries/volume-slider.js.map +1 -0
  235. package/dist/entries/volume.d.ts +7 -0
  236. package/dist/entries/volume.d.ts.map +1 -0
  237. package/dist/entries/volume.js +10 -0
  238. package/dist/entries/volume.js.map +1 -0
  239. package/dist/es2015/compose.js +33 -0
  240. package/dist/es2015/controls/chapters.js +61 -0
  241. package/dist/es2015/controls/cues.js +39 -11
  242. package/dist/es2015/controls/fullscreen.js +25 -23
  243. package/dist/es2015/controls/icons.js +5 -9
  244. package/dist/es2015/controls/menu.js +39 -35
  245. package/dist/es2015/controls/session.js +40 -0
  246. package/dist/es2015/controls/slider.js +18 -13
  247. package/dist/es2015/controls/time.js +1 -5
  248. package/dist/es2015/dom.js +5 -25
  249. package/dist/es2015/element-entry.js +10 -0
  250. package/dist/es2015/element.js +118 -65
  251. package/dist/es2015/elements/audio-menu.js +68 -0
  252. package/dist/es2015/elements/chapters-menu.js +68 -0
  253. package/dist/es2015/elements/component.js +84 -0
  254. package/dist/es2015/elements/control-bar.js +178 -0
  255. package/dist/es2015/elements/current-time.js +27 -0
  256. package/dist/es2015/elements/drm-badge.js +138 -0
  257. package/dist/es2015/elements/duration.js +23 -0
  258. package/dist/es2015/elements/error-screen.js +97 -0
  259. package/dist/es2015/elements/fullscreen-button.js +49 -0
  260. package/dist/es2015/elements/live-button.js +97 -0
  261. package/dist/es2015/elements/menu-element.js +39 -0
  262. package/dist/es2015/elements/mute-button.js +60 -0
  263. package/dist/es2015/elements/panels.js +52 -0
  264. package/dist/es2015/elements/pip-button.js +56 -0
  265. package/dist/es2015/elements/play-button.js +68 -0
  266. package/dist/es2015/elements/quality-menu.js +68 -0
  267. package/dist/es2015/elements/seek-bar.js +314 -0
  268. package/dist/es2015/elements/shared.js +155 -0
  269. package/dist/es2015/elements/skip-button.js +59 -0
  270. package/dist/es2015/elements/spacer.js +11 -0
  271. package/dist/es2015/elements/speed-menu.js +60 -0
  272. package/dist/es2015/elements/start-button.js +87 -0
  273. package/dist/es2015/elements/subtitles-menu.js +103 -0
  274. package/dist/es2015/elements/time-element.js +38 -0
  275. package/dist/es2015/elements/volume-slider.js +47 -0
  276. package/dist/es2015/elements/volume.js +50 -0
  277. package/dist/es2015/entries/audio-menu.js +7 -0
  278. package/dist/es2015/entries/chapters-menu.js +7 -0
  279. package/dist/es2015/entries/control-bar.js +7 -0
  280. package/dist/es2015/entries/current-time.js +7 -0
  281. package/dist/es2015/entries/drm-badge.js +7 -0
  282. package/dist/es2015/entries/duration.js +7 -0
  283. package/dist/es2015/entries/error-screen.js +7 -0
  284. package/dist/es2015/entries/fullscreen-button.js +7 -0
  285. package/dist/es2015/entries/live-button.js +7 -0
  286. package/dist/es2015/entries/mute-button.js +7 -0
  287. package/dist/es2015/entries/panels.js +7 -0
  288. package/dist/es2015/entries/pip-button.js +7 -0
  289. package/dist/es2015/entries/play-button.js +7 -0
  290. package/dist/es2015/entries/quality-menu.js +7 -0
  291. package/dist/es2015/entries/seek-bar.js +7 -0
  292. package/dist/es2015/entries/skip-button.js +7 -0
  293. package/dist/es2015/entries/spacer.js +7 -0
  294. package/dist/es2015/entries/speed-menu.js +7 -0
  295. package/dist/es2015/entries/start-button.js +7 -0
  296. package/dist/es2015/entries/subtitles-menu.js +7 -0
  297. package/dist/es2015/entries/volume-slider.js +7 -0
  298. package/dist/es2015/entries/volume.js +9 -0
  299. package/dist/es2015/host.js +23 -0
  300. package/dist/es2015/index.js +46 -9
  301. package/dist/es2015/labels.js +14 -0
  302. package/dist/es2015/style.js +21 -294
  303. package/dist/es2015/{panels/error.js → surface.js} +3 -3
  304. package/dist/es2015/tags.js +27 -0
  305. package/dist/host.d.ts +26 -0
  306. package/dist/host.d.ts.map +1 -0
  307. package/dist/host.js +23 -0
  308. package/dist/host.js.map +1 -0
  309. package/dist/index.d.ts +81 -3
  310. package/dist/index.d.ts.map +1 -1
  311. package/dist/index.js +23 -8
  312. package/dist/index.js.map +1 -1
  313. package/dist/labels.d.ts +7 -0
  314. package/dist/labels.d.ts.map +1 -0
  315. package/dist/labels.js +12 -0
  316. package/dist/labels.js.map +1 -0
  317. package/dist/style.d.ts +4 -2
  318. package/dist/style.d.ts.map +1 -1
  319. package/dist/style.js +21 -294
  320. package/dist/style.js.map +1 -1
  321. package/dist/surface.d.ts +15 -0
  322. package/dist/surface.d.ts.map +1 -0
  323. package/dist/{panels/error.js → surface.js} +3 -3
  324. package/dist/surface.js.map +1 -0
  325. package/dist/tags.d.ts +25 -0
  326. package/dist/tags.d.ts.map +1 -0
  327. package/dist/tags.js +25 -0
  328. package/dist/tags.js.map +1 -0
  329. package/package.json +22 -2
  330. package/dist/controls/bar.d.ts +0 -56
  331. package/dist/controls/bar.d.ts.map +0 -1
  332. package/dist/controls/bar.js +0 -245
  333. package/dist/controls/bar.js.map +0 -1
  334. package/dist/controls/buttons.d.ts +0 -13
  335. package/dist/controls/buttons.d.ts.map +0 -1
  336. package/dist/controls/buttons.js +0 -157
  337. package/dist/controls/buttons.js.map +0 -1
  338. package/dist/controls/control.d.ts +0 -12
  339. package/dist/controls/control.d.ts.map +0 -1
  340. package/dist/controls/control.js +0 -2
  341. package/dist/controls/control.js.map +0 -1
  342. package/dist/controls/keys.d.ts +0 -26
  343. package/dist/controls/keys.d.ts.map +0 -1
  344. package/dist/controls/keys.js +0 -66
  345. package/dist/controls/keys.js.map +0 -1
  346. package/dist/controls/live.d.ts +0 -10
  347. package/dist/controls/live.d.ts.map +0 -1
  348. package/dist/controls/live.js +0 -59
  349. package/dist/controls/live.js.map +0 -1
  350. package/dist/controls/menus.d.ts +0 -43
  351. package/dist/controls/menus.d.ts.map +0 -1
  352. package/dist/controls/menus.js +0 -262
  353. package/dist/controls/menus.js.map +0 -1
  354. package/dist/controls/options.d.ts +0 -44
  355. package/dist/controls/options.d.ts.map +0 -1
  356. package/dist/controls/options.js +0 -54
  357. package/dist/controls/options.js.map +0 -1
  358. package/dist/controls/screens.d.ts +0 -22
  359. package/dist/controls/screens.d.ts.map +0 -1
  360. package/dist/controls/screens.js +0 -69
  361. package/dist/controls/screens.js.map +0 -1
  362. package/dist/controls/seek.d.ts +0 -52
  363. package/dist/controls/seek.d.ts.map +0 -1
  364. package/dist/controls/seek.js +0 -215
  365. package/dist/controls/seek.js.map +0 -1
  366. package/dist/controls/speed.d.ts +0 -8
  367. package/dist/controls/speed.d.ts.map +0 -1
  368. package/dist/controls/speed.js +0 -34
  369. package/dist/controls/speed.js.map +0 -1
  370. package/dist/controls/volume.d.ts +0 -8
  371. package/dist/controls/volume.d.ts.map +0 -1
  372. package/dist/controls/volume.js +0 -29
  373. package/dist/controls/volume.js.map +0 -1
  374. package/dist/es2015/controls/bar.js +0 -227
  375. package/dist/es2015/controls/buttons.js +0 -146
  376. package/dist/es2015/controls/keys.js +0 -60
  377. package/dist/es2015/controls/live.js +0 -60
  378. package/dist/es2015/controls/menus.js +0 -258
  379. package/dist/es2015/controls/options.js +0 -46
  380. package/dist/es2015/controls/screens.js +0 -74
  381. package/dist/es2015/controls/seek.js +0 -203
  382. package/dist/es2015/controls/speed.js +0 -41
  383. package/dist/es2015/controls/volume.js +0 -30
  384. package/dist/es2015/panels/drm.js +0 -29
  385. package/dist/es2015/panels/live.js +0 -48
  386. package/dist/es2015/panels/quality.js +0 -52
  387. package/dist/es2015/panels/tracks.js +0 -47
  388. package/dist/panels/drm.d.ts +0 -8
  389. package/dist/panels/drm.d.ts.map +0 -1
  390. package/dist/panels/drm.js +0 -36
  391. package/dist/panels/drm.js.map +0 -1
  392. package/dist/panels/error.d.ts +0 -13
  393. package/dist/panels/error.d.ts.map +0 -1
  394. package/dist/panels/error.js.map +0 -1
  395. package/dist/panels/live.d.ts +0 -3
  396. package/dist/panels/live.d.ts.map +0 -1
  397. package/dist/panels/live.js +0 -56
  398. package/dist/panels/live.js.map +0 -1
  399. package/dist/panels/panel.d.ts +0 -13
  400. package/dist/panels/panel.d.ts.map +0 -1
  401. package/dist/panels/panel.js +0 -2
  402. package/dist/panels/panel.js.map +0 -1
  403. package/dist/panels/quality.d.ts +0 -3
  404. package/dist/panels/quality.d.ts.map +0 -1
  405. package/dist/panels/quality.js +0 -59
  406. package/dist/panels/quality.js.map +0 -1
  407. package/dist/panels/tracks.d.ts +0 -3
  408. package/dist/panels/tracks.d.ts.map +0 -1
  409. package/dist/panels/tracks.js +0 -49
  410. package/dist/panels/tracks.js.map +0 -1
@@ -0,0 +1,60 @@
1
+ import { icon } from "../controls/icons.js";
2
+ import { Component } from "./component.js";
3
+ import { BUTTON_STYLE, iconSlots, show, style } from "./shared.js";
4
+ //#region src/elements/mute-button.ts
5
+ /**
6
+ * <mbx-mute-button>: mute and unmute, with the level drawn in the glyph:
7
+ * `icon-mute` while muted or at zero, `icon-low` up to half, `icon-high`
8
+ * above. Unmuting at zero volume would change nothing the viewer can
9
+ * hear, so it brings the volume up too. The name comes from `label-mute`
10
+ * and `label-unmute`, and `aria-pressed` says which state it is in.
11
+ */
12
+ const LEVELS = [
13
+ "mute",
14
+ "low",
15
+ "high"
16
+ ];
17
+ var MbxMuteButton = class extends Component {
18
+ static get observedAttributes() {
19
+ return ["label-mute", "label-unmute"];
20
+ }
21
+ constructor() {
22
+ super();
23
+ const root = this.attachShadow({ mode: "open" });
24
+ this.button = document.createElement("button");
25
+ this.button.type = "button";
26
+ this.button.setAttribute("part", "button");
27
+ this.slots = iconSlots(LEVELS, (level) => icon(level === "mute" ? "mute" : level === "low" ? "volume-low" : "volume-high"));
28
+ for (const level of LEVELS) this.button.append(this.slots[level]);
29
+ this.button.addEventListener("click", () => {
30
+ this.toggle();
31
+ });
32
+ root.append(style(BUTTON_STYLE), this.button);
33
+ }
34
+ toggle() {
35
+ var _this$player;
36
+ const video = (_this$player = this.player) === null || _this$player === void 0 ? void 0 : _this$player.video;
37
+ if (video === void 0) return;
38
+ if (video.muted) {
39
+ video.muted = false;
40
+ if (video.volume === 0) video.volume = 1;
41
+ } else video.muted = true;
42
+ }
43
+ attach(player) {
44
+ this.listen(player.video, ["volumechange", "emptied"], () => {
45
+ this.render();
46
+ });
47
+ this.render();
48
+ }
49
+ render() {
50
+ var _this$player2, _this$getAttribute, _this$getAttribute2;
51
+ const video = (_this$player2 = this.player) === null || _this$player2 === void 0 ? void 0 : _this$player2.video;
52
+ if (video === void 0) return;
53
+ const silent = video.muted || video.volume === 0;
54
+ show(this.slots, silent ? "mute" : video.volume <= .5 ? "low" : "high");
55
+ this.button.setAttribute("aria-label", silent ? (_this$getAttribute = this.getAttribute("label-unmute")) !== null && _this$getAttribute !== void 0 ? _this$getAttribute : "Unmute" : (_this$getAttribute2 = this.getAttribute("label-mute")) !== null && _this$getAttribute2 !== void 0 ? _this$getAttribute2 : "Mute");
56
+ this.button.setAttribute("aria-pressed", String(video.muted));
57
+ }
58
+ };
59
+ //#endregion
60
+ export { MbxMuteButton };
@@ -0,0 +1,52 @@
1
+ import { Component } from "./component.js";
2
+ import { style } from "./shared.js";
3
+ //#region src/elements/panels.ts
4
+ /**
5
+ * <mbx-panels>: the row under the video for what native controls cannot
6
+ * show. It sits in the player beside the video, in flow, so it lands
7
+ * under the picture, and lays its children out in a row: the quality,
8
+ * audio and subtitles menus, the live button, the lock. Each child hides
9
+ * itself when its session has nothing for it, and the row hides when
10
+ * every child has, so a native session shows no strip at all.
11
+ */
12
+ const STYLE = `
13
+ :host {
14
+ display: flex;
15
+ flex-wrap: wrap;
16
+ align-items: center;
17
+ gap: var(--mbx-gap);
18
+ padding: var(--mbx-pad);
19
+ background: var(--mbx-surface);
20
+ color: var(--mbx-text);
21
+ font: 400 13px/1.4 var(--mbx-font);
22
+ }
23
+ :host([hidden]) { display: none; }
24
+ `;
25
+ var MbxPanels = class extends Component {
26
+ constructor() {
27
+ super();
28
+ this.attachShadow({ mode: "open" }).append(style(STYLE), document.createElement("slot"));
29
+ }
30
+ empty() {
31
+ return ![...this.children].some((child) => !child.hidden);
32
+ }
33
+ attach() {
34
+ const tick = () => {
35
+ const empty = this.empty();
36
+ if (this.hidden !== empty) this.hidden = empty;
37
+ };
38
+ const observer = new MutationObserver(tick);
39
+ observer.observe(this, {
40
+ childList: true,
41
+ subtree: true,
42
+ attributes: true,
43
+ attributeFilter: ["hidden"]
44
+ });
45
+ this.keep(() => {
46
+ observer.disconnect();
47
+ });
48
+ tick();
49
+ }
50
+ };
51
+ //#endregion
52
+ export { MbxPanels };
@@ -0,0 +1,56 @@
1
+ import { icon } from "../controls/icons.js";
2
+ import { Component } from "./component.js";
3
+ import { BUTTON_STYLE, iconSlots, show, style } from "./shared.js";
4
+ import { pictureInPicture } from "../controls/pip.js";
5
+ //#region src/elements/pip-button.ts
6
+ /**
7
+ * <mbx-pip-button>: picture in picture, through whichever API the browser
8
+ * has, and hidden where there is none. The glyph is `icon-enter` or
9
+ * `icon-exit`, the name `label-enter` or `label-exit`, and the element
10
+ * sets `pip` on the player while the video is in the floating window.
11
+ */
12
+ const STATES = ["enter", "exit"];
13
+ var MbxPipButton = class extends Component {
14
+ static get observedAttributes() {
15
+ return ["label-enter", "label-exit"];
16
+ }
17
+ constructor() {
18
+ super();
19
+ this.api = null;
20
+ const root = this.attachShadow({ mode: "open" });
21
+ this.button = document.createElement("button");
22
+ this.button.type = "button";
23
+ this.button.setAttribute("part", "button");
24
+ this.slots = iconSlots(STATES, (state) => icon(state === "enter" ? "picture-in-picture" : "picture-in-picture-exit"));
25
+ for (const state of STATES) this.button.append(this.slots[state]);
26
+ this.button.addEventListener("click", () => {
27
+ var _this$api;
28
+ (_this$api = this.api) === null || _this$api === void 0 || _this$api.toggle();
29
+ });
30
+ root.append(style(BUTTON_STYLE), this.button);
31
+ }
32
+ attach(player) {
33
+ const api = pictureInPicture(player.video);
34
+ this.api = api;
35
+ this.hidden = !api.supported;
36
+ this.keep(api.watch(() => {
37
+ this.render();
38
+ }));
39
+ this.render();
40
+ }
41
+ detach(player) {
42
+ this.api = null;
43
+ player.removeAttribute("pip");
44
+ }
45
+ render() {
46
+ var _this$getAttribute, _this$getAttribute2;
47
+ const player = this.player;
48
+ if (player === null || this.api === null) return;
49
+ const active = this.api.active();
50
+ show(this.slots, active ? "exit" : "enter");
51
+ this.button.setAttribute("aria-label", active ? (_this$getAttribute = this.getAttribute("label-exit")) !== null && _this$getAttribute !== void 0 ? _this$getAttribute : "Leave picture in picture" : (_this$getAttribute2 = this.getAttribute("label-enter")) !== null && _this$getAttribute2 !== void 0 ? _this$getAttribute2 : "Picture in picture");
52
+ player.toggleAttribute("pip", active);
53
+ }
54
+ };
55
+ //#endregion
56
+ export { MbxPipButton };
@@ -0,0 +1,68 @@
1
+ import { icon } from "../controls/icons.js";
2
+ import { Component } from "./component.js";
3
+ import { BUTTON_STYLE, iconSlots, show, style } from "./shared.js";
4
+ //#region src/elements/play-button.ts
5
+ /**
6
+ * <mbx-play-button>: play, pause, or replay once the media has ended. It
7
+ * reads the video on the events the video already fires and writes one
8
+ * thing back on click. The glyph is a slot per state, so a page drops its
9
+ * own SVG into `icon-play`, `icon-pause` or `icon-replay`; the name is on
10
+ * the button, from `label-play`, `label-pause` and `label-replay`, where a
11
+ * screen reader reads it.
12
+ */
13
+ const STATES = [
14
+ "play",
15
+ "pause",
16
+ "replay"
17
+ ];
18
+ const LABELS = {
19
+ play: "Play",
20
+ pause: "Pause",
21
+ replay: "Replay"
22
+ };
23
+ var MbxPlayButton = class extends Component {
24
+ static get observedAttributes() {
25
+ return STATES.map((state) => `label-${state}`);
26
+ }
27
+ constructor() {
28
+ super();
29
+ const root = this.attachShadow({ mode: "open" });
30
+ this.button = document.createElement("button");
31
+ this.button.type = "button";
32
+ this.button.setAttribute("part", "button");
33
+ this.slots = iconSlots(STATES, icon);
34
+ for (const state of STATES) this.button.append(this.slots[state]);
35
+ this.button.addEventListener("click", () => {
36
+ this.toggle();
37
+ });
38
+ root.append(style(BUTTON_STYLE), this.button);
39
+ }
40
+ toggle() {
41
+ var _this$player;
42
+ const video = (_this$player = this.player) === null || _this$player === void 0 ? void 0 : _this$player.video;
43
+ if (video === void 0) return;
44
+ if (video.paused) video.play().catch(() => void 0);
45
+ else video.pause();
46
+ }
47
+ attach(player) {
48
+ this.listen(player.video, [
49
+ "play",
50
+ "pause",
51
+ "ended",
52
+ "emptied"
53
+ ], () => {
54
+ this.render();
55
+ });
56
+ this.render();
57
+ }
58
+ render() {
59
+ var _this$player2, _this$getAttribute;
60
+ const video = (_this$player2 = this.player) === null || _this$player2 === void 0 ? void 0 : _this$player2.video;
61
+ if (video === void 0) return;
62
+ const state = video.ended ? "replay" : video.paused ? "play" : "pause";
63
+ show(this.slots, state);
64
+ this.button.setAttribute("aria-label", (_this$getAttribute = this.getAttribute(`label-${state}`)) !== null && _this$getAttribute !== void 0 ? _this$getAttribute : LABELS[state]);
65
+ }
66
+ };
67
+ //#endregion
68
+ export { MbxPlayButton };
@@ -0,0 +1,68 @@
1
+ import { show } from "./shared.js";
2
+ import { MenuElement, single } from "./menu-element.js";
3
+ //#region src/elements/quality-menu.ts
4
+ const AUTO = "auto";
5
+ function renditionLabel(rendition) {
6
+ if (rendition.height !== void 0) return `${rendition.height}p`;
7
+ return `${Math.round(rendition.bitrate / 1e3)} kbps`;
8
+ }
9
+ var MbxQualityMenu = class extends MenuElement {
10
+ static get observedAttributes() {
11
+ return [
12
+ "label",
13
+ "label-auto",
14
+ "label-back"
15
+ ];
16
+ }
17
+ constructor() {
18
+ super(...single("settings"));
19
+ this.engine = null;
20
+ show(this.slots, "default");
21
+ }
22
+ name() {
23
+ return "Quality";
24
+ }
25
+ attach(player) {
26
+ this.follow(player, (engine) => {
27
+ this.engine = engine;
28
+ this.render();
29
+ if (engine === null) return void 0;
30
+ const tick = () => {
31
+ this.render();
32
+ };
33
+ const offs = [
34
+ engine.on("tracks:changed", tick),
35
+ engine.on("quality:constraints-unsatisfiable", tick),
36
+ engine.on("quality:pin-unsatisfiable", tick)
37
+ ];
38
+ return () => {
39
+ for (const off of offs) off();
40
+ };
41
+ });
42
+ }
43
+ render() {
44
+ var _this$getAttribute, _quality$pinned;
45
+ super.render();
46
+ const engine = this.engine;
47
+ if (engine === null) {
48
+ this.hidden = true;
49
+ return;
50
+ }
51
+ const quality = engine.quality;
52
+ const items = [[AUTO, (_this$getAttribute = this.getAttribute("label-auto")) !== null && _this$getAttribute !== void 0 ? _this$getAttribute : "Auto"]];
53
+ for (const rendition of quality.renditions) items.push([rendition.id, renditionLabel(rendition)]);
54
+ this.menu.fill([{
55
+ name: "rendition",
56
+ items,
57
+ value: (_quality$pinned = quality.pinned) !== null && _quality$pinned !== void 0 ? _quality$pinned : AUTO,
58
+ onSelect: (value) => {
59
+ if (value === AUTO) quality.auto();
60
+ else quality.pin(value);
61
+ this.render();
62
+ }
63
+ }]);
64
+ this.hidden = quality.renditions.length === 0;
65
+ }
66
+ };
67
+ //#endregion
68
+ export { MbxQualityMenu };
@@ -0,0 +1,314 @@
1
+ import { el } from "../dom.js";
2
+ import { fill } from "../labels.js";
3
+ import { Component } from "./component.js";
4
+ import { SLIDER_STYLE, number, seekRow, style } from "./shared.js";
5
+ import { chapterAt, chapters, followChapters } from "../controls/chapters.js";
6
+ import { format } from "../controls/time.js";
7
+ import { EMPTY, at, clip, fraction } from "../controls/ranges.js";
8
+ import { bufferGoal, live, optional, span, wall } from "../controls/session.js";
9
+ import { slider } from "../controls/slider.js";
10
+ //#region src/elements/seek-bar.ts
11
+ const STEP = 5;
12
+ const PAGE = 30;
13
+ const LIVE_WINDOW = 3;
14
+ /** What the tile scales down to when the page sets no `--mbx-preview-width`. */
15
+ const PREVIEW_WIDTH = 160;
16
+ /** The buffer goal assumed for a session that reports none. */
17
+ const BUFFER_GOAL = 30;
18
+ /** The gap cut at a chapter boundary, in pixels. */
19
+ const GAP = 2;
20
+ const EVENTS = [
21
+ "timeupdate",
22
+ "progress",
23
+ "durationchange",
24
+ "loadedmetadata",
25
+ "seeking",
26
+ "seeked",
27
+ "emptied"
28
+ ];
29
+ const STYLE = `${SLIDER_STYLE}
30
+ :host { flex: 1; }
31
+ [part~="slider"] { flex: 1; }
32
+ [part~="thumb"] { width: 16px; height: 16px; margin: -8px 0 0 -8px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); }
33
+ [part~="buffered"] { position: absolute; top: 0; right: 0; bottom: 0; left: 0; }
34
+ [part~="buffered-range"] { position: absolute; top: 0; bottom: 0; background: rgba(255, 255, 255, 0.3); }
35
+ [part~="hover"] { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--mbx-text); }
36
+ [part~="edge"] { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--mbx-live); }
37
+ [part~="preview"] {
38
+ position: absolute;
39
+ bottom: 100%;
40
+ margin-bottom: 4px;
41
+ transform: translateX(-50%);
42
+ display: flex;
43
+ flex-direction: column;
44
+ align-items: center;
45
+ gap: 2px;
46
+ padding: 2px;
47
+ background: var(--mbx-surface);
48
+ border-radius: var(--mbx-radius);
49
+ font-size: 13px;
50
+ font-variant-numeric: tabular-nums;
51
+ white-space: nowrap;
52
+ pointer-events: none;
53
+ }
54
+ [part~="preview-image"] { position: relative; overflow: hidden; border-radius: 2px; }
55
+ [part~="preview-tile"] { position: absolute; top: 0; left: 0; transform-origin: top left; background-repeat: no-repeat; }
56
+ [part~="preview-time"] { padding: 0 4px; }
57
+ [part~="preview-title"] { max-width: 240px; padding: 0 4px; overflow: hidden; text-overflow: ellipsis; }
58
+ [hidden] { display: none; }
59
+ `;
60
+ function percent(part) {
61
+ return `${part * 100}%`;
62
+ }
63
+ /**
64
+ * A mask that cuts a gap at each boundary between chapters, as stops along
65
+ * the track: opaque up to a boundary, clear for the gap, opaque after.
66
+ */
67
+ function gaps(list, span) {
68
+ const stops = ["#000 0"];
69
+ for (const chapter of list.slice(1)) {
70
+ const at = percent(fraction(chapter.start, span));
71
+ const before = `calc(${at} - ${GAP / 2}px)`;
72
+ const after = `calc(${at} + ${GAP / 2}px)`;
73
+ stops.push(`#000 ${before}`, `transparent ${before}`, `transparent ${after}`, `#000 ${after}`);
74
+ }
75
+ stops.push("#000 100%");
76
+ return `linear-gradient(to right, ${stops.join(", ")})`;
77
+ }
78
+ var MbxSeekBar = class extends Component {
79
+ static get observedAttributes() {
80
+ return [
81
+ "label",
82
+ "label-of",
83
+ "label-behind",
84
+ "live-window",
85
+ "chapters"
86
+ ];
87
+ }
88
+ constructor() {
89
+ super();
90
+ this.range = EMPTY;
91
+ this.pending = null;
92
+ this.frame = 0;
93
+ this.divided = "";
94
+ this.list = [];
95
+ const root = this.attachShadow({ mode: "open" });
96
+ this.bar = slider({
97
+ step: () => number(this, "step", STEP),
98
+ page: () => number(this, "page", PAGE),
99
+ onInput: (value) => {
100
+ this.input(value);
101
+ },
102
+ onDrag: (on) => {
103
+ this.toggleAttribute("dragging", on);
104
+ }
105
+ });
106
+ this.buffered = el("div", "buffered");
107
+ this.hover = el("div", "hover");
108
+ this.edge = el("div", "edge");
109
+ this.hover.hidden = true;
110
+ this.edge.hidden = true;
111
+ this.bar.track.prepend(this.buffered);
112
+ this.bar.track.append(this.hover, this.edge);
113
+ this.preview = el("div", "preview");
114
+ this.image = el("div", "preview-image");
115
+ this.tile = el("div", "preview-tile");
116
+ this.time = el("span", "preview-time");
117
+ this.caption = el("span", "preview-title");
118
+ this.caption.hidden = true;
119
+ this.image.append(this.tile);
120
+ this.image.hidden = true;
121
+ this.preview.append(this.image, this.caption, this.time);
122
+ this.preview.hidden = true;
123
+ this.bar.root.append(this.preview);
124
+ this.bar.root.addEventListener("pointermove", (event) => {
125
+ this.point(event);
126
+ });
127
+ this.bar.root.addEventListener("pointerleave", () => {
128
+ this.leave();
129
+ });
130
+ root.append(style(STYLE), this.bar.root);
131
+ }
132
+ connectedCallback() {
133
+ seekRow(this);
134
+ super.connectedCallback();
135
+ }
136
+ isLive() {
137
+ var _this$player$engine, _this$player;
138
+ return live((_this$player$engine = (_this$player = this.player) === null || _this$player === void 0 ? void 0 : _this$player.engine) !== null && _this$player$engine !== void 0 ? _this$player$engine : null) !== void 0;
139
+ }
140
+ /** Whether the chapters divide the track and name the preview. */
141
+ chaptered() {
142
+ return this.getAttribute("chapters") !== "none" && this.list.length > 0;
143
+ }
144
+ /** The gaps at the chapter boundaries, on every layer of the track at once. */
145
+ paintChapters() {
146
+ const mask = this.chaptered() && this.list.length > 1 ? gaps(this.list, this.range) : "";
147
+ const key = `${mask}|${this.range.start}|${this.range.end}`;
148
+ if (key === this.divided) return;
149
+ this.divided = key;
150
+ const track = this.bar.track.style;
151
+ track.setProperty("mask-image", mask === "" ? "" : mask);
152
+ track.setProperty("-webkit-mask-image", mask === "" ? "" : mask);
153
+ }
154
+ /** What a screen reader hears at a time. */
155
+ say(time) {
156
+ var _this$player$engine2, _this$player2, _this$getAttribute2;
157
+ const engine = (_this$player$engine2 = (_this$player2 = this.player) === null || _this$player2 === void 0 ? void 0 : _this$player2.engine) !== null && _this$player$engine2 !== void 0 ? _this$player$engine2 : null;
158
+ if (!this.isLive()) {
159
+ var _this$getAttribute;
160
+ const template = (_this$getAttribute = this.getAttribute("label-of")) !== null && _this$getAttribute !== void 0 ? _this$getAttribute : "{current} of {duration}";
161
+ return Number.isFinite(this.range.end) && this.range.end > 0 ? fill(template, {
162
+ current: format(time),
163
+ duration: format(this.range.end)
164
+ }) : format(time);
165
+ }
166
+ const behind = fill((_this$getAttribute2 = this.getAttribute("label-behind")) !== null && _this$getAttribute2 !== void 0 ? _this$getAttribute2 : "{time} behind live", { time: format(this.range.end - time) });
167
+ const clock = wall(engine, time);
168
+ return clock === null ? behind : `${clock}, ${behind}`;
169
+ }
170
+ /** What the preview shows at a time. */
171
+ label(time) {
172
+ var _wall, _this$player$engine3, _this$player3;
173
+ if (!this.isLive()) return format(time);
174
+ return (_wall = wall((_this$player$engine3 = (_this$player3 = this.player) === null || _this$player3 === void 0 ? void 0 : _this$player3.engine) !== null && _this$player$engine3 !== void 0 ? _this$player$engine3 : null, time)) !== null && _wall !== void 0 ? _wall : `-${format(this.range.end - time)}`;
175
+ }
176
+ input(value) {
177
+ var _this$player4;
178
+ const video = (_this$player4 = this.player) === null || _this$player4 === void 0 ? void 0 : _this$player4.video;
179
+ if (video === void 0) return;
180
+ this.bar.set(value, this.say(value));
181
+ if (!this.bar.dragging()) {
182
+ this.pending = null;
183
+ video.currentTime = value;
184
+ return;
185
+ }
186
+ this.pending = value;
187
+ if (this.frame === 0) this.frame = requestAnimationFrame(() => {
188
+ this.flush();
189
+ });
190
+ }
191
+ flush() {
192
+ var _this$player5;
193
+ this.frame = 0;
194
+ const video = (_this$player5 = this.player) === null || _this$player5 === void 0 ? void 0 : _this$player5.video;
195
+ if (this.pending === null || video === void 0) return;
196
+ video.currentTime = this.pending;
197
+ this.pending = null;
198
+ }
199
+ /** The width the page asked for through the token, or the default. */
200
+ previewWidth() {
201
+ const set = Number.parseFloat(getComputedStyle(this.preview).getPropertyValue("--mbx-preview-width"));
202
+ return Number.isFinite(set) && set > 0 ? set : PREVIEW_WIDTH;
203
+ }
204
+ /** The tile for a time, if the track has one, drawn at its size and scaled to fit. */
205
+ paintTile(when) {
206
+ var _optional$thumbnails$, _optional$thumbnails, _this$player$engine4, _this$player6;
207
+ const found = (_optional$thumbnails$ = (_optional$thumbnails = optional((_this$player$engine4 = (_this$player6 = this.player) === null || _this$player6 === void 0 ? void 0 : _this$player6.engine) !== null && _this$player$engine4 !== void 0 ? _this$player$engine4 : null).thumbnails) === null || _optional$thumbnails === void 0 ? void 0 : _optional$thumbnails.at(when)) !== null && _optional$thumbnails$ !== void 0 ? _optional$thumbnails$ : null;
208
+ this.image.hidden = found === null;
209
+ if (found === null) return;
210
+ const scale = this.previewWidth() / found.width;
211
+ this.image.style.width = `${found.width * scale}px`;
212
+ this.image.style.height = `${found.height * scale}px`;
213
+ this.tile.style.width = `${found.width}px`;
214
+ this.tile.style.height = `${found.height}px`;
215
+ this.tile.style.backgroundImage = `url("${found.url}")`;
216
+ this.tile.style.backgroundPosition = `-${found.x}px -${found.y}px`;
217
+ this.tile.style.transform = `scale(${scale})`;
218
+ }
219
+ paintBuffered(video) {
220
+ var _buffered$lastElement;
221
+ const parts = clip(Array.from({ length: video.buffered.length }, (_, i) => ({
222
+ start: video.buffered.start(i),
223
+ end: video.buffered.end(i)
224
+ })), this.range);
225
+ const buffered = this.buffered;
226
+ while (buffered.childElementCount > parts.length) (_buffered$lastElement = buffered.lastElementChild) === null || _buffered$lastElement === void 0 || _buffered$lastElement.remove();
227
+ while (buffered.childElementCount < parts.length) buffered.append(el("div", "buffered-range"));
228
+ let i = 0;
229
+ for (const child of buffered.children) {
230
+ const part = parts[i];
231
+ i += 1;
232
+ if (part === void 0) break;
233
+ const node = child;
234
+ node.style.left = percent(part[0]);
235
+ node.style.width = percent(part[1] - part[0]);
236
+ }
237
+ }
238
+ /** Whether a live window is wide enough to be worth a bar. */
239
+ worthSeeking() {
240
+ var _bufferGoal, _this$player$engine5, _this$player7;
241
+ const goals = number(this, "live-window", LIVE_WINDOW);
242
+ if (goals === 0) return true;
243
+ const goal = (_bufferGoal = bufferGoal((_this$player$engine5 = (_this$player7 = this.player) === null || _this$player7 === void 0 ? void 0 : _this$player7.engine) !== null && _this$player$engine5 !== void 0 ? _this$player$engine5 : null)) !== null && _bufferGoal !== void 0 ? _bufferGoal : BUFFER_GOAL;
244
+ return this.range.end - this.range.start >= goals * goal;
245
+ }
246
+ /** The hover marker and the preview follow the pointer, clamped to the bar. */
247
+ point(event) {
248
+ var _chapter$title;
249
+ const rect = this.bar.rail.getBoundingClientRect();
250
+ if (rect.width === 0 || this.range.end <= this.range.start) return;
251
+ const part = Math.min(1, Math.max(0, (event.clientX - rect.left) / rect.width));
252
+ this.hover.hidden = false;
253
+ this.hover.style.left = percent(part);
254
+ this.preview.hidden = false;
255
+ const when = at(part, this.range);
256
+ this.time.textContent = this.label(when);
257
+ const chapter = this.chaptered() ? this.list[chapterAt(this.list, when)] : void 0;
258
+ this.caption.hidden = chapter === void 0 || chapter.title === "";
259
+ this.caption.textContent = (_chapter$title = chapter === null || chapter === void 0 ? void 0 : chapter.title) !== null && _chapter$title !== void 0 ? _chapter$title : "";
260
+ this.paintTile(when);
261
+ const whole = this.bar.root.getBoundingClientRect();
262
+ const half = this.preview.offsetWidth / 2;
263
+ const x = rect.left - whole.left + part * rect.width;
264
+ this.preview.style.left = `${Math.min(whole.width - half, Math.max(half, x))}px`;
265
+ }
266
+ leave() {
267
+ this.hover.hidden = true;
268
+ this.preview.hidden = true;
269
+ }
270
+ attach(player) {
271
+ const tick = () => {
272
+ this.render();
273
+ };
274
+ this.listen(player.video, EVENTS, tick);
275
+ this.keep(followChapters(player.video, tick));
276
+ this.listen(player, ["sourcechange"], () => {
277
+ this.leave();
278
+ this.render();
279
+ });
280
+ this.render();
281
+ }
282
+ detach(player) {
283
+ cancelAnimationFrame(this.frame);
284
+ this.frame = 0;
285
+ this.pending = null;
286
+ this.leave();
287
+ player.removeAttribute("live");
288
+ player.removeAttribute("seekable");
289
+ }
290
+ render() {
291
+ var _this$getAttribute3;
292
+ const player = this.player;
293
+ if (player === null) return;
294
+ const video = player.video;
295
+ const engine = player.engine;
296
+ const api = live(engine);
297
+ const on = api !== void 0;
298
+ this.range = span(video, engine);
299
+ this.list = chapters(video);
300
+ this.bar.label((_this$getAttribute3 = this.getAttribute("label")) !== null && _this$getAttribute3 !== void 0 ? _this$getAttribute3 : "Seek");
301
+ this.bar.range(this.range.start, this.range.end);
302
+ this.paintBuffered(video);
303
+ this.paintChapters();
304
+ this.edge.hidden = !on;
305
+ if (api !== void 0 && api.edge !== null) this.edge.style.left = percent(fraction(api.edge, this.range));
306
+ const seekable = !on || this.worthSeeking();
307
+ this.hidden = !seekable;
308
+ player.toggleAttribute("live", on);
309
+ player.toggleAttribute("seekable", seekable);
310
+ if (!this.bar.dragging()) this.bar.set(video.currentTime, this.say(video.currentTime));
311
+ }
312
+ };
313
+ //#endregion
314
+ export { MbxSeekBar };