@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":"element.js","sourceRoot":"","sources":["../src/element.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAGhG,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,8EAA8E;AAC9E,MAAM,SAAS,GAAG,CAAC,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC;AAEjE,yEAAyE;AACzE,MAAM,GAAG,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,CAAC,CAAC;AAEnE;;;;;;GAMG;AACH,MAAM,QAAQ,GAAG,UAAU,CAAC;AAE5B;;;;;;GAMG;AACH,MAAM,QAAQ,GAAG,UAAU,CAAC;AAE5B;;;;;GAKG;AACH,MAAM,WAAW,GAAG,aAAa,CAAC;AAElC,kGAAkG;AAClG,MAAM,YAAY,GAAG;IACnB,MAAM;IACN,OAAO;IACP,OAAO;IACP,SAAS;IACT,cAAc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,qEAAqE;QACrE,mBAAmB;QACnB,IAAI,OAAO,KAAK,IAAI,IAAI,QAAQ,CAAC,GAAG,KAAK,SAAS;YAAE,QAAQ,CAAC,GAAG,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QAExF,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;QAC9C,IAAI,KAAK,KAAK,IAAI,IAAI,QAAQ,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;YACxD,0EAA0E;YAC1E,sEAAsE;YACtE,yEAAyE;YACzE,6CAA6C;YAC7C,KAAK,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC;IAEO,OAAO;QACb,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;IACtB,CAAC;IAEO,KAAK,CAAC,QAAQ;QACpB,IAAI,CAAC,OAAO,EAAE,CAAC;QACf,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI;YAAE,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;IACnD,CAAC;IAED,mFAAmF;IAC3E,KAAK,CAAC,OAAO;QACnB,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;QACtB,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,IAAI;YAAE,GAAG,EAAE,CAAC;QACnC,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF"}
1
+ {"version":3,"file":"element.js","names":[],"sources":["../src/element.ts"],"sourcesContent":["/**\n * <mattebox-player>: a real <video> as a light-DOM child, so the integrator\n * can reach it, and the error surface in shadow DOM. The element never\n * forwards or wraps a media element member: play, pause, seek, volume and\n * the rest live on the video, where the browser, Picture-in-Picture and the\n * OS media session already find them.\n *\n * The controls are elements the page places inside, beside the video, and\n * the stage slots them over the picture. The element appends none of its\n * own: the composition is the page's in every mode, and `none` hides every\n * child but the video. The element reflects the video's state as\n * attributes on itself, `paused`, `playing`, `ended`, `muted`, `audio`,\n * `started` and `waiting`, for the page's stylesheet and the controls\n * alike.\n *\n * No class fields, `#private` or otherwise: the ES2015 build would lower\n * them into runtime helpers, and the emit check bans helpers. Statics are\n * getters and instance state is declared, then assigned in the constructor.\n */\n\nimport type { Handler, Player, PlayerError, Session, Source } from '@mattebox/player-core';\nimport {\n createPlayer,\n inferType,\n matteboxHandler,\n nativeHandler,\n preferNativeHls,\n} from '@mattebox/player-core';\nimport type { KernelConfig, Mattebox, Stage } from 'mattebox';\nimport type { AttachEmeOptions } from 'mattebox/eme';\nimport type { Marker, Markers } from './controls/markers.js';\nimport { createMarkers } from './controls/markers.js';\nimport type { PlayerHost } from './host.js';\nimport { namespaces } from './namespaces.js';\nimport { drmGuard, resolvePreset } from './presets.js';\nimport { STYLE } from './style.js';\nimport type { ErrorSurface } from './surface.js';\nimport { errorSurface } from './surface.js';\nimport { PLAYER } from './tags.js';\n\n/**\n * `off` keeps HLS on the engine in Safari. Anything else lets Safari play\n * HLS itself: FairPlay, AirPlay, Low-Latency HLS and the platform's\n * fullscreen then work as Apple built them. Changing it reloads.\n */\nconst NATIVE_HLS = 'native-hls';\n\n/** Attributes forwarded onto the video as attributes, never as properties. */\nconst FORWARDED = ['autoplay', 'muted', 'poster', 'crossorigin'];\n\n/** Everything else the element watches. Changing any of them reloads. */\nconst OWN = ['src', 'type', 'preset', 'license-url', 'certificate-url', 'thumbnails', NATIVE_HLS];\n\n/**\n * The chapters file URL. A session with the engine's `chapters` namespace\n * loads it there: through the engine's transport, so request hooks apply,\n * and in every format the engine reads. Any other session gets a\n * `<track kind=\"chapters\">` on the video, hidden so its cues load and\n * nothing is drawn. The seek bar and the chapters menu read either.\n * Changing it never reloads the source.\n */\nconst CHAPTERS = 'chapters';\n\n/**\n * The one attribute whose meaning the element owns: `native` keeps the\n * browser's controls on the video, `custom` swaps them for the controls the\n * page placed inside, `none` takes the browser's off and hides every child\n * but the video. Anything else is `native`. Changing it never touches the\n * session.\n */\nconst CONTROLS = 'controls';\n\n/**\n * Inline playback, on until the page writes `playsinline=\"false\"`, the way\n * `spellcheck` and `draggable` are on until told otherwise. An iPhone takes\n * a video without `playsinline` to its own fullscreen on play, where no\n * control the page placed shows. Changing it never reloads.\n */\nconst PLAYSINLINE = 'playsinline';\n\n/** The video's state, as attributes on the element, read on the events the video fires for it. */\nconst STATE_EVENTS = [\n 'play',\n 'pause',\n 'ended',\n // A seek back from the end leaves `ended` with no play, pause or ended event.\n 'seeked',\n 'emptied',\n 'volumechange',\n 'loadedmetadata',\n 'resize',\n 'playing',\n 'waiting',\n 'stalled',\n 'canplay',\n];\n\n/** The stages that register a key system, which a native session's DRM offers. */\nconst KEY_SYSTEMS = ['eme-fairplay', 'eme-cenc'];\n\n/** Every stage the engine ships. A narrower preset is optimization. */\nconst DEFAULT_PRESET = 'full';\n\n/**\n * What the element dispatches. `error` is also a standard DOM event name, so\n * without these overloads a listener on it is typed as `ErrorEvent` and the\n * payload needs a double cast. They are declarations only: no runtime bytes.\n */\nexport interface MatteboxPlayerEventMap {\n sourcechange: CustomEvent<Session | null>;\n error: CustomEvent<PlayerError>;\n /** The markers changed: set by the page, or cleared by a new source. */\n markerschange: CustomEvent<readonly Marker[]>;\n /** Playback reached a blocked range and moved past it. */\n blocked: CustomEvent<Marker>;\n}\n\nexport interface MatteboxPlayerElement {\n addEventListener<K extends keyof MatteboxPlayerEventMap>(\n type: K,\n listener: (this: MatteboxPlayerElement, event: MatteboxPlayerEventMap[K]) => void,\n options?: boolean | AddEventListenerOptions,\n ): void;\n addEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | AddEventListenerOptions,\n ): void;\n removeEventListener<K extends keyof MatteboxPlayerEventMap>(\n type: K,\n listener: (this: MatteboxPlayerElement, event: MatteboxPlayerEventMap[K]) => void,\n options?: boolean | EventListenerOptions,\n ): void;\n removeEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | EventListenerOptions,\n ): void;\n}\n\nexport interface MatteboxPlayerOptions {\n /** The whole chain, in order. Takes precedence over `stages` and the `preset` attribute. */\n readonly handlers?: readonly Handler[];\n /** Stages for the mattebox handler. Takes precedence over the `preset` attribute. */\n readonly stages?: readonly Stage[];\n /**\n * Kernel tuning for the engines the elements build, `traceCapacity` among\n * it. A page decision, like the stages, so not an attribute. Ignored with\n * `handlers`, which carry their own.\n */\n readonly config?: Partial<KernelConfig>;\n /**\n * DRM for a native session, as `attachEme` from `mattebox/eme` takes it:\n * `keySystems`, `licenseUrl`, `licenseUrls`, `requestHook`. Without\n * `keySystems` the session offers the key-system stages of the engine's\n * stack. The `license-url` attribute overrides `licenseUrl`, and\n * `certificate-url` gives the FairPlay certificate. Ignored\n * with `handlers`, which carry their own.\n */\n readonly drm?: AttachEmeOptions;\n}\n\n/**\n * What `define()` recorded, for the elements the parser creates. It is the\n * one value shared across elements, because a page that writes only markup\n * still has to be able to say what the engine carries.\n */\nlet defaults: MatteboxPlayerOptions = {};\n\n/**\n * The interface above merges only `addEventListener` and `removeEventListener`\n * overloads, which the class inherits from HTMLElement. The rule it suppresses\n * guards against properties an interface declares and a constructor never\n * assigns, and there are none.\n */\n// biome-ignore lint/suspicious/noUnsafeDeclarationMerging: method overloads only, no properties\nexport class MatteboxPlayerElement extends HTMLElement implements PlayerHost {\n static get observedAttributes(): readonly string[] {\n return [...FORWARDED, ...OWN, CONTROLS, CHAPTERS, PLAYSINLINE];\n }\n\n /**\n * Registers the element once, and records the stages markup-only pages\n * get. The controls register through their own entries, the package's\n * root entry importing every one; a control connected before its player\n * is defined waits for the definition.\n */\n static define(options?: MatteboxPlayerOptions): void {\n if (options !== undefined) defaults = options;\n if (customElements.get(PLAYER) === undefined) {\n customElements.define(PLAYER, MatteboxPlayerElement);\n }\n }\n\n declare private readonly media: HTMLVideoElement;\n /** Wraps the slot: the picture, and the controls over it or under it. */\n declare private readonly stage: HTMLDivElement;\n /** Whether the element gave itself a tabindex for the bar, to take back with it. */\n declare private focusable: boolean;\n declare private readonly surface: ErrorSurface;\n declare private readonly marks: Markers;\n /** The chapters track element, while the `chapters` attribute names one and the engine takes none. */\n declare private track: HTMLTrackElement | null;\n /** The chapters URL the current session's engine was given, or null. */\n declare private given: string | null;\n declare private readonly options: MatteboxPlayerOptions;\n declare private core: Player | null;\n declare private current: Session | null;\n declare private failure: PlayerError | null;\n /** Whether an attribute change is the element's own reflection, which must not write back to the video. */\n declare private reflecting: boolean;\n /** The video has played once since its source was set: `started`, which tells a first play from a pause. */\n declare private started: boolean;\n /** The video waits for data: `waiting`, set on `waiting` and `stalled`, cleared once it can play. */\n declare private waiting: boolean;\n declare private offs: Array<() => void>;\n /** Everything the element does to the player runs here, so it runs in order. */\n declare private queue: Promise<void>;\n /** Whether a run is queued and not yet started, so a burst of changes loads once. */\n declare private pending: boolean;\n\n constructor(options?: MatteboxPlayerOptions) {\n super();\n this.options = options ?? defaults;\n this.focusable = false;\n this.track = null;\n this.given = null;\n this.core = null;\n this.current = null;\n this.failure = null;\n this.reflecting = false;\n this.started = false;\n this.waiting = false;\n this.offs = [];\n this.queue = Promise.resolve();\n this.pending = false;\n\n this.media = document.createElement('video');\n // Native until the `controls` attribute says otherwise, which arrives\n // through attributeChangedCallback: a constructor must not read attributes.\n this.media.controls = true;\n // Inline is the default, and the player's own attribute has not arrived\n // yet. Set as an attribute: not every browser has the `playsInline`\n // property. The fullscreen button still reaches the iPhone's fullscreen,\n // through `webkitEnterFullscreen`.\n this.media.setAttribute(PLAYSINLINE, '');\n for (const name of STATE_EVENTS) {\n this.media.addEventListener(name, () => {\n this.note(name);\n this.reflect();\n });\n }\n // An error over a picture that then plays is wrong by definition.\n this.media.addEventListener('playing', () => {\n this.failure = null;\n });\n this.marks = createMarkers(this.media, (name, detail) => this.emit(name, detail));\n this.stage = document.createElement('div');\n this.stage.setAttribute('part', 'stage');\n this.stage.append(document.createElement('slot'));\n this.surface = errorSurface(() => {\n this.reload();\n });\n\n const root = this.attachShadow({ mode: 'open' });\n const style = document.createElement('style');\n style.textContent = STYLE;\n root.append(style, this.stage, this.surface.root);\n }\n\n /** The media element. Everything the browser already does is here. */\n get video(): HTMLVideoElement {\n return this.media;\n }\n\n /** The ranges the page named in this source: credits to skip, parts that must not play. */\n get markers(): Markers {\n return this.marks;\n }\n\n /** The core, or null until the first source has been set up: resolving a preset is asynchronous. */\n get player(): Player | null {\n return this.core;\n }\n\n /** The engine feeding the video, or null for a native session and before the first load. */\n get engine(): Mattebox | null {\n return this.current?.engine ?? null;\n }\n\n /**\n * The fatal error of the current load, or null once a load starts or\n * playback resumes. The `error` event says when; this says what, for a\n * control that attaches after the event, such as an error screen parsed\n * after a source that failed while the page was still loading.\n */\n get error(): PlayerError | null {\n return this.failure;\n }\n\n connectedCallback(): void {\n if (this.media.parentNode !== this) this.append(this.media);\n for (const name of FORWARDED) this.forward(name);\n this.reflect();\n this.reload();\n }\n\n /** The two states the video does not hold: whether it has played once, and whether it waits for data. */\n private note(event: string): void {\n if (event === 'playing') {\n this.started = true;\n this.waiting = false;\n } else if (event === 'waiting' || event === 'stalled') {\n this.waiting = true;\n } else if (event === 'canplay') {\n this.waiting = false;\n } else if (event === 'emptied') {\n // A new source starts over: the title shows again before its first play.\n this.started = false;\n this.waiting = false;\n }\n }\n\n /** The video's state on the element, for `mattebox-player[paused]` and the like. */\n private reflect(): void {\n const video = this.media;\n this.reflecting = true;\n this.toggleAttribute('paused', video.paused);\n this.toggleAttribute('playing', !video.paused);\n this.toggleAttribute('ended', video.ended);\n // `muted` is also forwarded: the page's attribute sets the video, and\n // the video's state sets the attribute. Reflection never forwards, so\n // a read can only ever change the attribute, never the video.\n this.toggleAttribute('muted', video.muted);\n this.toggleAttribute('audio', this.audio());\n this.toggleAttribute('started', this.started);\n this.toggleAttribute('waiting', this.waiting);\n this.reflecting = false;\n }\n\n /**\n * Whether the source has no picture. Once the metadata is in, the video's\n * size decides: zero by zero is sound alone, and `resize` catches a stream\n * that moves to or from an audio-only rendition. Before that, the type the\n * page wrote or the URL implies is the hint, so an mp3 is `audio` from\n * the start rather than from its metadata.\n */\n private audio(): boolean {\n const video = this.media;\n if (video.readyState >= HTMLMediaElement.HAVE_METADATA) {\n return video.videoWidth === 0 && video.videoHeight === 0;\n }\n const src = this.getAttribute('src');\n const type = this.getAttribute('type') ?? (src === null ? undefined : inferType(src));\n return type?.startsWith('audio/') === true;\n }\n\n disconnectedCallback(): void {\n // A single-page app must not leave a pipeline attached to a video it\n // navigated away from. Reconnecting loads the `src` again.\n this.enqueue(() => this.teardown());\n }\n\n attributeChangedCallback(name: string): void {\n if (FORWARDED.includes(name)) {\n if (!this.reflecting) this.forward(name);\n return;\n }\n if (name === CONTROLS) {\n this.mode();\n return;\n }\n if (name === CHAPTERS) {\n this.chapters();\n return;\n }\n if (name === PLAYSINLINE) {\n // On the video it is a boolean attribute, so off is absent.\n this.media.toggleAttribute(PLAYSINLINE, this.getAttribute(PLAYSINLINE) !== 'false');\n return;\n }\n // The preset decides the chain, so it is the one attribute that rebuilds it.\n if (name === 'preset') this.enqueue(() => this.discard());\n // The source's type is the hint for `audio` until its metadata arrives.\n // Only `audio`: a full reflection here would drop a `muted` the page\n // wrote before its own callback forwards it.\n if (name === 'src' || name === 'type') this.toggleAttribute('audio', this.audio());\n // Markers belong to a source. Cleared here, not on `emptied`, which\n // arrives later and would clear the ones the page sets right after.\n if (name === 'src' && this.marks.list.length > 0) this.marks.set([]);\n this.reload();\n }\n\n /**\n * Applies the `controls` attribute: the video's own controls and the\n * tabindex. The controls themselves are elements the page placed, and\n * they attach on their own; the element appends none.\n */\n private mode(): void {\n const value = this.getAttribute(CONTROLS);\n const custom = value === 'custom';\n this.media.controls = !custom && value !== 'none';\n // Under custom controls the error screen element carries a fatal error.\n if (custom) this.surface.clear();\n if (!custom) {\n if (this.focusable) this.removeAttribute('tabindex');\n this.focusable = false;\n } else if (!this.hasAttribute('tabindex')) {\n // A bare video is not focusable, so without this a click on it would\n // leave the shortcuts nowhere to listen. A page that set its own\n // tabindex keeps it.\n this.tabIndex = 0;\n this.focusable = true;\n }\n }\n\n /** Hands the `chapters` attribute to the engine, or keeps a hidden chapters track on the video for it. */\n private chapters(): void {\n const url = this.getAttribute(CHAPTERS);\n const engine = this.current?.engine ?? null;\n const api = engine === null ? undefined : namespaces(engine).chapters;\n if (api !== undefined) {\n this.track?.remove();\n this.track = null;\n if (url === this.given) return;\n this.given = url;\n // An empty list removes the chapters the attribute loaded.\n if (url === null) api.set([]);\n else void api.load(url).catch(() => undefined);\n return;\n }\n if (url === null) {\n this.track?.remove();\n this.track = null;\n return;\n }\n const held = this.track;\n if (held !== null && held.parentNode === this.media && held.getAttribute('src') === url) return;\n // A new element each time: one removed mid-load, as the engine's attach\n // does, stays in its error state, and neither a new `src` nor a second\n // insertion starts it loading again.\n held?.remove();\n const track = document.createElement('track');\n track.kind = 'chapters';\n track.src = url;\n this.track = track;\n this.media.append(track);\n // Set after the insertion: a track element's mode exists once it is in\n // a media element, and `hidden` is what makes its cues load unseen.\n track.track.mode = 'hidden';\n }\n\n private forward(name: string): void {\n const value = this.getAttribute(name);\n if (value === null) this.media.removeAttribute(name);\n else this.media.setAttribute(name, value);\n // A video reads `muted` into its state only when it is created, and this\n // one was created before any attribute reached it. Muted autoplay and\n // the autoplay policy read the state, so the attribute alone would not do.\n if (name === 'muted') this.media.muted = value !== null;\n }\n\n private enqueue(task: () => Promise<void>): void {\n this.queue = this.queue.then(task, task).catch(() => undefined);\n }\n\n /**\n * One run per burst. The parser sets every attribute and then connects the\n * element before any queued task starts, and each of those would load on\n * its own; the flag folds them into the one run that sees the final state.\n */\n private reload(): void {\n if (this.pending) return;\n this.pending = true;\n this.enqueue(() => {\n this.pending = false;\n return this.run();\n });\n }\n\n private emit(name: string, detail: unknown): void {\n this.dispatchEvent(new CustomEvent(name, { detail, bubbles: true, composed: true }));\n }\n\n private report(error: PlayerError): void {\n if (error.fatal) {\n this.failure = error;\n // Under custom controls the error screen element is the surface, and\n // the element's own row under the video stays quiet.\n if (this.getAttribute(CONTROLS) !== 'custom') this.surface.show(error);\n }\n this.emit('error', error);\n }\n\n private async run(): Promise<void> {\n this.unmount();\n if (!this.isConnected) return;\n const url = this.getAttribute('src');\n if (url === null) return;\n\n const core = await this.ensure();\n const type = this.getAttribute('type');\n const source: Source = type === null ? { url } : { url, type };\n this.failure = null;\n this.surface.clear();\n\n let session: Session;\n try {\n session = await core.load(source);\n } catch {\n // The core already reported it on the error event, which the surface\n // and the element's own event both carry. Nothing to add here.\n return;\n }\n if (!this.isConnected) {\n await core.unload();\n return;\n }\n this.current = session;\n this.given = null;\n this.configure(session);\n // The engine's attach empties the media element to reset its resource\n // selection (`kernel/mse.ts`), and the chapters track goes with the\n // `<source>` children it means. Wanted: the track to survive attach.\n // Had to: put it back once the session is in. The surface that would\n // make it one call: an attach that removes `<source>` children alone.\n // A session with the engine's chapters takes the URL there instead.\n this.chapters();\n }\n\n private async ensure(): Promise<Player> {\n if (this.core !== null) return this.core;\n const core = createPlayer(this.media, { handlers: await this.chain() });\n this.offs.push(\n core.on('sourcechange', (session) => {\n // Before the event goes out, so a control that reads `engine` on\n // `sourcechange` sees the session the event is about.\n this.current = session;\n this.emit('sourcechange', session);\n }),\n core.on('error', (error) => {\n this.report(error);\n }),\n );\n this.core = core;\n return core;\n }\n\n private async chain(): Promise<readonly Handler[]> {\n if (this.options.handlers !== undefined) return this.options.handlers;\n const config = this.options.config === undefined ? {} : { config: this.options.config };\n // The stack is read at load time: a preset builds its stages only when asked.\n const native = (stages: () => readonly Stage[]): Handler =>\n nativeHandler({\n // Read on every load, so the attribute applies without a new chain.\n prefer: (source, env) =>\n this.getAttribute(NATIVE_HLS) !== 'off' && preferNativeHls(source, env),\n drm: () => this.drm(stages),\n });\n if (this.options.stages !== undefined) {\n return [\n matteboxHandler({ stages: this.options.stages, ...config }),\n native(() => this.options.stages ?? []),\n ];\n }\n const name = this.getAttribute('preset') ?? DEFAULT_PRESET;\n const preset = await resolvePreset(name);\n if (preset === null) {\n this.report({\n category: 'config',\n code: 'CONFIG_INVALID',\n fatal: true,\n recoverable: false,\n handler: null,\n context: { preset: name },\n });\n return [nativeHandler()];\n }\n return [matteboxHandler({ preset, ...config, ...drmGuard() }), native(() => preset.stages())];\n }\n\n /**\n * The DRM a native session attaches: the page's `drm` option, the\n * key-system stages of the engine's stack, and the `license-url`\n * attribute. None on a browser without EME, as for the engine.\n */\n private drm(stages: () => readonly Stage[]): AttachEmeOptions | undefined {\n if (drmGuard().without !== undefined) return undefined;\n const keySystems = stages().filter((stage) => KEY_SYSTEMS.includes(stage.name));\n const license = this.getAttribute('license-url');\n const certificate = this.getAttribute('certificate-url');\n const page = this.options.drm;\n if (keySystems.length === 0 && license === null && page === undefined) return undefined;\n return {\n keySystems,\n ...page,\n ...(license === null ? {} : { licenseUrl: license }),\n ...(certificate === null ? {} : { certificateUrl: certificate }),\n };\n }\n\n /** What the attributes ask of the session's namespaces, once there is one. */\n private configure(session: Session): void {\n const engine = session.engine;\n if (engine === null) return;\n\n const optional = namespaces(engine);\n\n const license = this.getAttribute('license-url');\n // After the session exists, not before: passing a license URL up front\n // means constructing eme-core, and importing a stage to configure it\n // would bundle it.\n if (license !== null && optional.drm !== undefined) optional.drm.setLicenseUrl(license);\n const certificate = this.getAttribute('certificate-url');\n if (certificate !== null) optional.drm?.setCertificateUrl(certificate);\n\n const track = this.getAttribute('thumbnails');\n if (track !== null && optional.thumbnails !== undefined) {\n // Loaded here; drawn by the seek bar's preview under `controls=\"custom\"`.\n // Native controls expose no scrub position to anchor a preview to, so\n // under `native` the track only answers `engine.thumbnails.at(time)` for\n // the app. See docs/guide/03-the-element.md.\n void optional.thumbnails.load(track).catch(() => undefined);\n }\n }\n\n private unmount(): void {\n this.current = null;\n }\n\n private async teardown(): Promise<void> {\n this.unmount();\n if (this.core !== null) await this.core.unload();\n }\n\n /** Drops the player itself, so the next run builds a chain from the new preset. */\n private async discard(): Promise<void> {\n await this.teardown();\n for (const off of this.offs) off();\n this.offs = [];\n this.core = null;\n }\n}\n"],"mappings":";;;;;;;;;;;;;AA6CA,MAAM,aAAa;;AAGnB,MAAM,YAAY;CAAC;CAAY;CAAS;CAAU;AAAa;;AAG/D,MAAM,MAAM;CAAC;CAAO;CAAQ;CAAU;CAAe;CAAmB;CAAc;AAAU;;;;;;;;;AAUhG,MAAM,WAAW;;;;;;;;AASjB,MAAM,WAAW;;;;;;;AAQjB,MAAM,cAAc;;AAGpB,MAAM,eAAe;CACnB;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;AAGA,MAAM,cAAc,CAAC,gBAAgB,UAAU;;AAG/C,MAAM,iBAAiB;;;;;;AAkEvB,IAAI,WAAkC,CAAC;;;;;;;AASvC,IAAa,wBAAb,MAAa,8BAA8B,YAAkC;CAC3E,WAAW,qBAAwC;EACjD,OAAO;GAAC,GAAG;GAAW,GAAG;GAAK;GAAU;GAAU;EAAW;CAC/D;;;;;;;CAQA,OAAO,OAAO,SAAuC;EACnD,IAAI,YAAY,KAAA,GAAW,WAAW;EACtC,IAAI,eAAe,IAAA,iBAAU,MAAM,KAAA,GACjC,eAAe,OAAO,QAAQ,qBAAqB;CAEvD;CA6BA,YAAY,SAAiC;EAC3C,MAAM;EACN,KAAK,UAAU,WAAW;EAC1B,KAAK,YAAY;EACjB,KAAK,QAAQ;EACb,KAAK,QAAQ;EACb,KAAK,OAAO;EACZ,KAAK,UAAU;EACf,KAAK,UAAU;EACf,KAAK,aAAa;EAClB,KAAK,UAAU;EACf,KAAK,UAAU;EACf,KAAK,OAAO,CAAC;EACb,KAAK,QAAQ,QAAQ,QAAQ;EAC7B,KAAK,UAAU;EAEf,KAAK,QAAQ,SAAS,cAAc,OAAO;EAG3C,KAAK,MAAM,WAAW;EAKtB,KAAK,MAAM,aAAa,aAAa,EAAE;EACvC,KAAK,MAAM,QAAQ,cACjB,KAAK,MAA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,aAAa,OAAO,CAAC,CAAC,QAAQ,UAAU,YAAY,SAAS,MAAM,IAAI,CAAC;EAC9E,MAAM,UAAU,KAAK,aAAa,aAAa;EAC/C,MAAM,cAAc,KAAK,aAAa,iBAAiB;EACvD,MAAM,OAAO,KAAK,QAAQ;EAC1B,IAAI,WAAW,WAAW,KAAK,YAAY,QAAQ,SAAS,KAAA,GAAW,OAAO,KAAA;EAC9E,OAAO;GACL;GACA,GAAG;GACH,GAAI,YAAY,OAAO,CAAC,IAAI,EAAE,YAAY,QAAQ;GAClD,GAAI,gBAAgB,OAAO,CAAC,IAAI,EAAE,gBAAgB,YAAY;EAChE;CACF;;CAGA,UAAkB,SAAwB;EACxC,MAAM,SAAS,QAAQ;EACvB,IAAI,WAAW,MAAM;EAErB,MAAM,WAAW,WAAW,MAAM;EAElC,MAAM,UAAU,KAAK,aAAa,aAAa;EAI/C,IAAI,YAAY,QAAQ,SAAS,QAAQ,KAAA,GAAW,SAAS,IAAI,cAAc,OAAO;EACtF,MAAM,cAAc,KAAK,aAAa,iBAAiB;EACvD,IAAI,gBAAgB,MAAM,SAAS,KAAK,kBAAkB,WAAW;EAErE,MAAM,QAAQ,KAAK,aAAa,YAAY;EAC5C,IAAI,UAAU,QAAQ,SAAS,eAAe,KAAA,GAK5C,SAAc,WAAW,KAAK,KAAK,CAAC,CAAC,YAAY,KAAA,CAAS;CAE9D;CAEA,UAAwB;EACtB,KAAK,UAAU;CACjB;CAEA,MAAc,WAA0B;EACtC,KAAK,QAAQ;EACb,IAAI,KAAK,SAAS,MAAM,MAAM,KAAK,KAAK,OAAO;CACjD;;CAGA,MAAc,UAAyB;EACrC,MAAM,KAAK,SAAS;EACpB,KAAK,MAAM,OAAO,KAAK,MAAM,IAAI;EACjC,KAAK,OAAO,CAAC;EACb,KAAK,OAAO;CACd;AACF"}
@@ -1,54 +1,52 @@
1
- import { airplay } from '../controls/airplay.js';
2
- import { icon } from '../controls/icons.js';
3
- import { Component } from './component.js';
4
- import { BUTTON_STYLE, iconSlots, show, style } from './shared.js';
5
- const STATES = ['default', 'active'];
6
- export class MbxAirplayButton extends Component {
7
- static get observedAttributes() {
8
- return ['label', 'label-active'];
9
- }
10
- constructor() {
11
- super();
12
- this.api = null;
13
- const root = this.attachShadow({ mode: 'open' });
14
- this.button = document.createElement('button');
15
- this.button.type = 'button';
16
- this.button.setAttribute('part', 'button');
17
- this.slots = iconSlots(STATES, (state) => icon(state === 'active' ? 'airplay-active' : 'airplay'));
18
- for (const state of STATES)
19
- this.button.append(this.slots[state]);
20
- this.button.addEventListener('click', () => {
21
- this.api?.show();
22
- });
23
- root.append(style(BUTTON_STYLE), this.button);
24
- }
25
- attach(player) {
26
- const api = airplay(player.video);
27
- this.api = api;
28
- this.keep(api.watch(() => {
29
- this.render();
30
- }));
31
- // A new session decides whether the element can offer a target at all.
32
- this.follow(player, () => {
33
- this.render();
34
- return undefined;
35
- });
36
- }
37
- detach(player) {
38
- this.api = null;
39
- player.removeAttribute('airplay');
40
- }
41
- render() {
42
- const player = this.player;
43
- if (player === null || this.api === null)
44
- return;
45
- const active = this.api.active();
46
- this.hidden = !this.api.supported || !this.api.offered();
47
- show(this.slots, active ? 'active' : 'default');
48
- this.button.setAttribute('aria-label', active
49
- ? (this.getAttribute('label-active') ?? 'Stop AirPlay')
50
- : (this.getAttribute('label') ?? 'AirPlay'));
51
- player.toggleAttribute('airplay', active);
52
- }
53
- }
1
+ import { airplay } from "../controls/airplay.js";
2
+ import { icon } from "../controls/icons.js";
3
+ import { Component } from "./component.js";
4
+ import { BUTTON_STYLE, iconSlots, show, style } from "./shared.js";
5
+ //#region src/elements/airplay-button.ts
6
+ const STATES = ["default", "active"];
7
+ var MbxAirplayButton = class extends Component {
8
+ static get observedAttributes() {
9
+ return ["label", "label-active"];
10
+ }
11
+ constructor() {
12
+ super();
13
+ this.api = null;
14
+ const root = this.attachShadow({ mode: "open" });
15
+ this.button = document.createElement("button");
16
+ this.button.type = "button";
17
+ this.button.setAttribute("part", "button");
18
+ this.slots = iconSlots(STATES, (state) => icon(state === "active" ? "airplay-active" : "airplay"));
19
+ for (const state of STATES) this.button.append(this.slots[state]);
20
+ this.button.addEventListener("click", () => {
21
+ this.api?.show();
22
+ });
23
+ root.append(style(BUTTON_STYLE), this.button);
24
+ }
25
+ attach(player) {
26
+ const api = airplay(player.video);
27
+ this.api = api;
28
+ this.keep(api.watch(() => {
29
+ this.render();
30
+ }));
31
+ this.follow(player, () => {
32
+ this.render();
33
+ });
34
+ }
35
+ detach(player) {
36
+ this.api = null;
37
+ player.removeAttribute("airplay");
38
+ }
39
+ render() {
40
+ const player = this.player;
41
+ if (player === null || this.api === null) return;
42
+ const active = this.api.active();
43
+ this.hidden = !this.api.supported || !this.api.offered();
44
+ show(this.slots, active ? "active" : "default");
45
+ this.button.setAttribute("aria-label", active ? this.getAttribute("label-active") ?? "Stop AirPlay" : this.getAttribute("label") ?? "AirPlay");
46
+ player.toggleAttribute("airplay", active);
47
+ }
48
+ };
49
+ //#endregion
50
+ export { MbxAirplayButton };
51
+
54
52
  //# sourceMappingURL=airplay-button.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"airplay-button.js","sourceRoot":"","sources":["../../src/elements/airplay-button.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,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,SAAS,EAAE,QAAQ,CAAC,CAAC;AAEvD,MAAM,OAAO,gBAAiB,SAAQ,SAAS;IAC7C,MAAM,KAAK,kBAAkB;QAC3B,OAAO,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;IACnC,CAAC;IAMD;QACE,KAAK,EAAE,CAAC;QACR,I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MAAM,EAAE,CAAC;YACd,OAAO,SAAS,CAAC;QACnB,CAAC,CAAC,CAAC;IACL,CAAC;IAEkB,MAAM,CAAC,MAAkB;QAC1C,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC;QAChB,MAAM,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;IACpC,CAAC;IAEkB,MAAM;QACvB,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC3B,IAAI,MAAM,KAAK,IAAI,IAAI,IAAI,CAAC,GAAG,KAAK,IAAI;YAAE,OAAO;QACjD,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;QACjC,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;QACzD,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QAChD,IAAI,CAAC,MAAM,CAAC,YAAY,CACtB,YAAY,EACZ,MAAM;YACJ,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,cAAc,CAAC,IAAI,cAAc,CAAC;YACvD,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,SAAS,CAAC,CAC9C,CAAC;QACF,MAAM,CAAC,eAAe,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAC5C,CAAC;CACF"}
1
+ {"version":3,"file":"airplay-button.js","names":[],"sources":["../../src/elements/airplay-button.ts"],"sourcesContent":["/**\n * <mbx-airplay-button>: opens Safari's AirPlay picker for the video, and\n * is hidden where there is no AirPlay. The glyph is `icon` or\n * `icon-active`, the name `label` or `label-active`, and the element sets\n * `airplay` on the player while the video plays on a target.\n *\n * It is also hidden while the element cannot offer a target, which is what\n * an engine session without an AirPlay source alternative leaves behind.\n * Nothing announces that, so it is read again on every source change.\n */\nimport type { Airplay } from '../controls/airplay.js';\nimport { airplay } from '../controls/airplay.js';\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 = 'default' | 'active';\nconst STATES: readonly State[] = ['default', 'active'];\n\nexport class MbxAirplayButton extends Component {\n static get observedAttributes(): readonly string[] {\n return ['label', 'label-active'];\n }\n\n declare private readonly button: HTMLButtonElement;\n declare private readonly slots: Record<State, HTMLSlotElement>;\n declare private api: Airplay | null;\n\n constructor() {\n super();\n this.api = null;\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, (state) =>\n icon(state === 'active' ? 'airplay-active' : 'airplay'),\n );\n for (const state of STATES) this.button.append(this.slots[state]);\n this.button.addEventListener('click', () => {\n this.api?.show();\n });\n root.append(style(BUTTON_STYLE), this.button);\n }\n\n protected override attach(player: PlayerHost): void {\n const api = airplay(player.video);\n this.api = api;\n this.keep(\n api.watch(() => {\n this.render();\n }),\n );\n // A new session decides whether the element can offer a target at all.\n this.follow(player, () => {\n this.render();\n return undefined;\n });\n }\n\n protected override detach(player: PlayerHost): void {\n this.api = null;\n player.removeAttribute('airplay');\n }\n\n protected override render(): void {\n const player = this.player;\n if (player === null || this.api === null) return;\n const active = this.api.active();\n this.hidden = !this.api.supported || !this.api.offered();\n show(this.slots, active ? 'active' : 'default');\n this.button.setAttribute(\n 'aria-label',\n active\n ? (this.getAttribute('label-active') ?? 'Stop AirPlay')\n : (this.getAttribute('label') ?? 'AirPlay'),\n );\n player.toggleAttribute('airplay', active);\n }\n}\n"],"mappings":";;;;;AAkBA,MAAM,SAA2B,CAAC,WAAW,QAAQ;AAErD,IAAa,mBAAb,cAAsC,UAAU;CAC9C,WAAW,qBAAwC;EACjD,OAAO,CAAC,SAAS,cAAc;CACjC;CAMA,cAAc;EACZ,MAAM;EACN,KAAK,MAAM;EACX,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,SAAS,UAC9B,KAAK,UAAU,WAAW,mBAAmB,SAAS,CACxD;EACA,KAAK,MAAM,SAAS,QAAQ,KAAK,OAAO,OAAO,KAAK,MAAM,MAAM;EAChE,KAAK,OAAO,iBAAiB,eAAe;GAC1C,KAAK,KAAK,KAAK;EACjB,CAAC;EACD,KAAK,OAAO,MAAM,YAAY,GAAG,KAAK,MAAM;CAC9C;CAEA,OAA0B,QAA0B;EAClD,MAAM,MAAM,QAAQ,OAAO,KAAK;EAChC,KAAK,MAAM;EACX,KAAK,KACH,IAAI,YAAY;GACd,KAAK,OAAO;EACd,CAAC,CACH;EAEA,KAAK,OAAO,cAAc;GACxB,KAAK,OAAO;EAEd,CAAC;CACH;CAEA,OAA0B,QAA0B;EAClD,KAAK,MAAM;EACX,OAAO,gBAAgB,SAAS;CAClC;CAEA,SAAkC;EAChC,MAAM,SAAS,KAAK;EACpB,IAAI,WAAW,QAAQ,KAAK,QAAQ,MAAM;EAC1C,MAAM,SAAS,KAAK,IAAI,OAAO;EAC/B,KAAK,SAAS,CAAC,KAAK,IAAI,aAAa,CAAC,KAAK,IAAI,QAAQ;EACvD,KAAK,KAAK,OAAO,SAAS,WAAW,SAAS;EAC9C,KAAK,OAAO,aACV,cACA,SACK,KAAK,aAAa,cAAc,KAAK,iBACrC,KAAK,aAAa,OAAO,KAAK,SACrC;EACA,OAAO,gBAAgB,WAAW,MAAM;CAC1C;AACF"}
@@ -1,16 +1,25 @@
1
1
  /**
2
- * <mbx-audio-menu>: the audio track over `engine.tracks`. Hidden unless
3
- * there is a choice to make, and for a native session. The name comes
4
- * from `label`. A track reads as its language, then its role, then its
5
- * id: whichever the manifest gave.
2
+ * <mbx-audio-menu>: the audio track over `engine.tracks`, or over the
3
+ * video's `audioTracks` for a native session. Hidden unless there is a
4
+ * choice to make. The name comes from `label`. An engine track reads as
5
+ * its name in the manifest, else its language's name, else its language
6
+ * code, else "Track" (`label-track`) and its place. A native track reads
7
+ * the same from its label and language. A badge marks an
8
+ * audio description track (`label-ad`, "AD") and the original language
9
+ * (`label-original`, "Original"), from the engine's standard
10
+ * characteristics (guide chapter 06), or from the native track's `kind`.
6
11
  */
7
12
  import type { ContentType, Mattebox, Track } from 'mattebox';
13
+ import type { TrackEntry } from '../controls/track-names.js';
8
14
  import type { PlayerHost } from '../host.js';
9
15
  import { MenuElement } from './menu-element.js';
10
- /** The language, then the role, then the id: whichever the manifest gave. */
11
- export declare function trackLabel(track: Track): string;
12
- /** The tracks of one content type as menu items, with the active one's id. */
13
- export declare function trackItems(engine: Mattebox, contentType: ContentType): [Array<readonly [string, string]>, string | null];
16
+ /**
17
+ * The tracks of one content type that the engine can play and `listed`
18
+ * keeps, as entries with their badges, and the active one's id when it
19
+ * is listed. A track the browser cannot decode, or that no stage plays,
20
+ * stays out (guide chapter 06).
21
+ */
22
+ export declare function trackItems(engine: Mattebox, contentType: ContentType, badges?: (track: Track) => readonly string[], listed?: (track: Track) => boolean): [TrackEntry[], string | null];
14
23
  /** Subscribes `tick` to the track events, and answers the unsubscribe. */
15
24
  export declare function onTracks(engine: Mattebox, tick: () => void): () => void;
16
25
  export declare class MbxAudioMenu extends MenuElement {
@@ -19,6 +28,8 @@ export declare class MbxAudioMenu extends MenuElement {
19
28
  constructor();
20
29
  protected name(): string;
21
30
  protected attach(player: PlayerHost): void;
31
+ /** The native session's audio tracks as entries, and the enabled one's. */
32
+ private native;
22
33
  protected render(): void;
23
34
  }
24
35
  //# sourceMappingURL=audio-menu.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"audio-menu.d.ts","sourceRoot":"","sources":["../../src/elements/audio-menu.ts"],"names":[],"mappings":"AAAA;;;;;GAK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xB,MAAM,GAAE,CAAC,KAAK,EAAE,KAAK,KAAK,SAAS,MAAM,EAAa,EACtD,MAAM,GAAE,CAAC,KAAK,EAAE,KAAK,KAAK,OAAoB,GAC7C,CAAC,UAAU,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC,CAiB/B;AAOD,0EAA0E;AAC1E,wBAAgB,QAAQ,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAKvE;AAED,qBAAa,YAAa,SAAQ,WAAW;IAC3C,MAAM,KAAK,kBAAkB,IAAI,SAAS,MAAM,EAAE,CAEjD;IAED,QAAgB,MAAM,CAAkB;;cAQrB,IAAI,IAAI,MAAM;cAId,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI;IAanD,2EAA2E;IAC3E,OAAO,CAAC,MAAM;cAgBK,MAAM,IAAI,IAAI;CAsClC"}
@@ -1,70 +1,108 @@
1
- import { MenuElement, single } from './menu-element.js';
2
- import { show } from './shared.js';
3
- /** The language, then the role, then the id: whichever the manifest gave. */
4
- export function trackLabel(track) {
5
- const parts = [track.lang, track.role].filter((part) => part !== undefined);
6
- return parts.length === 0 ? track.id : parts.join(' · ');
1
+ import { show } from "./shared.js";
2
+ import { nativeTracks, onNativeTracks } from "../controls/native-tracks.js";
3
+ import { layout, trackNames } from "../controls/track-names.js";
4
+ import { MenuElement, single } from "./menu-element.js";
5
+ import { isAudioDescription, isOriginal } from "mattebox";
6
+ //#region src/elements/audio-menu.ts
7
+ /** A track's channel layout, from its first rendition: `audioObjects` `JOC` is Dolby Atmos. */
8
+ function channels(track) {
9
+ const first = track.renditions[0];
10
+ return first?.channels === void 0 ? void 0 : layout(`${first.channels}${first.audioObjects ? `/${first.audioObjects}` : ""}`);
7
11
  }
8
- /** The tracks of one content type as menu items, with the active one's id. */
9
- export function trackItems(engine, contentType) {
10
- const tracks = engine.tracks;
11
- const available = tracks.available.filter((track) => track.contentType === contentType);
12
- const items = [];
13
- for (const track of available)
14
- items.push([track.id, trackLabel(track)]);
15
- return [items, tracks.active(contentType)?.id ?? null];
12
+ /**
13
+ * The tracks of one content type that the engine can play and `listed`
14
+ * keeps, as entries with their badges, and the active one's id when it
15
+ * is listed. A track the browser cannot decode, or that no stage plays,
16
+ * stays out (guide chapter 06).
17
+ */
18
+ function trackItems(engine, contentType, badges = () => [], listed = () => true) {
19
+ const tracks = engine.tracks;
20
+ const available = tracks.available.filter((track) => track.contentType === contentType && tracks.selectable(track.id) && listed(track));
21
+ const entries = available.map((track) => [
22
+ track.id,
23
+ track.name,
24
+ track.lang,
25
+ badges(track),
26
+ [channels(track), track.role === "main" ? void 0 : track.role]
27
+ ]);
28
+ const active = tracks.active(contentType)?.id;
29
+ return [entries, available.some((track) => track.id === active) ? active : null];
16
30
  }
17
31
  /** Subscribes `tick` to the track events, and answers the unsubscribe. */
18
- export function onTracks(engine, tick) {
19
- const offs = [engine.on('tracks:changed', tick), engine.on('tracks:selected', tick)];
20
- return () => {
21
- for (const off of offs)
22
- off();
23
- };
24
- }
25
- export class MbxAudioMenu extends MenuElement {
26
- static get observedAttributes() {
27
- return ['label', 'label-back'];
28
- }
29
- constructor() {
30
- super(...single('music'));
31
- this.engine = null;
32
- show(this.slots, 'default');
33
- }
34
- name() {
35
- return 'Audio';
36
- }
37
- attach(player) {
38
- this.follow(player, (engine) => {
39
- this.engine = engine;
40
- this.render();
41
- if (engine === null)
42
- return undefined;
43
- return onTracks(engine, () => {
44
- this.render();
45
- });
46
- });
47
- }
48
- render() {
49
- super.render();
50
- const engine = this.engine;
51
- if (engine === null) {
52
- this.hidden = true;
53
- return;
54
- }
55
- const [items, active] = trackItems(engine, 'audio');
56
- this.menu.fill([
57
- {
58
- name: 'track',
59
- items,
60
- value: active ?? '',
61
- onSelect: (value) => {
62
- engine.tracks.select(value);
63
- this.render();
64
- },
65
- },
66
- ]);
67
- this.hidden = items.length < 2;
68
- }
32
+ function onTracks(engine, tick) {
33
+ const offs = [engine.on("tracks:changed", tick), engine.on("tracks:selected", tick)];
34
+ return () => {
35
+ for (const off of offs) off();
36
+ };
69
37
  }
38
+ var MbxAudioMenu = class extends MenuElement {
39
+ static get observedAttributes() {
40
+ return [
41
+ "label",
42
+ "label-back",
43
+ "label-ad",
44
+ "label-original",
45
+ "label-track"
46
+ ];
47
+ }
48
+ constructor() {
49
+ super(...single("music"));
50
+ this.engine = null;
51
+ show(this.slots, "default");
52
+ }
53
+ name() {
54
+ return "Audio";
55
+ }
56
+ attach(player) {
57
+ this.follow(player, (engine) => {
58
+ this.engine = engine;
59
+ this.render();
60
+ const tick = () => {
61
+ this.render();
62
+ };
63
+ return engine === null ? onNativeTracks(player.video, "audioTracks", tick) : onTracks(engine, tick);
64
+ });
65
+ }
66
+ /** The native session's audio tracks as entries, and the enabled one's. */
67
+ native(tracks) {
68
+ const ad = this.getAttribute("label-ad") ?? "AD";
69
+ const entries = tracks.map((track, index) => [
70
+ String(index),
71
+ track.label,
72
+ track.language,
73
+ track.kind === "description" || track.kind === "main-desc" ? [ad] : [],
74
+ []
75
+ ]);
76
+ const on = tracks.findIndex((track) => track.enabled);
77
+ return [entries, on === -1 ? null : String(on)];
78
+ }
79
+ render() {
80
+ super.render();
81
+ const engine = this.engine;
82
+ const player = this.player;
83
+ const tracks = engine === null && player !== null ? nativeTracks(player, "audioTracks") : void 0;
84
+ if (engine === null && tracks === void 0) {
85
+ this.hidden = true;
86
+ return;
87
+ }
88
+ const [entries, active] = tracks !== void 0 ? this.native(tracks) : trackItems(engine, "audio", (track) => [...isAudioDescription(track) ? [this.getAttribute("label-ad") ?? "AD"] : [], ...isOriginal(track) ? [this.getAttribute("label-original") ?? "Original"] : []]);
89
+ const items = trackNames(entries, this.getAttribute("label-track"));
90
+ this.menu.fill([{
91
+ name: "track",
92
+ items,
93
+ value: active ?? "",
94
+ onSelect: (value) => {
95
+ if (tracks !== void 0) tracks.forEach((track, index) => {
96
+ track.enabled = String(index) === value;
97
+ });
98
+ else engine?.tracks.select(value);
99
+ this.render();
100
+ }
101
+ }]);
102
+ this.hidden = items.length < 2;
103
+ }
104
+ };
105
+ //#endregion
106
+ export { MbxAudioMenu, onTracks, trackItems };
107
+
70
108
  //# sourceMappingURL=audio-menu.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"audio-menu.js","sourceRoot":"","sources":["../../src/elements/audio-menu.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,6EAA6E;AAC7E,MAAM,UAAU,UAAU,CAAC,KAAY;IACrC,MAAM,KAAK,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC;IAC5E,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC3D,CAAC;AAED,8EAA8E;AAC9E,MAAM,UAAU,UAAU,CACxB,MAAgB,EAChB,WAAwB;IAExB,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IAC7B,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,KAAK,WAAW,CAAC,CAAC;IACxF,MAAM,KAAK,GAAqC,EAAE,CAAC;IACnD,KAAK,MAAM,KAAK,IAAI,SAAS;QAAE,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACzE,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,EAAE,IAAI,IAAI,CAAC,CAAC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,GAAG,IAAI,CAAC;YACnB,OAAO;QACT,CAAC;QACD,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACpD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;YACb;gBACE,IAAI,EAAE,OAAO;gBACb,KAAK;gBACL,KAAK,EAAE,MAAM,IAAI,EAAE;gBACnB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;oBAClB,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;oBAC5B,IAAI,CAAC,MAAM,EAAE,CAAC;gBAChB,CAAC;aACF;SACF,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;IACjC,CAAC;CACF"}
1
+ {"version":3,"file":"audio-menu.js","names":[],"sources":["../../src/elements/audio-menu.ts"],"sourcesContent":["/**\n * <mbx-audio-menu>: the audio track over `engine.tracks`, or over the\n * video's `audioTracks` for a native session. Hidden unless there is a\n * choice to make. The name comes from `label`. An engine track reads as\n * its name in the manifest, else its language's name, else its language\n * code, else \"Track\" (`label-track`) and its place. A native track reads\n * the same from its label and language. A badge marks an\n * audio description track (`label-ad`, \"AD\") and the original language\n * (`label-original`, \"Original\"), from the engine's standard\n * characteristics (guide chapter 06), or from the native track's `kind`.\n */\nimport type { ContentType, Mattebox, Track } from 'mattebox';\nimport { isAudioDescription, isOriginal } from 'mattebox';\nimport type { NativeTrack } from '../controls/native-tracks.js';\nimport { nativeTracks, onNativeTracks } from '../controls/native-tracks.js';\nimport type { TrackEntry } from '../controls/track-names.js';\nimport { layout, trackNames } from '../controls/track-names.js';\nimport type { PlayerHost } from '../host.js';\nimport { MenuElement, single } from './menu-element.js';\nimport { show } from './shared.js';\n\n/** A track's channel layout, from its first rendition: `audioObjects` `JOC` is Dolby Atmos. */\nfunction channels(track: Track): string | undefined {\n const first = track.renditions[0];\n return first?.channels === undefined\n ? undefined\n : layout(`${first.channels}${first.audioObjects ? `/${first.audioObjects}` : ''}`);\n}\n\n/**\n * The tracks of one content type that the engine can play and `listed`\n * keeps, as entries with their badges, and the active one's id when it\n * is listed. A track the browser cannot decode, or that no stage plays,\n * stays out (guide chapter 06).\n */\nexport function trackItems(\n engine: Mattebox,\n contentType: ContentType,\n badges: (track: Track) => readonly string[] = () => [],\n listed: (track: Track) => boolean = () => true,\n): [TrackEntry[], string | null] {\n const tracks = engine.tracks;\n const available = tracks.available.filter(\n (track) => track.contentType === contentType && tracks.selectable(track.id) && listed(track),\n );\n const entries = available.map(\n (track): TrackEntry => [\n track.id,\n track.name,\n track.lang,\n badges(track),\n // The role \"main\" tells nothing apart: every stream has one.\n [channels(track), track.role === 'main' ? undefined : track.role],\n ],\n );\n const active = tracks.active(contentType)?.id;\n return [entries, available.some((track) => track.id === active) ? (active as string) : null];\n}\n\n/** What the menu reads and writes of Safari's `AudioTrack`. */\ninterface NativeAudioTrack extends NativeTrack {\n enabled: boolean;\n}\n\n/** Subscribes `tick` to the track events, and answers the unsubscribe. */\nexport function onTracks(engine: Mattebox, tick: () => void): () => void {\n const offs = [engine.on('tracks:changed', tick), engine.on('tracks:selected', tick)];\n return () => {\n for (const off of offs) off();\n };\n}\n\nexport class MbxAudioMenu extends MenuElement {\n static get observedAttributes(): readonly string[] {\n return ['label', 'label-back', 'label-ad', 'label-original', 'label-track'];\n }\n\n declare private engine: Mattebox | null;\n\n constructor() {\n super(...single('music'));\n this.engine = null;\n show(this.slots, 'default');\n }\n\n protected override name(): string {\n return 'Audio';\n }\n\n protected override attach(player: PlayerHost): void {\n this.follow(player, (engine) => {\n this.engine = engine;\n this.render();\n const tick = (): void => {\n this.render();\n };\n return engine === null\n ? onNativeTracks(player.video, 'audioTracks', tick)\n : onTracks(engine, tick);\n });\n }\n\n /** The native session's audio tracks as entries, and the enabled one's. */\n private native(tracks: readonly NativeAudioTrack[]): [TrackEntry[], string | null] {\n const ad = this.getAttribute('label-ad') ?? 'AD';\n const entries = tracks.map(\n (track, index): TrackEntry => [\n String(index),\n track.label,\n track.language,\n // HTML's kinds for an audio description track.\n track.kind === 'description' || track.kind === 'main-desc' ? [ad] : [],\n [],\n ],\n );\n const on = tracks.findIndex((track) => track.enabled);\n return [entries, on === -1 ? null : String(on)];\n }\n\n protected override render(): void {\n super.render();\n const engine = this.engine;\n const player = this.player;\n const tracks =\n engine === null && player !== null\n ? nativeTracks<NativeAudioTrack>(player, 'audioTracks')\n : undefined;\n if (engine === null && tracks === undefined) {\n this.hidden = true;\n return;\n }\n const [entries, active] =\n tracks !== undefined\n ? this.native(tracks)\n : trackItems(engine as Mattebox, 'audio', (track) => [\n ...(isAudioDescription(track) ? [this.getAttribute('label-ad') ?? 'AD'] : []),\n ...(isOriginal(track) ? [this.getAttribute('label-original') ?? 'Original'] : []),\n ]);\n const items = trackNames(entries, this.getAttribute('label-track'));\n this.menu.fill([\n {\n name: 'track',\n items,\n value: active ?? '',\n onSelect: (value) => {\n // One audio track plays at a time, so the others are turned off.\n if (tracks !== undefined) {\n tracks.forEach((track, index) => {\n track.enabled = String(index) === value;\n });\n } else engine?.tracks.select(value);\n this.render();\n },\n },\n ]);\n this.hidden = items.length < 2;\n }\n}\n"],"mappings":";;;;;;;AAsBA,SAAS,SAAS,OAAkC;CAClD,MAAM,QAAQ,MAAM,WAAW;CAC/B,OAAO,OAAO,aAAa,KAAA,IACvB,KAAA,IACA,OAAO,GAAG,MAAM,WAAW,MAAM,eAAe,IAAI,MAAM,iBAAiB,IAAI;AACrF;;;;;;;AAQA,SAAgB,WACd,QACA,aACA,eAAoD,CAAC,GACrD,eAA0C,MACX;CAC/B,MAAM,SAAS,OAAO;CACtB,MAAM,YAAY,OAAO,UAAU,QAChC,UAAU,MAAM,gBAAgB,eAAe,OAAO,WAAW,MAAM,EAAE,KAAK,OAAO,KAAK,CAC7F;CACA,MAAM,UAAU,UAAU,KACvB,UAAsB;EACrB,MAAM;EACN,MAAM;EACN,MAAM;E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AE,UAAU,GAAG,IAAI;cAYhC,MAAM,IAAI,IAAI;CA2BlC"}
1
+ {"version":3,"file":"chapters-menu.d.ts","sourceRoot":"","sources":["../../src/elements/chapters-menu.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAU,MAAM,mBAAmB,CAAC;AAGxD,qBAAa,eAAgB,SAAQ,WAAW;IAC9C,MAAM,KAAK,kBAAkB,IAAI,SAAS,MAAM,EAAE,CAEjD;IAED,+FAA+F;IAC/F,QAAgB,KAAK,CAAS;;cAQX,IAAI,IAAI,MAAM;cAId,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI;cAYhC,MAAM,IAAI,IAAI;CA4BlC"}