@mattebox/player 0.14.0 → 0.15.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 (279) hide show
  1. package/dist/cdn/mattebox-player.min.js +3 -3
  2. package/dist/controls/chapters.js +1 -1
  3. package/dist/controls/chapters.js.map +1 -1
  4. package/dist/controls/cues.js.map +1 -1
  5. package/dist/controls/native-tracks.js +1 -1
  6. package/dist/controls/native-tracks.js.map +1 -1
  7. package/dist/element-entry.d.ts +1 -0
  8. package/dist/element-entry.d.ts.map +1 -1
  9. package/dist/element-entry.js.map +1 -1
  10. package/dist/element.d.ts +49 -3
  11. package/dist/element.d.ts.map +1 -1
  12. package/dist/element.js +196 -36
  13. package/dist/element.js.map +1 -1
  14. package/dist/elements/airplay-button.js +1 -1
  15. package/dist/elements/airplay-button.js.map +1 -1
  16. package/dist/elements/audio-menu.d.ts.map +1 -1
  17. package/dist/elements/audio-menu.js +4 -3
  18. package/dist/elements/audio-menu.js.map +1 -1
  19. package/dist/elements/casting.d.ts +12 -0
  20. package/dist/elements/casting.d.ts.map +1 -0
  21. package/dist/elements/casting.js +58 -0
  22. package/dist/elements/casting.js.map +1 -0
  23. package/dist/elements/chapters-menu.js +5 -5
  24. package/dist/elements/chapters-menu.js.map +1 -1
  25. package/dist/elements/component.d.ts +13 -0
  26. package/dist/elements/component.d.ts.map +1 -1
  27. package/dist/elements/component.js +21 -3
  28. package/dist/elements/component.js.map +1 -1
  29. package/dist/elements/control-bar.d.ts.map +1 -1
  30. package/dist/elements/control-bar.js +7 -6
  31. package/dist/elements/control-bar.js.map +1 -1
  32. package/dist/elements/current-time.js +2 -2
  33. package/dist/elements/current-time.js.map +1 -1
  34. package/dist/elements/drm-badge.js +1 -1
  35. package/dist/elements/drm-badge.js.map +1 -1
  36. package/dist/elements/duration.js +3 -3
  37. package/dist/elements/duration.js.map +1 -1
  38. package/dist/elements/error-screen.js +1 -1
  39. package/dist/elements/error-screen.js.map +1 -1
  40. package/dist/elements/fullscreen-button.d.ts.map +1 -1
  41. package/dist/elements/fullscreen-button.js +3 -2
  42. package/dist/elements/fullscreen-button.js.map +1 -1
  43. package/dist/elements/live-button.js +2 -2
  44. package/dist/elements/live-button.js.map +1 -1
  45. package/dist/elements/marker-button.js +3 -3
  46. package/dist/elements/marker-button.js.map +1 -1
  47. package/dist/elements/menu-element.js +3 -3
  48. package/dist/elements/menu-element.js.map +1 -1
  49. package/dist/elements/mute-button.js +3 -3
  50. package/dist/elements/mute-button.js.map +1 -1
  51. package/dist/elements/pip-button.d.ts.map +1 -1
  52. package/dist/elements/pip-button.js +6 -2
  53. package/dist/elements/pip-button.js.map +1 -1
  54. package/dist/elements/play-button.js +3 -3
  55. package/dist/elements/play-button.js.map +1 -1
  56. package/dist/elements/quality-menu.d.ts.map +1 -1
  57. package/dist/elements/quality-menu.js +5 -4
  58. package/dist/elements/quality-menu.js.map +1 -1
  59. package/dist/elements/remaining-time.js +2 -2
  60. package/dist/elements/remaining-time.js.map +1 -1
  61. package/dist/elements/scan-button.d.ts.map +1 -1
  62. package/dist/elements/scan-button.js +4 -3
  63. package/dist/elements/scan-button.js.map +1 -1
  64. package/dist/elements/seek-bar.d.ts.map +1 -1
  65. package/dist/elements/seek-bar.js +20 -16
  66. package/dist/elements/seek-bar.js.map +1 -1
  67. package/dist/elements/shared.js +3 -3
  68. package/dist/elements/shared.js.map +1 -1
  69. package/dist/elements/skip-button.js +2 -2
  70. package/dist/elements/skip-button.js.map +1 -1
  71. package/dist/elements/spacer.js.map +1 -1
  72. package/dist/elements/speed-menu.d.ts.map +1 -1
  73. package/dist/elements/speed-menu.js +4 -3
  74. package/dist/elements/speed-menu.js.map +1 -1
  75. package/dist/elements/spinner.js +1 -1
  76. package/dist/elements/spinner.js.map +1 -1
  77. package/dist/elements/start-button.js +3 -3
  78. package/dist/elements/start-button.js.map +1 -1
  79. package/dist/elements/subtitles-menu.d.ts.map +1 -1
  80. package/dist/elements/subtitles-menu.js +5 -4
  81. package/dist/elements/subtitles-menu.js.map +1 -1
  82. package/dist/elements/time-element.js +1 -1
  83. package/dist/elements/time-element.js.map +1 -1
  84. package/dist/elements/title.js +1 -1
  85. package/dist/elements/title.js.map +1 -1
  86. package/dist/elements/video-menu.d.ts.map +1 -1
  87. package/dist/elements/video-menu.js +5 -4
  88. package/dist/elements/video-menu.js.map +1 -1
  89. package/dist/elements/volume-slider.js +4 -4
  90. package/dist/elements/volume-slider.js.map +1 -1
  91. package/dist/elements/volume.js.map +1 -1
  92. package/dist/entries/airplay-button.js +1 -1
  93. package/dist/entries/audio-menu.js +1 -1
  94. package/dist/entries/casting.d.ts +5 -0
  95. package/dist/entries/casting.d.ts.map +1 -0
  96. package/dist/entries/casting.js +8 -0
  97. package/dist/entries/casting.js.map +1 -0
  98. package/dist/entries/chapters-menu.js +1 -1
  99. package/dist/entries/control-bar.js +1 -1
  100. package/dist/entries/current-time.js +1 -1
  101. package/dist/entries/drm-badge.js +1 -1
  102. package/dist/entries/duration.js +1 -1
  103. package/dist/entries/error-screen.js +1 -1
  104. package/dist/entries/fullscreen-button.js +1 -1
  105. package/dist/entries/live-button.js +1 -1
  106. package/dist/entries/marker-button.js +1 -1
  107. package/dist/entries/mute-button.js +1 -1
  108. package/dist/entries/pip-button.js +1 -1
  109. package/dist/entries/play-button.js +1 -1
  110. package/dist/entries/quality-menu.js +1 -1
  111. package/dist/entries/remaining-time.js +1 -1
  112. package/dist/entries/scan-button.js +1 -1
  113. package/dist/entries/seek-bar.js +1 -1
  114. package/dist/entries/skip-button.js +1 -1
  115. package/dist/entries/spacer.js +1 -1
  116. package/dist/entries/speed-menu.js +1 -1
  117. package/dist/entries/spinner.js +1 -1
  118. package/dist/entries/start-button.js +1 -1
  119. package/dist/entries/subtitles-menu.js +1 -1
  120. package/dist/entries/title.js +1 -1
  121. package/dist/entries/video-menu.js +1 -1
  122. package/dist/entries/volume-slider.js +1 -1
  123. package/dist/entries/volume.js +1 -1
  124. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.155.0 → _@oxc-project_runtime@0.158.0}/helpers/esm/asyncToGenerator.js +1 -1
  125. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.155.0 → _@oxc-project_runtime@0.158.0}/helpers/esm/defineProperty.js +1 -1
  126. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.155.0 → _@oxc-project_runtime@0.158.0}/helpers/esm/objectSpread2.js +1 -1
  127. package/dist/es2015/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/toPrimitive.js +13 -0
  128. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.155.0 → _@oxc-project_runtime@0.158.0}/helpers/esm/toPropertyKey.js +1 -1
  129. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.155.0 → _@oxc-project_runtime@0.158.0}/helpers/esm/typeof.js +1 -1
  130. package/dist/es2015/controls/chapters.js +2 -2
  131. package/dist/es2015/controls/menu.js +1 -1
  132. package/dist/es2015/controls/native-tracks.js +1 -1
  133. package/dist/es2015/element.js +213 -44
  134. package/dist/es2015/elements/airplay-button.js +1 -1
  135. package/dist/es2015/elements/audio-menu.js +4 -3
  136. package/dist/es2015/elements/casting.js +57 -0
  137. package/dist/es2015/elements/chapters-menu.js +5 -5
  138. package/dist/es2015/elements/component.js +26 -7
  139. package/dist/es2015/elements/control-bar.js +7 -6
  140. package/dist/es2015/elements/current-time.js +2 -2
  141. package/dist/es2015/elements/drm-badge.js +1 -1
  142. package/dist/es2015/elements/duration.js +3 -3
  143. package/dist/es2015/elements/error-screen.js +1 -1
  144. package/dist/es2015/elements/fullscreen-button.js +3 -2
  145. package/dist/es2015/elements/live-button.js +2 -2
  146. package/dist/es2015/elements/marker-button.js +3 -3
  147. package/dist/es2015/elements/menu-element.js +4 -4
  148. package/dist/es2015/elements/mute-button.js +3 -3
  149. package/dist/es2015/elements/pip-button.js +6 -2
  150. package/dist/es2015/elements/play-button.js +3 -3
  151. package/dist/es2015/elements/quality-menu.js +5 -4
  152. package/dist/es2015/elements/remaining-time.js +2 -2
  153. package/dist/es2015/elements/scan-button.js +4 -3
  154. package/dist/es2015/elements/seek-bar.js +20 -16
  155. package/dist/es2015/elements/shared.js +3 -3
  156. package/dist/es2015/elements/skip-button.js +2 -2
  157. package/dist/es2015/elements/speed-menu.js +4 -3
  158. package/dist/es2015/elements/spinner.js +1 -1
  159. package/dist/es2015/elements/start-button.js +3 -3
  160. package/dist/es2015/elements/subtitles-menu.js +5 -4
  161. package/dist/es2015/elements/time-element.js +1 -1
  162. package/dist/es2015/elements/title.js +1 -1
  163. package/dist/es2015/elements/video-menu.js +5 -4
  164. package/dist/es2015/elements/volume-slider.js +4 -4
  165. package/dist/es2015/entries/airplay-button.js +1 -1
  166. package/dist/es2015/entries/audio-menu.js +1 -1
  167. package/dist/es2015/entries/casting.js +6 -0
  168. package/dist/es2015/entries/chapters-menu.js +1 -1
  169. package/dist/es2015/entries/control-bar.js +1 -1
  170. package/dist/es2015/entries/current-time.js +1 -1
  171. package/dist/es2015/entries/drm-badge.js +1 -1
  172. package/dist/es2015/entries/duration.js +1 -1
  173. package/dist/es2015/entries/error-screen.js +1 -1
  174. package/dist/es2015/entries/fullscreen-button.js +1 -1
  175. package/dist/es2015/entries/live-button.js +1 -1
  176. package/dist/es2015/entries/marker-button.js +1 -1
  177. package/dist/es2015/entries/mute-button.js +1 -1
  178. package/dist/es2015/entries/pip-button.js +1 -1
  179. package/dist/es2015/entries/play-button.js +1 -1
  180. package/dist/es2015/entries/quality-menu.js +1 -1
  181. package/dist/es2015/entries/remaining-time.js +1 -1
  182. package/dist/es2015/entries/scan-button.js +1 -1
  183. package/dist/es2015/entries/seek-bar.js +1 -1
  184. package/dist/es2015/entries/skip-button.js +1 -1
  185. package/dist/es2015/entries/spacer.js +1 -1
  186. package/dist/es2015/entries/speed-menu.js +1 -1
  187. package/dist/es2015/entries/spinner.js +1 -1
  188. package/dist/es2015/entries/start-button.js +1 -1
  189. package/dist/es2015/entries/subtitles-menu.js +1 -1
  190. package/dist/es2015/entries/title.js +1 -1
  191. package/dist/es2015/entries/video-menu.js +1 -1
  192. package/dist/es2015/entries/volume-slider.js +1 -1
  193. package/dist/es2015/entries/volume.js +1 -1
  194. package/dist/es2015/host.js +9 -1
  195. package/dist/es2015/index.js +5 -3
  196. package/dist/es2015/locales/ar.js +2 -1
  197. package/dist/es2015/locales/ca.js +2 -1
  198. package/dist/es2015/locales/de.js +2 -1
  199. package/dist/es2015/locales/es.js +2 -1
  200. package/dist/es2015/locales/fr.js +2 -1
  201. package/dist/es2015/locales/hi.js +2 -1
  202. package/dist/es2015/locales/it.js +2 -1
  203. package/dist/es2015/locales/ja.js +2 -1
  204. package/dist/es2015/locales/ko.js +2 -1
  205. package/dist/es2015/locales/pt.js +2 -1
  206. package/dist/es2015/locales/zh.js +2 -1
  207. package/dist/es2015/locales.js +1 -1
  208. package/dist/es2015/media.js +136 -0
  209. package/dist/es2015/presets.js +1 -1
  210. package/dist/es2015/style.js +1 -1
  211. package/dist/es2015/tags.js +2 -1
  212. package/dist/es2015/video-sources.js +1 -1
  213. package/dist/host.d.ts +19 -1
  214. package/dist/host.d.ts.map +1 -1
  215. package/dist/host.js +9 -1
  216. package/dist/host.js.map +1 -1
  217. package/dist/index.d.ts +4 -0
  218. package/dist/index.d.ts.map +1 -1
  219. package/dist/index.js +5 -3
  220. package/dist/locales/ar.d.ts +1 -0
  221. package/dist/locales/ar.d.ts.map +1 -1
  222. package/dist/locales/ar.js +2 -1
  223. package/dist/locales/ar.js.map +1 -1
  224. package/dist/locales/ca.d.ts +1 -0
  225. package/dist/locales/ca.d.ts.map +1 -1
  226. package/dist/locales/ca.js +2 -1
  227. package/dist/locales/ca.js.map +1 -1
  228. package/dist/locales/de.d.ts +1 -0
  229. package/dist/locales/de.d.ts.map +1 -1
  230. package/dist/locales/de.js +2 -1
  231. package/dist/locales/de.js.map +1 -1
  232. package/dist/locales/es.d.ts +1 -0
  233. package/dist/locales/es.d.ts.map +1 -1
  234. package/dist/locales/es.js +2 -1
  235. package/dist/locales/es.js.map +1 -1
  236. package/dist/locales/fr.d.ts +1 -0
  237. package/dist/locales/fr.d.ts.map +1 -1
  238. package/dist/locales/fr.js +2 -1
  239. package/dist/locales/fr.js.map +1 -1
  240. package/dist/locales/hi.d.ts +1 -0
  241. package/dist/locales/hi.d.ts.map +1 -1
  242. package/dist/locales/hi.js +2 -1
  243. package/dist/locales/hi.js.map +1 -1
  244. package/dist/locales/it.d.ts +1 -0
  245. package/dist/locales/it.d.ts.map +1 -1
  246. package/dist/locales/it.js +2 -1
  247. package/dist/locales/it.js.map +1 -1
  248. package/dist/locales/ja.d.ts +1 -0
  249. package/dist/locales/ja.d.ts.map +1 -1
  250. package/dist/locales/ja.js +2 -1
  251. package/dist/locales/ja.js.map +1 -1
  252. package/dist/locales/ko.d.ts +1 -0
  253. package/dist/locales/ko.d.ts.map +1 -1
  254. package/dist/locales/ko.js +2 -1
  255. package/dist/locales/ko.js.map +1 -1
  256. package/dist/locales/pt.d.ts +1 -0
  257. package/dist/locales/pt.d.ts.map +1 -1
  258. package/dist/locales/pt.js +2 -1
  259. package/dist/locales/pt.js.map +1 -1
  260. package/dist/locales/zh.d.ts +1 -0
  261. package/dist/locales/zh.d.ts.map +1 -1
  262. package/dist/locales/zh.js +2 -1
  263. package/dist/locales/zh.js.map +1 -1
  264. package/dist/media.d.ts +22 -0
  265. package/dist/media.d.ts.map +1 -0
  266. package/dist/media.js +136 -0
  267. package/dist/media.js.map +1 -0
  268. package/dist/messages.d.ts +2 -0
  269. package/dist/messages.d.ts.map +1 -1
  270. package/dist/remote.d.ts +80 -0
  271. package/dist/remote.d.ts.map +1 -0
  272. package/dist/style.js +1 -1
  273. package/dist/style.js.map +1 -1
  274. package/dist/tags.d.ts +1 -0
  275. package/dist/tags.d.ts.map +1 -1
  276. package/dist/tags.js +2 -1
  277. package/dist/tags.js.map +1 -1
  278. package/package.json +2 -2
  279. package/dist/es2015/_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/toPrimitive.js +0 -13
@@ -49,7 +49,7 @@ function chapterAt(list, time) {
49
49
  * Every chapters track found is set hidden, so its cues load.
50
50
  */
51
51
  function followChapters(player, fn) {
52
- const video = player.video;
52
+ const video = player.media;
53
53
  const listen = (target, name, handler) => {
54
54
  target.addEventListener(name, handler);
55
55
  return () => {
@@ -1 +1 @@
1
- {"version":3,"file":"chapters.js","names":[],"sources":["../../src/controls/chapters.ts"],"sourcesContent":["/**\n * Chapters come from one of two places, read through these helpers so the\n * seek bar and the chapters menu agree without knowing each other.\n *\n * - The engine's `chapters` namespace, when the session has one and it\n * holds chapters: a file the player's `chapters` attribute loaded, the\n * manifest's own, or chapters the page set. See the engine guide's\n * chapters chapter.\n * - Otherwise the browser's own: a text track of kind `chapters` on the\n * video, from a `<track>` the page or the player's `chapters` attribute\n * put there, or from `addTextTrack`. A native session has chapters this\n * way.\n *\n * A track from a `<track>` element loads its cues only while its mode is\n * `hidden` or `showing`, so a disabled chapters track is set hidden here:\n * hidden draws nothing, and the cues arrive.\n */\nimport type { Mattebox } from 'mattebox';\nimport type { PlayerHost } from '../host.js';\nimport { optional } from './session.js';\n\nexport interface Chapter {\n readonly start: number;\n readonly end: number;\n readonly title: string;\n /** The URL of the chapter's picture. Only the engine's chapters carry one. */\n readonly image?: string;\n}\n\n/** The first chapters track on the video, or null. */\nexport function chapterTrack(video: HTMLVideoElement): TextTrack | null {\n for (const track of video.textTracks) if (track.kind === 'chapters') return track;\n return null;\n}\n\n/** The engine's chapters, already in order, or none. */\nfunction engineChapters(engine: Mattebox | null): Chapter[] {\n const api = optional(engine).chapters;\n if (api === undefined) return [];\n return api.all.map((chapter) => ({\n start: chapter.start,\n end: chapter.end,\n title: chapter.title,\n ...(chapter.image === undefined ? {} : { image: chapter.image.url }),\n }));\n}\n\n/** The cues of the video's chapters track, in order, or none. */\nfunction trackChapters(video: HTMLVideoElement): Chapter[] {\n const track = chapterTrack(video);\n if (track === null || track.cues === null) return [];\n const out: Chapter[] = [];\n for (const cue of track.cues) {\n const text = cue instanceof VTTCue ? cue.text : '';\n out.push({ start: cue.startTime, end: cue.endTime, title: text.trim() });\n }\n return out.sort((a, b) => a.start - b.start);\n}\n\n/** The chapters of the session: the engine's when it holds some, else the video's track. */\nexport function chapters(video: HTMLVideoElement, engine: Mattebox | null): Chapter[] {\n const own = engineChapters(engine);\n return own.length > 0 ? own : trackChapters(video);\n}\n\n/** The index of the chapter `time` falls in, the last one started, or -1 before the first. */\nexport function chapterAt(list: readonly Chapter[], time: number): number {\n let found = -1;\n for (const [i, chapter] of list.entries()) if (chapter.start <= time) found = i;\n return found;\n}\n\n/**\n * Runs `fn` whenever the chapters may have changed: the engine reported a\n * change, a session came in, a track was added or removed, the cues of a\n * `<track>` arrived, or the active cue moved on. Returns the unsubscribe.\n * Every chapters track found is set hidden, so its cues load.\n */\nexport function followChapters(player: PlayerHost, fn: () => void): () => void {\n const video = player.video;\n const listen = (target: EventTarget, name: string, handler: () => void): (() => void) => {\n target.addEventListener(name, handler);\n return () => {\n target.removeEventListener(name, handler);\n };\n };\n /** The listeners on the tracks of the moment, replaced when the list changes. */\n let inner: Array<() => void> = [];\n /** The listener on the engine of the moment, replaced when the session changes. */\n let own: () => void = () => undefined;\n const wire = (): void => {\n for (const off of inner) off();\n inner = [];\n for (const track of video.textTracks) {\n if (track.kind !== 'chapters') continue;\n if (track.mode === 'disabled') track.mode = 'hidden';\n inner.push(listen(track, 'cuechange', fn));\n }\n for (const node of video.querySelectorAll('track')) {\n if (node.kind === 'chapters') inner.push(listen(node, 'load', fn));\n }\n fn();\n };\n const session = (): void => {\n own();\n own = player.engine?.on('chapters:changed', fn) ?? (() => undefined);\n fn();\n };\n const outer = [\n listen(video.textTracks, 'addtrack', wire),\n listen(video.textTracks, 'removetrack', wire),\n listen(player, 'sourcechange', session),\n ];\n wire();\n session();\n return () => {\n for (const off of [...outer, ...inner]) off();\n own();\n inner = [];\n };\n}\n"],"mappings":";;;AA8BA,SAAgB,aAAa,OAA2C;CACtE,KAAK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;;CAEA,IAAI,QAA2B,CAAC;;CAEhC,IAAI,YAAwB,KAAA;CAC5B,MAAM,aAAmB;EACvB,KAAK,MAAM,OAAO,OAAO,IAAI;EAC7B,QAAQ,CAAC;EACT,KAAK,MAAM,SAAS,MAAM,YAAY;GACpC,IAAI,MAAM,SAAS,YAAY;GAC/B,IAAI,MAAM,SAAS,YAAY,MAAM,OAAO;GAC5C,MAAM,KAAK,OAAO,OAAO,aAAa,EAAE,CAAC;EAC3C;EACA,KAAK,MAAM,QAAQ,MAAM,iBAAiB,OAAO,GAC/C,IAAI,KAAK,SAAS,YAAY,MAAM,KAAK,OAAO,MAAM,QAAQ,EAAE,CAAC;EAEnE,GAAG;CACL;CACA,MAAM,gBAAsB;EAC1B,IAAI;EACJ,MAAM,OAAO,QAAQ,GAAG,oBAAoB,EAAE,YAAY,KAAA;EAC1D,GAAG;CACL;CACA,MAAM,QAAQ;EACZ,OAAO,MAAM,YAAY,YAAY,IAAI;EACzC,OAAO,MAAM,YAAY,eAAe,IAAI;EAC5C,OAAO,QAAQ,gBAAgB,OAAO;CACxC;CACA,KAAK;CACL,QAAQ;CACR,aAAa;EACX,KAAK,MAAM,OAAO,CAAC,GAAG,OAAO,GAAG,KAAK,GAAG,IAAI;EAC5C,IAAI;EACJ,QAAQ,CAAC;CACX;AACF"}
1
+ {"version":3,"file":"chapters.js","names":[],"sources":["../../src/controls/chapters.ts"],"sourcesContent":["/**\n * Chapters come from one of two places, read through these helpers so the\n * seek bar and the chapters menu agree without knowing each other.\n *\n * - The engine's `chapters` namespace, when the session has one and it\n * holds chapters: a file the player's `chapters` attribute loaded, the\n * manifest's own, or chapters the page set. See the engine guide's\n * chapters chapter.\n * - Otherwise the browser's own: a text track of kind `chapters` on the\n * video, from a `<track>` the page or the player's `chapters` attribute\n * put there, or from `addTextTrack`. A native session has chapters this\n * way.\n *\n * A track from a `<track>` element loads its cues only while its mode is\n * `hidden` or `showing`, so a disabled chapters track is set hidden here:\n * hidden draws nothing, and the cues arrive.\n */\nimport type { Mattebox } from 'mattebox';\nimport type { PlayerHost } from '../host.js';\nimport { optional } from './session.js';\n\nexport interface Chapter {\n readonly start: number;\n readonly end: number;\n readonly title: string;\n /** The URL of the chapter's picture. Only the engine's chapters carry one. */\n readonly image?: string;\n}\n\n/** The first chapters track on the video, or null. */\nexport function chapterTrack(video: HTMLVideoElement): TextTrack | null {\n for (const track of video.textTracks) if (track.kind === 'chapters') return track;\n return null;\n}\n\n/** The engine's chapters, already in order, or none. */\nfunction engineChapters(engine: Mattebox | null): Chapter[] {\n const api = optional(engine).chapters;\n if (api === undefined) return [];\n return api.all.map((chapter) => ({\n start: chapter.start,\n end: chapter.end,\n title: chapter.title,\n ...(chapter.image === undefined ? {} : { image: chapter.image.url }),\n }));\n}\n\n/** The cues of the video's chapters track, in order, or none. */\nfunction trackChapters(video: HTMLVideoElement): Chapter[] {\n const track = chapterTrack(video);\n if (track === null || track.cues === null) return [];\n const out: Chapter[] = [];\n for (const cue of track.cues) {\n const text = cue instanceof VTTCue ? cue.text : '';\n out.push({ start: cue.startTime, end: cue.endTime, title: text.trim() });\n }\n return out.sort((a, b) => a.start - b.start);\n}\n\n/** The chapters of the session: the engine's when it holds some, else the video's track. */\nexport function chapters(video: HTMLVideoElement, engine: Mattebox | null): Chapter[] {\n const own = engineChapters(engine);\n return own.length > 0 ? own : trackChapters(video);\n}\n\n/** The index of the chapter `time` falls in, the last one started, or -1 before the first. */\nexport function chapterAt(list: readonly Chapter[], time: number): number {\n let found = -1;\n for (const [i, chapter] of list.entries()) if (chapter.start <= time) found = i;\n return found;\n}\n\n/**\n * Runs `fn` whenever the chapters may have changed: the engine reported a\n * change, a session came in, a track was added or removed, the cues of a\n * `<track>` arrived, or the active cue moved on. Returns the unsubscribe.\n * Every chapters track found is set hidden, so its cues load.\n */\nexport function followChapters(player: PlayerHost, fn: () => void): () => void {\n const video = player.media;\n const listen = (target: EventTarget, name: string, handler: () => void): (() => void) => {\n target.addEventListener(name, handler);\n return () => {\n target.removeEventListener(name, handler);\n };\n };\n /** The listeners on the tracks of the moment, replaced when the list changes. */\n let inner: Array<() => void> = [];\n /** The listener on the engine of the moment, replaced when the session changes. */\n let own: () => void = () => undefined;\n const wire = (): void => {\n for (const off of inner) off();\n inner = [];\n for (const track of video.textTracks) {\n if (track.kind !== 'chapters') continue;\n if (track.mode === 'disabled') track.mode = 'hidden';\n inner.push(listen(track, 'cuechange', fn));\n }\n for (const node of video.querySelectorAll('track')) {\n if (node.kind === 'chapters') inner.push(listen(node, 'load', fn));\n }\n fn();\n };\n const session = (): void => {\n own();\n own = player.engine?.on('chapters:changed', fn) ?? (() => undefined);\n fn();\n };\n const outer = [\n listen(video.textTracks, 'addtrack', wire),\n listen(video.textTracks, 'removetrack', wire),\n listen(player, 'sourcechange', session),\n ];\n wire();\n session();\n return () => {\n for (const off of [...outer, ...inner]) off();\n own();\n inner = [];\n };\n}\n"],"mappings":";;;AA8BA,SAAgB,aAAa,OAA2C;CACtE,KAAK,MAAM,SAAS,MAAM,YAAY,IAAI,MAAM,SAAS,YAAY,OAAO;CAC5E,OAAO;AACT;;AAGA,SAAS,eAAe,QAAoC;CAC1D,MAAM,MAAM,SAAS,MAAM,CAAC,CAAC;CAC7B,IAAI,QAAQ,KAAA,GAAW,OAAO,CAAC;CAC/B,OAAO,IAAI,IAAI,KAAK,aAAa;EAC/B,OAAO,QAAQ;EACf,KAAK,QAAQ;EACb,OAAO,QAAQ;EACf,GAAI,QAAQ,UAAU,KAAA,IAAY,CAAC,IAAI,EAAE,OAAO,QAAQ,MAAM,IAAI;CACpE,EAAE;AACJ;;AAGA,SAAS,cAAc,OAAoC;CACzD,MAAM,QAAQ,aAAa,KAAK;CAChC,IAAI,UAAU,QAAQ,MAAM,SAAS,MAAM,OAAO,CAAC;CACnD,MAAM,MAAiB,CAAC;CACxB,KAAK,MAAM,OAAO,MAAM,MAAM;EAC5B,MAAM,OAAO,eAAe,SAAS,IAAI,OAAO;EAChD,IAAI,KAAK;GAAE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,eAAe,IAAI;EAC5C,OAAO,QAAQ,gBAAgB,OAAO;CACxC;CACA,KAAK;CACL,QAAQ;CACR,aAAa;EACX,KAAK,MAAM,OAAO,CAAC,GAAG,OAAO,GAAG,KAAK,GAAG,IAAI;EAC5C,IAAI;EACJ,QAAQ,CAAC;CACX;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"cues.js","names":[],"sources":["../../src/controls/cues.ts"],"sourcesContent":["/**\n * Subtitles and the bar. Two things.\n *\n * The lift: the browser draws native cues on the bottom edge of the video,\n * and under the bar. Every active cue the author left unpositioned is\n * moved up: above the bar while it shows, and one line off the edge while\n * it is hidden, so the text never sits on the picture's border. The\n * position is a negative line count, the one form every browser wraps at\n * the video's width; a percentage does not wrap in Chromium. Chromium\n * anchors the box's top on the count and Gecko its bottom, and their\n * overlap avoidance pushes in opposite directions, so nothing is left to\n * them: subtitles often show two cues at once, and the cues stack by their\n * own measured heights, wrapping included, clear under both readings. A\n * cue with a position of its own is the author's and is not touched.\n *\n * The look: `::cue` can only be styled from the document that holds the\n * video, which is the page and not the shadow root, and it takes no custom\n * properties. So a small sheet goes into the document, once, with one rule\n * per look the host's `subtitle-size` and `subtitle-background` attributes\n * can take. Sizes are percentages of the browser's own cue size, which\n * already follows the video's height, in the page and in fullscreen alike.\n * A page that wants more writes its own `mattebox-player > video::cue`.\n */\nimport CUE_RULES from './cues.css?inline';\n/** How the sizes scale the browser's own cue size; the lift counts lines by it. */\nexport const SCALES: Readonly<Record<string, number>> = {\n small: 0.75,\n medium: 1,\n large: 1.5,\n xlarge: 2,\n};\n\n/**\n * The sheet in the document. `mattebox-player` is the element's tag. The\n * background goes on `::cue` and on the backdrop pseudo-element Chromium\n * and WebKit have, both: which of the two paints it differs by browser and\n * version, and a selector a browser does not know only voids its own rule.\n */\n\nconst MARK = 'data-mattebox-cue';\n\n/** The browser's cue size against the video's height, per WebVTT, and its line against the size. */\nconst CUE_SIZE = 0.05;\nconst LINE_HEIGHT = 1.2;\n/** What a cue box spans of the video's width by default, so wrapping is measured against it. */\nconst CUE_WIDTH = 0.96;\n/** Pixels of air between the bar and the cue above it, before rounding up to a line. */\nconst AIR = 6;\n/** Lines of air under a cue while the bar is hidden. */\nconst REST = 1;\n\n/** Puts the cue rules in the document, once. */\nexport function cueStyle(): void {\n if (document.head.querySelector(`style[${MARK}]`) !== null) return;\n const style = document.createElement('style');\n style.setAttribute(MARK, '');\n style.textContent = CUE_RULES;\n document.head.append(style);\n}\n\n/** What a lifted cue looked like before, to put back. */\ninterface Placed {\n readonly line: number | 'auto';\n readonly snapToLines: boolean;\n readonly lineAlign: LineAlignSetting;\n}\n\nexport interface CueLift {\n /** Whether the bar is showing, so the cues move above it or back. */\n lifted(on: boolean): void;\n dispose(): void;\n}\n\n/** What the bar covers of the picture: from its first row's top, not its gradient run-in, to its bottom. */\nexport type Covered = () => { readonly top: number; readonly bottom: number };\n\nexport function cueLift(video: HTMLVideoElement, host: HTMLElement, covered: Covered): CueLift {\n /** The cues moved, with what they were, so they and only they are put back. */\n const lifted = new Map<VTTCue, Placed>();\n let on = false;\n /** False once disposed: the cues go back to where the author left them. */\n let live = true;\n let canvas: CanvasRenderingContext2D | null | undefined;\n\n function showing(): TextTrack[] {\n const out: TextTrack[] = [];\n for (const track of video.textTracks) if (track.mode === 'showing') out.push(track);\n return out;\n }\n\n /** The browser's cue font size, in pixels, from the video's height and the host's scale. */\n function fontSize(height: number): number {\n const scale = SCALES[host.getAttribute('subtitle-size') ?? ''] ?? 1;\n return height * CUE_SIZE * scale;\n }\n\n /** Measures text the way the browser draws cues, to count the lines a cue wraps into. */\n function measure(): CanvasRenderingContext2D | null {\n if (canvas === undefined) canvas = document.createElement('canvas').getContext('2d');\n return canvas;\n }\n\n /**\n * A cue's text without its tags, for measuring: `<b>`, `<c.name>`, the\n * timestamps and their closers. Brackets are counted, so a tag inside\n * another's brackets goes with it.\n */\n function plain(text: string): string {\n let out = '';\n let depth = 0;\n for (const char of text) {\n if (char === '<') depth += 1;\n else if (char === '>') depth = Math.max(0, depth - 1);\n else if (depth === 0) out += char;\n }\n return out;\n }\n\n /** The lines a cue takes: its own, each wrapped at the cue box's width. */\n function lines(cue: VTTCue, font: number, width: number): number {\n const context = measure();\n let total = 0;\n for (const line of plain(cue.text).split('\\n')) {\n if (context === null) {\n total += 1;\n continue;\n }\n context.font = `${font}px sans-serif`;\n total += Math.max(1, Math.ceil(context.measureText(line).width / (width * CUE_WIDTH)));\n }\n return total;\n }\n\n function apply(): void {\n const box = video.getBoundingClientRect();\n const height = box.height;\n const span = covered();\n const pixels = span.bottom - span.top;\n const lift = live && height > 0;\n const font = fontSize(height);\n const unit = font * LINE_HEIGHT;\n // The lines the bar covers, with a little air, rounded up to whole\n // lines. With the bar hidden, the cue rests a line off the edge.\n const barred = on && pixels > 0 && pixels < height;\n const base = barred ? Math.ceil((pixels + AIR) / unit) : REST;\n for (const track of showing()) {\n // Earliest first, the order the browser stacks them in, so the first\n // sits lowest and the rest climb.\n const active = [...(track.activeCues ?? [])]\n .filter((cue): cue is VTTCue => cue instanceof VTTCue)\n .sort((a, b) => a.startTime - b.startTime);\n let previous: { line: number; height: number } | null = null;\n let changed = false;\n for (const cue of active) {\n const was = lifted.get(cue);\n if (!lift) {\n if (was === undefined) continue;\n cue.line = was.line;\n cue.snapToLines = was.snapToLines;\n cue.lineAlign = was.lineAlign;\n lifted.delete(cue);\n changed = true;\n continue;\n }\n // The author's own placement is the author's.\n if (was === undefined && cue.line !== 'auto') continue;\n if (was === undefined) {\n lifted.set(cue, {\n line: cue.line,\n snapToLines: cue.snapToLines,\n lineAlign: cue.lineAlign,\n });\n }\n // A negative line count, which every browser wraps at the video's\n // width, unlike a percentage. Chromium anchors the box's top on it\n // and Gecko its bottom, so the count clears the bar and the cue\n // below under both readings, with a little air to spare in one.\n const own = lines(cue, font, box.width);\n const line: number =\n previous === null ? base + own : previous.line + Math.max(own, previous.height);\n if (cue.line !== -line || !cue.snapToLines) changed = true;\n cue.snapToLines = true;\n cue.line = -line;\n previous = { line, height: own };\n }\n // Chromium lays a changed line out again only when the track's display\n // is rebuilt, which neither time nor a seek does for a cue already\n // showing; the mode flipped off and on in one task rebuilds it with no\n // paint in between. Only on a change, so the change event this fires\n // finds nothing to do and the loop ends there.\n if (changed) {\n track.mode = 'hidden';\n track.mode = 'showing';\n }\n }\n }\n\n function watch(): void {\n for (const track of video.textTracks) {\n track.removeEventListener('cuechange', apply);\n track.addEventListener('cuechange', apply);\n }\n apply();\n }\n\n video.textTracks.addEventListener('change', watch);\n video.textTracks.addEventListener('addtrack', watch);\n watch();\n\n return {\n lifted(next: boolean): void {\n on = next;\n apply();\n },\n dispose(): void {\n on = false;\n live = false;\n apply();\n video.textTracks.removeEventListener('change', watch);\n video.textTracks.removeEventListener('addtrack', watch);\n for (const track of video.textTracks) track.removeEventListener('cuechange', apply);\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAA,YAAA;;AAEA,MAAA,SAAA;CACA,OAAA;CACA,QAAA;CACA,OAAA;CACA,QAAA;AACA;;;;;;;AASA,MAAA,OAAA;;AAGA,MAAA,WAAA;AACA,MAAA,cAAA;;AAEA,MAAA,YAAA;;AAEA,MAAA,MAAA;;AAEA,MAAA,OAAA;;AAGA,SAAA,WAAA;CACA,IAAA,SAAA,KAAA,cAAA,SAAA,KAAA,EAAA,MAAA,MAAA;CACA,MAAA,QAAA,SAAA,cAAA,OAAA;CACA,MAAA,aAAA,MAAA,EAAA;CACA,MAAA,cAAA;CACA,SAAA,KAAA,OAAA,KAAA;AACA;AAkBA,SAAA,QAAA,OAAA,MAAA,SAAA;;CAEA,MAAA,yBAAA,IAAA,IAAA;CACA,IAAA,KAAA;;CAEA,IAAA,OAAA;CACA,IAAA;CAEA,SAAA,UAAA;EACA,MAAA,MAAA,CAAA;EACA,KAAA,MAAA,SAAA,MAAA,YAAA,IAAA,MAAA,SAAA,WAAA,IAAA,KAAA,KAAA;EACA,OAAA;CACA;;CAGA,SAAA,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.js","names":[],"sources":["../../src/controls/cues.ts"],"sourcesContent":["/**\n * Subtitles and the bar. Two things.\n *\n * The lift: the browser draws native cues on the bottom edge of the video,\n * and under the bar. Every active cue the author left unpositioned is\n * moved up: above the bar while it shows, and one line off the edge while\n * it is hidden, so the text never sits on the picture's border. The\n * position is a negative line count, the one form every browser wraps at\n * the video's width; a percentage does not wrap in Chromium. Chromium\n * anchors the box's top on the count and Gecko its bottom, and their\n * overlap avoidance pushes in opposite directions, so nothing is left to\n * them: subtitles often show two cues at once, and the cues stack by their\n * own measured heights, wrapping included, clear under both readings. A\n * cue with a position of its own is the author's and is not touched.\n *\n * The look: `::cue` can only be styled from the document that holds the\n * video, which is the page and not the shadow root, and it takes no custom\n * properties. So a small sheet goes into the document, once, with one rule\n * per look the host's `subtitle-size` and `subtitle-background` attributes\n * can take. Sizes are percentages of the browser's own cue size, which\n * already follows the video's height, in the page and in fullscreen alike.\n * A page that wants more writes its own `mattebox-player > video::cue`.\n */\nimport CUE_RULES from './cues.css?inline';\n/** How the sizes scale the browser's own cue size; the lift counts lines by it. */\nexport const SCALES: Readonly<Record<string, number>> = {\n small: 0.75,\n medium: 1,\n large: 1.5,\n xlarge: 2,\n};\n\n/**\n * The sheet in the document. `mattebox-player` is the element's tag. The\n * background goes on `::cue` and on the backdrop pseudo-element Chromium\n * and WebKit have, both: which of the two paints it differs by browser and\n * version, and a selector a browser does not know only voids its own rule.\n */\n\nconst MARK = 'data-mattebox-cue';\n\n/** The browser's cue size against the video's height, per WebVTT, and its line against the size. */\nconst CUE_SIZE = 0.05;\nconst LINE_HEIGHT = 1.2;\n/** What a cue box spans of the video's width by default, so wrapping is measured against it. */\nconst CUE_WIDTH = 0.96;\n/** Pixels of air between the bar and the cue above it, before rounding up to a line. */\nconst AIR = 6;\n/** Lines of air under a cue while the bar is hidden. */\nconst REST = 1;\n\n/** Puts the cue rules in the document, once. */\nexport function cueStyle(): void {\n if (document.head.querySelector(`style[${MARK}]`) !== null) return;\n const style = document.createElement('style');\n style.setAttribute(MARK, '');\n style.textContent = CUE_RULES;\n document.head.append(style);\n}\n\n/** What a lifted cue looked like before, to put back. */\ninterface Placed {\n readonly line: number | 'auto';\n readonly snapToLines: boolean;\n readonly lineAlign: LineAlignSetting;\n}\n\nexport interface CueLift {\n /** Whether the bar is showing, so the cues move above it or back. */\n lifted(on: boolean): void;\n dispose(): void;\n}\n\n/** What the bar covers of the picture: from its first row's top, not its gradient run-in, to its bottom. */\nexport type Covered = () => { readonly top: number; readonly bottom: number };\n\nexport function cueLift(video: HTMLVideoElement, host: HTMLElement, covered: Covered): CueLift {\n /** The cues moved, with what they were, so they and only they are put back. */\n const lifted = new Map<VTTCue, Placed>();\n let on = false;\n /** False once disposed: the cues go back to where the author left them. */\n let live = true;\n let canvas: CanvasRenderingContext2D | null | undefined;\n\n function showing(): TextTrack[] {\n const out: TextTrack[] = [];\n for (const track of video.textTracks) if (track.mode === 'showing') out.push(track);\n return out;\n }\n\n /** The browser's cue font size, in pixels, from the video's height and the host's scale. */\n function fontSize(height: number): number {\n const scale = SCALES[host.getAttribute('subtitle-size') ?? ''] ?? 1;\n return height * CUE_SIZE * scale;\n }\n\n /** Measures text the way the browser draws cues, to count the lines a cue wraps into. */\n function measure(): CanvasRenderingContext2D | null {\n if (canvas === undefined) canvas = document.createElement('canvas').getContext('2d');\n return canvas;\n }\n\n /**\n * A cue's text without its tags, for measuring: `<b>`, `<c.name>`, the\n * timestamps and their closers. Brackets are counted, so a tag inside\n * another's brackets goes with it.\n */\n function plain(text: string): string {\n let out = '';\n let depth = 0;\n for (const char of text) {\n if (char === '<') depth += 1;\n else if (char === '>') depth = Math.max(0, depth - 1);\n else if (depth === 0) out += char;\n }\n return out;\n }\n\n /** The lines a cue takes: its own, each wrapped at the cue box's width. */\n function lines(cue: VTTCue, font: number, width: number): number {\n const context = measure();\n let total = 0;\n for (const line of plain(cue.text).split('\\n')) {\n if (context === null) {\n total += 1;\n continue;\n }\n context.font = `${font}px sans-serif`;\n total += Math.max(1, Math.ceil(context.measureText(line).width / (width * CUE_WIDTH)));\n }\n return total;\n }\n\n function apply(): void {\n const box = video.getBoundingClientRect();\n const height = box.height;\n const span = covered();\n const pixels = span.bottom - span.top;\n const lift = live && height > 0;\n const font = fontSize(height);\n const unit = font * LINE_HEIGHT;\n // The lines the bar covers, with a little air, rounded up to whole\n // lines. With the bar hidden, the cue rests a line off the edge.\n const barred = on && pixels > 0 && pixels < height;\n const base = barred ? Math.ceil((pixels + AIR) / unit) : REST;\n for (const track of showing()) {\n // Earliest first, the order the browser stacks them in, so the first\n // sits lowest and the rest climb.\n const active = [...(track.activeCues ?? [])]\n .filter((cue): cue is VTTCue => cue instanceof VTTCue)\n .sort((a, b) => a.startTime - b.startTime);\n let previous: { line: number; height: number } | null = null;\n let changed = false;\n for (const cue of active) {\n const was = lifted.get(cue);\n if (!lift) {\n if (was === undefined) continue;\n cue.line = was.line;\n cue.snapToLines = was.snapToLines;\n cue.lineAlign = was.lineAlign;\n lifted.delete(cue);\n changed = true;\n continue;\n }\n // The author's own placement is the author's.\n if (was === undefined && cue.line !== 'auto') continue;\n if (was === undefined) {\n lifted.set(cue, {\n line: cue.line,\n snapToLines: cue.snapToLines,\n lineAlign: cue.lineAlign,\n });\n }\n // A negative line count, which every browser wraps at the video's\n // width, unlike a percentage. Chromium anchors the box's top on it\n // and Gecko its bottom, so the count clears the bar and the cue\n // below under both readings, with a little air to spare in one.\n const own = lines(cue, font, box.width);\n const line: number =\n previous === null ? base + own : previous.line + Math.max(own, previous.height);\n if (cue.line !== -line || !cue.snapToLines) changed = true;\n cue.snapToLines = true;\n cue.line = -line;\n previous = { line, height: own };\n }\n // Chromium lays a changed line out again only when the track's display\n // is rebuilt, which neither time nor a seek does for a cue already\n // showing; the mode flipped off and on in one task rebuilds it with no\n // paint in between. Only on a change, so the change event this fires\n // finds nothing to do and the loop ends there.\n if (changed) {\n track.mode = 'hidden';\n track.mode = 'showing';\n }\n }\n }\n\n function watch(): void {\n for (const track of video.textTracks) {\n track.removeEventListener('cuechange', apply);\n track.addEventListener('cuechange', apply);\n }\n apply();\n }\n\n video.textTracks.addEventListener('change', watch);\n video.textTracks.addEventListener('addtrack', watch);\n watch();\n\n return {\n lifted(next: boolean): void {\n on = next;\n apply();\n },\n dispose(): void {\n on = false;\n live = false;\n apply();\n video.textTracks.removeEventListener('change', watch);\n video.textTracks.removeEventListener('addtrack', watch);\n for (const track of video.textTracks) track.removeEventListener('cuechange', apply);\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAA,YAAA;;AAEA,MAAa,SAA2C;CACtD,OAAO;CACP,QAAQ;CACR,OAAO;CACP,QAAQ;AACV;;;;;;;AASA,MAAM,OAAO;;AAGb,MAAM,WAAW;AACjB,MAAM,cAAc;;AAEpB,MAAM,YAAY;;AAElB,MAAM,MAAM;;AAEZ,MAAM,OAAO;;AAGb,SAAgB,WAAiB;CAC/B,IAAI,SAAS,KAAK,cAAc,SAAS,KAAK,EAAE,MAAM,MAAM;CAC5D,MAAM,QAAQ,SAAS,cAAc,OAAO;CAC5C,MAAM,aAAa,MAAM,EAAE;CAC3B,MAAM,cAAc;CACpB,SAAS,KAAK,OAAO,KAAK;AAC5B;AAkBA,SAAgB,QAAQ,OAAyB,MAAmB,SAA2B;;CAE7F,MAAM,yBAAS,IAAI,IAAoB;CACvC,IAAI,KAAK;;CAET,IAAI,OAAO;CACX,IAAI;CAEJ,SAAS,UAAuB;EAC9B,MAAM,MAAmB,CAAC;EAC1B,KAAK,MAAM,SAAS,MAAM,YAAY,IAAI,MAAM,SAAS,WAAW,IAAI,KAAK,KAAK;EAClF,OAAO;CACT;;CAGA,SAAS,SAAS,QAAwB;EACxC,MAAM,QAAQ,OAAO,KAAK,aAAa,eAAe,KAAK,OAAO;EAClE,OAAO,SAAS,WAAW;CAC7B;;CAGA,SAAS,UAA2C;EAClD,IAAI,WAAW,KAAA,GAAW,SAAS,SAAS,cAAc,QAAQ,CAAC,CAAC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AAC,MAAM;KACT,IAAI,QAAQ,KAAA,GAAW;KACvB,IAAI,OAAO,IAAI;KACf,IAAI,cAAc,IAAI;KACtB,IAAI,YAAY,IAAI;KACpB,OAAO,OAAO,GAAG;KACjB,UAAU;KACV;IACF;IAEA,IAAI,QAAQ,KAAA,KAAa,IAAI,SAAS,QAAQ;IAC9C,IAAI,QAAQ,KAAA,GACV,OAAO,IAAI,KAAK;KACd,MAAM,IAAI;KACV,aAAa,IAAI;KACjB,WAAW,IAAI;IACjB,CAAC;IAMH,MAAM,MAAM,MAAM,KAAK,MAAM,IAAI,KAAK;IACtC,MAAM,OACJ,aAAa,OAAO,OAAO,MAAM,SAAS,OAAO,KAAK,IAAI,KAAK,SAAS,MAAM;IAChF,IAAI,IAAI,SAAS,CAAC,QAAQ,CAAC,IAAI,aAAa,UAAU;IACtD,IAAI,cAAc;IAClB,IAAI,OAAO,CAAC;IACZ,WAAW;KAAE;KAAM,QAAQ;IAAI;GACjC;GAMA,IAAI,SAAS;IACX,MAAM,OAAO;IACb,MAAM,OAAO;GACf;EACF;CACF;CAEA,SAAS,QAAc;EACrB,KAAK,MAAM,SAAS,MAAM,YAAY;GACpC,MAAM,oBAAoB,aAAa,KAAK;GAC5C,MAAM,iBAAiB,aAAa,KAAK;EAC3C;EACA,MAAM;CACR;CAEA,MAAM,WAAW,iBAAiB,UAAU,KAAK;CACjD,MAAM,WAAW,iBAAiB,YAAY,KAAK;CACnD,MAAM;CAEN,OAAO;EACL,OAAO,MAAqB;GAC1B,KAAK;GACL,MAAM;EACR;EACA,UAAgB;GACd,KAAK;GACL,OAAO;GACP,MAAM;GACN,MAAM,WAAW,oBAAoB,UAAU,KAAK;GACpD,MAAM,WAAW,oBAAoB,YAAY,KAAK;GACtD,KAAK,MAAM,SAAS,MAAM,YAAY,MAAM,oBAAoB,aAAa,KAAK;EACpF;CACF;AACF"}
@@ -7,7 +7,7 @@
7
7
  function nativeTracks(player, name) {
8
8
  const session = player.player?.session;
9
9
  if (session == null || session.engine !== null) return void 0;
10
- const list = player.video[name];
10
+ const list = player.media[name];
11
11
  return list === void 0 ? void 0 : Array.from(list);
12
12
  }
13
13
  /** Calls `tick` when the video's list of `name` changes, and answers the unsubscribe. */
@@ -1 +1 @@
1
- {"version":3,"file":"native-tracks.js","names":[],"sources":["../../src/controls/native-tracks.ts"],"sourcesContent":["/**\n * The element's own track lists, for the audio, subtitles and video menus\n * of a native session. Safari lists the renditions of an HLS stream it\n * plays itself in `audioTracks`, `textTracks` and `videoTracks`. No\n * engine-shaped object goes over them: the menus read the lists and write\n * `enabled`, `mode` and `selected`.\n * Each list is feature-tested, so a browser without it keeps the menu hidden.\n */\nimport type { PlayerHost } from '../host.js';\n\n/** What the menus read of an `AudioTrack`, a `TextTrack` or a `VideoTrack`. */\nexport interface NativeTrack {\n readonly kind: string;\n readonly label: string;\n readonly language: string;\n}\n\n/** An `AudioTrackList` or a `TextTrackList`. lib.dom has no `AudioTrackList`. */\nexport interface NativeTrackList<T extends NativeTrack> extends EventTarget {\n readonly length: number;\n readonly [index: number]: T;\n}\n\n/**\n * The video's `audioTracks` or `textTracks` during a native session, or\n * undefined: an engine session has its own tracks, and Chromium has no\n * `audioTracks` without a flag.\n */\nexport function nativeTracks<T extends NativeTrack>(\n player: PlayerHost,\n name: 'audioTracks' | 'textTracks' | 'videoTracks',\n): T[] | undefined {\n const session = player.player?.session;\n if (session == null || session.engine !== null) return undefined;\n const list = (player.video as unknown as Record<string, NativeTrackList<T> | undefined>)[name];\n return list === undefined ? undefined : Array.from(list);\n}\n\n/** Calls `tick` when the video's list of `name` changes, and answers the unsubscribe. */\nexport function onNativeTracks(\n video: HTMLVideoElement,\n name: 'audioTracks' | 'textTracks' | 'videoTracks',\n tick: () => void,\n): (() => void) | undefined {\n const list = (video as unknown as Record<string, EventTarget | undefined>)[name];\n if (list === undefined) return undefined;\n const events = ['change', 'addtrack', 'removetrack'];\n for (const event of events) list.addEventListener(event, tick);\n return () => {\n for (const event of events) list.removeEventListener(event, tick);\n };\n}\n"],"mappings":";;;;;;AA4BA,SAAgB,aACd,QACA,MACiB;CACjB,MAAM,UAAU,OAAO,QAAQ;CAC/B,IAAI,WAAW,QAAQ,QAAQ,WAAW,MAAM,OAAO,KAAA;CACvD,MAAM,OAAQ,OAAO,MAAoE;CACzF,OAAO,SAAS,KAAA,IAAY,KAAA,IAAY,MAAM,KAAK,IAAI;AACzD;;AAGA,SAAgB,eACd,OACA,MACA,MAC0B;CAC1B,MAAM,OAAQ,MAA6D;CAC3E,IAAI,SAAS,KAAA,GAAW,OAAO,KAAA;CAC/B,MAAM,SAAS;EAAC;EAAU;EAAY;CAAa;CACnD,KAAK,MAAM,SAAS,QAAQ,KAAK,iBAAiB,OAAO,IAAI;CAC7D,aAAa;EACX,KAAK,MAAM,SAAS,QAAQ,KAAK,oBAAoB,OAAO,IAAI;CAClE;AACF"}
1
+ {"version":3,"file":"native-tracks.js","names":[],"sources":["../../src/controls/native-tracks.ts"],"sourcesContent":["/**\n * The element's own track lists, for the audio, subtitles and video menus\n * of a native session. Safari lists the renditions of an HLS stream it\n * plays itself in `audioTracks`, `textTracks` and `videoTracks`. No\n * engine-shaped object goes over them: the menus read the lists and write\n * `enabled`, `mode` and `selected`.\n * Each list is feature-tested, so a browser without it keeps the menu hidden.\n */\nimport type { PlayerHost } from '../host.js';\n\n/** What the menus read of an `AudioTrack`, a `TextTrack` or a `VideoTrack`. */\nexport interface NativeTrack {\n readonly kind: string;\n readonly label: string;\n readonly language: string;\n}\n\n/** An `AudioTrackList` or a `TextTrackList`. lib.dom has no `AudioTrackList`. */\nexport interface NativeTrackList<T extends NativeTrack> extends EventTarget {\n readonly length: number;\n readonly [index: number]: T;\n}\n\n/**\n * The video's `audioTracks` or `textTracks` during a native session, or\n * undefined: an engine session has its own tracks, and Chromium has no\n * `audioTracks` without a flag.\n */\nexport function nativeTracks<T extends NativeTrack>(\n player: PlayerHost,\n name: 'audioTracks' | 'textTracks' | 'videoTracks',\n): T[] | undefined {\n const session = player.player?.session;\n if (session == null || session.engine !== null) return undefined;\n const list = (player.media as unknown as Record<string, NativeTrackList<T> | undefined>)[name];\n return list === undefined ? undefined : Array.from(list);\n}\n\n/** Calls `tick` when the video's list of `name` changes, and answers the unsubscribe. */\nexport function onNativeTracks(\n video: HTMLVideoElement,\n name: 'audioTracks' | 'textTracks' | 'videoTracks',\n tick: () => void,\n): (() => void) | undefined {\n const list = (video as unknown as Record<string, EventTarget | undefined>)[name];\n if (list === undefined) return undefined;\n const events = ['change', 'addtrack', 'removetrack'];\n for (const event of events) list.addEventListener(event, tick);\n return () => {\n for (const event of events) list.removeEventListener(event, tick);\n };\n}\n"],"mappings":";;;;;;AA4BA,SAAgB,aACd,QACA,MACiB;CACjB,MAAM,UAAU,OAAO,QAAQ;CAC/B,IAAI,WAAW,QAAQ,QAAQ,WAAW,MAAM,OAAO,KAAA;CACvD,MAAM,OAAQ,OAAO,MAAoE;CACzF,OAAO,SAAS,KAAA,IAAY,KAAA,IAAY,MAAM,KAAK,IAAI;AACzD;;AAGA,SAAgB,eACd,OACA,MACA,MAC0B;CAC1B,MAAM,OAAQ,MAA6D;CAC3E,IAAI,SAAS,KAAA,GAAW,OAAO,KAAA;CAC/B,MAAM,SAAS;EAAC;EAAU;EAAY;CAAa;CACnD,KAAK,MAAM,SAAS,QAAQ,KAAK,iBAAiB,OAAO,IAAI;CAC7D,aAAa;EACX,KAAK,MAAM,SAAS,QAAQ,KAAK,oBAAoB,OAAO,IAAI;CAClE;AACF"}
@@ -2,6 +2,7 @@ export type { Connector, ConnectorSource, Programme, ProgrammeMetadata, Programm
2
2
  export type { MatteboxPlayerOptions } from './element.js';
3
3
  export { MatteboxPlayerElement } from './element.js';
4
4
  export type { Block, PlayerAddon, PlayerHost } from './host.js';
5
+ export type { CastOptions, CastTarget, Ranges, Remote, RemoteLoad, RemoteMedia, TextFile, } from './remote.js';
5
6
  export type { Text } from './text.js';
6
7
  export type { Tracker, Trackers } from './trackers.js';
7
8
  //# sourceMappingURL=element-entry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"element-entry.d.ts","sourceRoot":"","sources":["../src/element-entry.ts"],"names":[],"mappings":"AAOA,YAAY,EACV,SAAS,EACT,eAAe,EACf,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,UAAU,EACV,MAAM,EACN,SAAS,GACV,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,YAAY,EAAE,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAChE,YAAY,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"element-entry.d.ts","sourceRoot":"","sources":["../src/element-entry.ts"],"names":[],"mappings":"AAOA,YAAY,EACV,SAAS,EACT,eAAe,EACf,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,UAAU,EACV,MAAM,EACN,SAAS,GACV,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,YAAY,EAAE,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAChE,YAAY,EACV,WAAW,EACX,UAAU,EACV,MAAM,EACN,MAAM,EACN,UAAU,EACV,WAAW,EACX,QAAQ,GACT,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"element-entry.js","names":[],"sources":["../src/element-entry.ts"],"sourcesContent":["/**\n * `@mattebox/player/element`: registers <mattebox-player> and nothing else.\n * A page that takes this entry writes its own composition from the\n * `@mattebox/player/elements/*` entries it imports, and carries only those.\n */\nimport { MatteboxPlayerElement } from './element.js';\n\nexport type {\n Connector,\n ConnectorSource,\n Programme,\n ProgrammeMetadata,\n ProgrammeSource,\n Resolution,\n Source,\n SourceDrm,\n} from '@mattebox/player-core';\nexport type { MatteboxPlayerOptions } from './element.js';\nexport { MatteboxPlayerElement } from './element.js';\nexport type { Block, PlayerAddon, PlayerHost } from './host.js';\nexport type { Text } from './text.js';\nexport type { Tracker, Trackers } from './trackers.js';\n\nMatteboxPlayerElement.define();\n"],"mappings":";;;;;;;AAuBA,sBAAsB,OAAO"}
1
+ {"version":3,"file":"element-entry.js","names":[],"sources":["../src/element-entry.ts"],"sourcesContent":["/**\n * `@mattebox/player/element`: registers <mattebox-player> and nothing else.\n * A page that takes this entry writes its own composition from the\n * `@mattebox/player/elements/*` entries it imports, and carries only those.\n */\nimport { MatteboxPlayerElement } from './element.js';\n\nexport type {\n Connector,\n ConnectorSource,\n Programme,\n ProgrammeMetadata,\n ProgrammeSource,\n Resolution,\n Source,\n SourceDrm,\n} from '@mattebox/player-core';\nexport type { MatteboxPlayerOptions } from './element.js';\nexport { MatteboxPlayerElement } from './element.js';\nexport type { Block, PlayerAddon, PlayerHost } from './host.js';\nexport type {\n CastOptions,\n CastTarget,\n Ranges,\n Remote,\n RemoteLoad,\n RemoteMedia,\n TextFile,\n} from './remote.js';\nexport type { Text } from './text.js';\nexport type { Tracker, Trackers } from './trackers.js';\n\nMatteboxPlayerElement.define();\n"],"mappings":";;;;;;;AAgCA,sBAAsB,OAAO"}
package/dist/element.d.ts CHANGED
@@ -25,6 +25,7 @@ import type { Marker, Markers } from './controls/markers.js';
25
25
  import type { Block, PlayerAddon, PlayerHost } from './host.js';
26
26
  import type { LocaleSource } from './locales.js';
27
27
  import type { Messages } from './messages.js';
28
+ import type { CastOptions, CastTarget, Remote } from './remote.js';
28
29
  import type { Tracker, Trackers } from './trackers.js';
29
30
  /**
30
31
  * What the element dispatches. `error` is also a standard DOM event name, so
@@ -33,6 +34,8 @@ import type { Tracker, Trackers } from './trackers.js';
33
34
  */
34
35
  export interface MatteboxPlayerEventMap {
35
36
  sourcechange: CustomEvent<Session | null>;
37
+ /** A device plays in the video's place, or stopped: the target, or null. */
38
+ castingchange: CustomEvent<CastTarget | null>;
36
39
  /** The size tier changed: `compact`, `regular` or `wide`. */
37
40
  layoutchange: CustomEvent<string>;
38
41
  error: CustomEvent<PlayerError>;
@@ -110,7 +113,9 @@ export declare class MatteboxPlayerElement extends HTMLElement implements Player
110
113
  * is defined waits for the definition.
111
114
  */
112
115
  static define(options?: MatteboxPlayerOptions): void;
113
- private readonly media;
116
+ private readonly node;
117
+ /** `player.media`: the video, or the device that plays in its place. */
118
+ private readonly playback;
114
119
  /** Wraps the slot: the picture, and the controls over it or under it. */
115
120
  private readonly stage;
116
121
  /** Whether the element gave itself a tabindex for the bar, to take back with it. */
@@ -164,6 +169,18 @@ export declare class MatteboxPlayerElement extends HTMLElement implements Player
164
169
  private offs;
165
170
  /** Where `interrupt` left the programme: its time, whether it played, its tracks. */
166
171
  private interruption;
172
+ /** The device a cast package handed over with `cast()`, or null. */
173
+ private device;
174
+ /** The device plays in the video's place: the playback members are its own, and the video stays paused. */
175
+ private away;
176
+ /** Ends the cast that runs. */
177
+ private uncast;
178
+ /** The device that plays, for the `casting` attribute: the remote's target, or AirPlay's. */
179
+ private target;
180
+ /** The position and play state the next session takes to the device, set by a switch. */
181
+ private handoff;
182
+ /** The session was live when the engine was suspended. A suspended engine no longer says. */
183
+ private frozenLive;
167
184
  /** The add-ons attached to this player, with what each returned, run when it leaves the page. */
168
185
  private attached;
169
186
  /** Everything the element does to the player runs here, so it runs in order. */
@@ -181,8 +198,13 @@ export declare class MatteboxPlayerElement extends HTMLElement implements Player
181
198
  /** Ends the hold of a switch: the poster and `switching` go back. Null without one. */
182
199
  private held;
183
200
  constructor(options?: MatteboxPlayerOptions);
184
- /** The media element. Everything the browser already does is here. */
185
- get video(): HTMLVideoElement;
201
+ /**
202
+ * What plays: the video, with everything the browser already does. While
203
+ * a device plays in its place, the playback members are the device's.
204
+ * A proxy and not the node: a page that needs the node reads the
205
+ * `<video>` child of the player.
206
+ */
207
+ get media(): HTMLVideoElement;
186
208
  /** The ranges the page named in this source: credits to skip, parts that must not play. */
187
209
  get markers(): Markers;
188
210
  /** Where the programme's ad breaks are, which the seek bar draws: each add-on gives its own. */
@@ -267,6 +289,30 @@ export declare class MatteboxPlayerElement extends HTMLElement implements Player
267
289
  * before, so the controls show that state through the load.
268
290
  */
269
291
  private swap;
292
+ /** The device that plays in the video's place, its kind and its name, or null. The `casting` attribute carries the kind. */
293
+ get casting(): CastTarget | null;
294
+ /**
295
+ * Hands playback to a device, for a cast package. From here `media`
296
+ * reads the device for the members `remote.media` has, the video stays
297
+ * paused, and every load goes to the device. Returns the function that
298
+ * ends the cast: the video takes the device's position and play state
299
+ * back, with no new load. A second call ends the cast before it.
300
+ */
301
+ cast(remote: Remote, options?: CastOptions): () => void;
302
+ /**
303
+ * Where the video is, for a device: seconds on demand, and for live null
304
+ * at the edge or the clock time behind it. Read before the engine is
305
+ * suspended, which no longer says where the edge is.
306
+ */
307
+ private position;
308
+ /** Pauses the video and stops the engine's requests. The source stays loaded, for the chapters and the thumbnails. */
309
+ private freeze;
310
+ /** The device plays `source` in the video's place: the programme's own, or one that interrupts it. */
311
+ private hand;
312
+ /** The subtitle and caption files the page gave the video as `<track>` children. */
313
+ private textFiles;
314
+ /** Sets the device that plays: the `casting` attribute carries its kind, and `castingchange` the target. */
315
+ private aim;
270
316
  /** The core, or null until the first source has been set up: resolving a preset is asynchronous. */
271
317
  get player(): Player | null;
272
318
  /** The engine feeding the video, or null for a native session and before the first load. */
@@ -1 +1 @@
1
- {"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../src/element.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EACV,SAAS,EACT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