@videojs/html 10.2.0 → 10.4.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 (374) hide show
  1. package/dist/default/define/audio/compat-skin.css +161 -41
  2. package/dist/default/define/audio/compat-skin2.js +1 -1
  3. package/dist/default/define/audio/neutral-skin.css +73 -34
  4. package/dist/default/define/audio/neutral-skin2.js +1 -1
  5. package/dist/default/define/audio/scaffold-skin.css +166 -42
  6. package/dist/default/define/audio/scaffold-skin2.js +1 -1
  7. package/dist/default/define/audio/skin.css +72 -34
  8. package/dist/default/define/audio/skin2.js +1 -1
  9. package/dist/default/define/extensions/google-analytics.js +6 -0
  10. package/dist/default/define/live-audio/compat-skin.css +143 -41
  11. package/dist/default/define/live-audio/compat-skin2.js +1 -1
  12. package/dist/default/define/live-audio/neutral-skin.css +56 -31
  13. package/dist/default/define/live-audio/neutral-skin2.js +1 -1
  14. package/dist/default/define/live-audio/scaffold-skin.css +148 -42
  15. package/dist/default/define/live-audio/scaffold-skin2.js +1 -1
  16. package/dist/default/define/live-audio/skin.css +55 -31
  17. package/dist/default/define/live-audio/skin2.js +1 -1
  18. package/dist/default/define/live-video/compat-skin.css +234 -51
  19. package/dist/default/define/live-video/compat-skin2.js +1 -1
  20. package/dist/default/define/live-video/neutral-skin.css +300 -46
  21. package/dist/default/define/live-video/neutral-skin2.js +1 -1
  22. package/dist/default/define/live-video/scaffold-skin.css +231 -53
  23. package/dist/default/define/live-video/scaffold-skin2.js +1 -1
  24. package/dist/default/define/live-video/skin.css +314 -49
  25. package/dist/default/define/live-video/skin2.js +1 -1
  26. package/dist/default/define/media/dailymotion-video.js +11 -0
  27. package/dist/default/define/media/mixcloud-audio.js +11 -0
  28. package/dist/default/define/media/soundcloud-audio.js +11 -0
  29. package/dist/default/define/ui/time-slider-markers.js +5 -0
  30. package/dist/default/define/video/compat-skin.css +242 -51
  31. package/dist/default/define/video/compat-skin2.js +1 -1
  32. package/dist/default/define/video/neutral-skin.css +382 -57
  33. package/dist/default/define/video/neutral-skin2.js +1 -1
  34. package/dist/default/define/video/scaffold-skin.css +240 -53
  35. package/dist/default/define/video/scaffold-skin2.js +1 -1
  36. package/dist/default/define/video/skin.css +415 -55
  37. package/dist/default/define/video/skin2.js +1 -1
  38. package/dist/default/extensions/google-analytics/extension.js +75 -0
  39. package/dist/default/extensions/mux-data/extension.js +7 -2
  40. package/dist/default/index.js +3 -1
  41. package/dist/default/internal/skins/compat-audio/skin.css +161 -41
  42. package/dist/default/internal/skins/compat-audio/template.js +1 -1
  43. package/dist/default/internal/skins/compat-live-audio/skin.css +143 -41
  44. package/dist/default/internal/skins/compat-live-video/skin.css +234 -51
  45. package/dist/default/internal/skins/compat-live-video/template.js +2 -0
  46. package/dist/default/internal/skins/compat-video/skin.css +242 -51
  47. package/dist/default/internal/skins/compat-video/template.js +2 -0
  48. package/dist/default/internal/skins/default-audio/skin.css +72 -34
  49. package/dist/default/internal/skins/default-live-audio/skin.css +55 -31
  50. package/dist/default/internal/skins/default-live-video/skin.css +314 -49
  51. package/dist/default/internal/skins/default-live-video/template.js +14 -0
  52. package/dist/default/internal/skins/default-video/register.js +3 -0
  53. package/dist/default/internal/skins/default-video/skin.css +415 -55
  54. package/dist/default/internal/skins/default-video/template.js +33 -5
  55. package/dist/default/internal/skins/neutral-audio/skin.css +73 -34
  56. package/dist/default/internal/skins/neutral-live-audio/skin.css +56 -31
  57. package/dist/default/internal/skins/neutral-live-video/skin.css +300 -46
  58. package/dist/default/internal/skins/neutral-live-video/template.js +14 -0
  59. package/dist/default/internal/skins/neutral-video/skin.css +382 -57
  60. package/dist/default/internal/skins/neutral-video/template.js +25 -11
  61. package/dist/default/internal/skins/scaffold-audio/skin.css +166 -42
  62. package/dist/default/internal/skins/scaffold-audio/template.js +1 -1
  63. package/dist/default/internal/skins/scaffold-live-audio/skin.css +148 -42
  64. package/dist/default/internal/skins/scaffold-live-video/skin.css +231 -53
  65. package/dist/default/internal/skins/scaffold-live-video/template.js +2 -0
  66. package/dist/default/internal/skins/scaffold-video/skin.css +240 -53
  67. package/dist/default/internal/skins/scaffold-video/template.js +3 -1
  68. package/dist/default/media/background-video/adapter.js +13 -35
  69. package/dist/default/media/background-video/base.js +95 -0
  70. package/dist/default/media/background-video/template.js +13 -20
  71. package/dist/default/media/dailymotion-video/adapter.js +31 -0
  72. package/dist/default/media/hls-background-video/adapter.js +23 -35
  73. package/dist/default/media/mixcloud-audio/adapter.js +16 -0
  74. package/dist/default/media/soundcloud-audio/adapter.js +16 -0
  75. package/dist/default/player/element.js +1 -5
  76. package/dist/default/presets/background/skin.js +2 -2
  77. package/dist/default/presets/skin.js +4 -3
  78. package/dist/default/ui/captions-radio-group/element.js +14 -1
  79. package/dist/default/ui/controls/element.js +6 -3
  80. package/dist/default/ui/dialog/element.js +13 -1
  81. package/dist/default/ui/gesture/element.js +3 -0
  82. package/dist/default/ui/media-button-element.js +10 -1
  83. package/dist/default/ui/playback-rate-button/element.js +7 -2
  84. package/dist/default/ui/playback-rate-radio-group/element.js +10 -3
  85. package/dist/default/ui/radio-options/controller.js +18 -5
  86. package/dist/default/ui/time-slider/markers.js +160 -0
  87. package/dist/default/version.js +1 -1
  88. package/dist/dev/define/audio/compat-skin.css +161 -41
  89. package/dist/dev/define/audio/compat-skin2.js +1 -1
  90. package/dist/dev/define/audio/compat-skin2.js.map +1 -1
  91. package/dist/dev/define/audio/neutral-skin.css +73 -34
  92. package/dist/dev/define/audio/neutral-skin2.js +1 -1
  93. package/dist/dev/define/audio/neutral-skin2.js.map +1 -1
  94. package/dist/dev/define/audio/scaffold-skin.css +166 -42
  95. package/dist/dev/define/audio/scaffold-skin2.js +1 -1
  96. package/dist/dev/define/audio/scaffold-skin2.js.map +1 -1
  97. package/dist/dev/define/audio/skin.css +72 -34
  98. package/dist/dev/define/audio/skin2.js +1 -1
  99. package/dist/dev/define/audio/skin2.js.map +1 -1
  100. package/dist/dev/define/extensions/google-analytics.d.ts +11 -0
  101. package/dist/dev/define/extensions/google-analytics.js +8 -0
  102. package/dist/dev/define/extensions/google-analytics.js.map +1 -0
  103. package/dist/dev/define/live-audio/compat-skin.css +143 -41
  104. package/dist/dev/define/live-audio/compat-skin2.js +1 -1
  105. package/dist/dev/define/live-audio/compat-skin2.js.map +1 -1
  106. package/dist/dev/define/live-audio/neutral-skin.css +56 -31
  107. package/dist/dev/define/live-audio/neutral-skin2.js +1 -1
  108. package/dist/dev/define/live-audio/neutral-skin2.js.map +1 -1
  109. package/dist/dev/define/live-audio/scaffold-skin.css +148 -42
  110. package/dist/dev/define/live-audio/scaffold-skin2.js +1 -1
  111. package/dist/dev/define/live-audio/scaffold-skin2.js.map +1 -1
  112. package/dist/dev/define/live-audio/skin.css +55 -31
  113. package/dist/dev/define/live-audio/skin2.js +1 -1
  114. package/dist/dev/define/live-audio/skin2.js.map +1 -1
  115. package/dist/dev/define/live-video/compat-skin.css +234 -51
  116. package/dist/dev/define/live-video/compat-skin2.js +1 -1
  117. package/dist/dev/define/live-video/compat-skin2.js.map +1 -1
  118. package/dist/dev/define/live-video/neutral-skin.css +300 -46
  119. package/dist/dev/define/live-video/neutral-skin2.js +1 -1
  120. package/dist/dev/define/live-video/neutral-skin2.js.map +1 -1
  121. package/dist/dev/define/live-video/scaffold-skin.css +231 -53
  122. package/dist/dev/define/live-video/scaffold-skin2.js +1 -1
  123. package/dist/dev/define/live-video/scaffold-skin2.js.map +1 -1
  124. package/dist/dev/define/live-video/skin.css +314 -49
  125. package/dist/dev/define/live-video/skin2.js +1 -1
  126. package/dist/dev/define/live-video/skin2.js.map +1 -1
  127. package/dist/dev/define/media/dailymotion-video.d.ts +15 -0
  128. package/dist/dev/define/media/dailymotion-video.js +13 -0
  129. package/dist/dev/define/media/dailymotion-video.js.map +1 -0
  130. package/dist/dev/define/media/mixcloud-audio.d.ts +15 -0
  131. package/dist/dev/define/media/mixcloud-audio.js +13 -0
  132. package/dist/dev/define/media/mixcloud-audio.js.map +1 -0
  133. package/dist/dev/define/media/soundcloud-audio.d.ts +15 -0
  134. package/dist/dev/define/media/soundcloud-audio.js +13 -0
  135. package/dist/dev/define/media/soundcloud-audio.js.map +1 -0
  136. package/dist/dev/define/ui/time-slider-markers.d.ts +8 -0
  137. package/dist/dev/define/ui/time-slider-markers.js +7 -0
  138. package/dist/dev/define/ui/time-slider-markers.js.map +1 -0
  139. package/dist/dev/define/video/compat-skin.css +242 -51
  140. package/dist/dev/define/video/compat-skin2.js +1 -1
  141. package/dist/dev/define/video/compat-skin2.js.map +1 -1
  142. package/dist/dev/define/video/neutral-skin.css +382 -57
  143. package/dist/dev/define/video/neutral-skin2.js +1 -1
  144. package/dist/dev/define/video/neutral-skin2.js.map +1 -1
  145. package/dist/dev/define/video/scaffold-skin.css +240 -53
  146. package/dist/dev/define/video/scaffold-skin2.js +1 -1
  147. package/dist/dev/define/video/scaffold-skin2.js.map +1 -1
  148. package/dist/dev/define/video/skin.css +415 -55
  149. package/dist/dev/define/video/skin2.js +1 -1
  150. package/dist/dev/define/video/skin2.js.map +1 -1
  151. package/dist/dev/extensions/google-analytics/extension.d.ts +52 -0
  152. package/dist/dev/extensions/google-analytics/extension.js +77 -0
  153. package/dist/dev/extensions/google-analytics/extension.js.map +1 -0
  154. package/dist/dev/extensions/google-analytics/index.d.ts +2 -0
  155. package/dist/dev/extensions/mux-data/extension.d.ts +4 -1
  156. package/dist/dev/extensions/mux-data/extension.js +7 -2
  157. package/dist/dev/extensions/mux-data/extension.js.map +1 -1
  158. package/dist/dev/index.d.ts +5 -4
  159. package/dist/dev/index.js +3 -1
  160. package/dist/dev/internal/skins/compat-audio/skin.css +161 -41
  161. package/dist/dev/internal/skins/compat-audio/template.js +1 -1
  162. package/dist/dev/internal/skins/compat-audio/template.js.map +1 -1
  163. package/dist/dev/internal/skins/compat-live-audio/skin.css +143 -41
  164. package/dist/dev/internal/skins/compat-live-video/skin.css +234 -51
  165. package/dist/dev/internal/skins/compat-live-video/template.js +2 -0
  166. package/dist/dev/internal/skins/compat-live-video/template.js.map +1 -1
  167. package/dist/dev/internal/skins/compat-video/skin.css +242 -51
  168. package/dist/dev/internal/skins/compat-video/template.js +2 -0
  169. package/dist/dev/internal/skins/compat-video/template.js.map +1 -1
  170. package/dist/dev/internal/skins/default-audio/skin.css +72 -34
  171. package/dist/dev/internal/skins/default-live-audio/skin.css +55 -31
  172. package/dist/dev/internal/skins/default-live-video/register.js.map +1 -1
  173. package/dist/dev/internal/skins/default-live-video/skin.css +314 -49
  174. package/dist/dev/internal/skins/default-live-video/template.js +14 -0
  175. package/dist/dev/internal/skins/default-live-video/template.js.map +1 -1
  176. package/dist/dev/internal/skins/default-video/register.d.ts +1 -0
  177. package/dist/dev/internal/skins/default-video/register.js +3 -0
  178. package/dist/dev/internal/skins/default-video/register.js.map +1 -1
  179. package/dist/dev/internal/skins/default-video/skin.css +415 -55
  180. package/dist/dev/internal/skins/default-video/template.js +33 -5
  181. package/dist/dev/internal/skins/default-video/template.js.map +1 -1
  182. package/dist/dev/internal/skins/neutral-audio/skin.css +73 -34
  183. package/dist/dev/internal/skins/neutral-live-audio/skin.css +56 -31
  184. package/dist/dev/internal/skins/neutral-live-video/register.js.map +1 -1
  185. package/dist/dev/internal/skins/neutral-live-video/skin.css +300 -46
  186. package/dist/dev/internal/skins/neutral-live-video/template.js +14 -0
  187. package/dist/dev/internal/skins/neutral-live-video/template.js.map +1 -1
  188. package/dist/dev/internal/skins/neutral-video/register.js.map +1 -1
  189. package/dist/dev/internal/skins/neutral-video/skin.css +382 -57
  190. package/dist/dev/internal/skins/neutral-video/template.js +25 -11
  191. package/dist/dev/internal/skins/neutral-video/template.js.map +1 -1
  192. package/dist/dev/internal/skins/scaffold-audio/skin.css +166 -42
  193. package/dist/dev/internal/skins/scaffold-audio/template.js +1 -1
  194. package/dist/dev/internal/skins/scaffold-audio/template.js.map +1 -1
  195. package/dist/dev/internal/skins/scaffold-live-audio/skin.css +148 -42
  196. package/dist/dev/internal/skins/scaffold-live-video/skin.css +231 -53
  197. package/dist/dev/internal/skins/scaffold-live-video/template.js +2 -0
  198. package/dist/dev/internal/skins/scaffold-live-video/template.js.map +1 -1
  199. package/dist/dev/internal/skins/scaffold-video/skin.css +240 -53
  200. package/dist/dev/internal/skins/scaffold-video/template.js +3 -1
  201. package/dist/dev/internal/skins/scaffold-video/template.js.map +1 -1
  202. package/dist/dev/media/background-video/adapter.d.ts +7 -13
  203. package/dist/dev/media/background-video/adapter.js +13 -35
  204. package/dist/dev/media/background-video/adapter.js.map +1 -1
  205. package/dist/dev/media/background-video/base.d.ts +44 -0
  206. package/dist/dev/media/background-video/base.js +97 -0
  207. package/dist/dev/media/background-video/base.js.map +1 -0
  208. package/dist/dev/media/background-video/template.d.ts +3 -0
  209. package/dist/dev/media/background-video/template.js +13 -20
  210. package/dist/dev/media/background-video/template.js.map +1 -1
  211. package/dist/dev/media/dailymotion-video/adapter.d.ts +17 -0
  212. package/dist/dev/media/dailymotion-video/adapter.js +47 -0
  213. package/dist/dev/media/dailymotion-video/adapter.js.map +1 -0
  214. package/dist/dev/media/dailymotion-video/index.d.ts +2 -0
  215. package/dist/dev/media/hls-background-video/adapter.d.ts +14 -19
  216. package/dist/dev/media/hls-background-video/adapter.js +23 -35
  217. package/dist/dev/media/hls-background-video/adapter.js.map +1 -1
  218. package/dist/dev/media/mixcloud-audio/adapter.d.ts +11 -0
  219. package/dist/dev/media/mixcloud-audio/adapter.js +52 -0
  220. package/dist/dev/media/mixcloud-audio/adapter.js.map +1 -0
  221. package/dist/dev/media/mixcloud-audio/index.d.ts +2 -0
  222. package/dist/dev/media/soundcloud-audio/adapter.d.ts +11 -0
  223. package/dist/dev/media/soundcloud-audio/adapter.js +53 -0
  224. package/dist/dev/media/soundcloud-audio/adapter.js.map +1 -0
  225. package/dist/dev/media/soundcloud-audio/index.d.ts +2 -0
  226. package/dist/dev/player/element.js +1 -5
  227. package/dist/dev/player/element.js.map +1 -1
  228. package/dist/dev/presets/background/skin.d.ts +2 -1
  229. package/dist/dev/presets/background/skin.js +2 -2
  230. package/dist/dev/presets/background/skin.js.map +1 -1
  231. package/dist/dev/presets/skin.d.ts +4 -3
  232. package/dist/dev/presets/skin.js +4 -3
  233. package/dist/dev/presets/skin.js.map +1 -1
  234. package/dist/dev/ui/captions-button/element.d.ts +2 -0
  235. package/dist/dev/ui/captions-radio-group/element.d.ts +2 -1
  236. package/dist/dev/ui/captions-radio-group/element.js +14 -1
  237. package/dist/dev/ui/captions-radio-group/element.js.map +1 -1
  238. package/dist/dev/ui/controls/element.d.ts +2 -2
  239. package/dist/dev/ui/controls/element.js +6 -3
  240. package/dist/dev/ui/controls/element.js.map +1 -1
  241. package/dist/dev/ui/dialog/element.js +13 -1
  242. package/dist/dev/ui/dialog/element.js.map +1 -1
  243. package/dist/dev/ui/gesture/element.js +3 -0
  244. package/dist/dev/ui/gesture/element.js.map +1 -1
  245. package/dist/dev/ui/media-button-element.d.ts +9 -0
  246. package/dist/dev/ui/media-button-element.js +10 -1
  247. package/dist/dev/ui/media-button-element.js.map +1 -1
  248. package/dist/dev/ui/play-button/element.d.ts +2 -0
  249. package/dist/dev/ui/playback-rate-button/element.d.ts +9 -1
  250. package/dist/dev/ui/playback-rate-button/element.js +7 -2
  251. package/dist/dev/ui/playback-rate-button/element.js.map +1 -1
  252. package/dist/dev/ui/playback-rate-radio-group/element.d.ts +4 -0
  253. package/dist/dev/ui/playback-rate-radio-group/element.js +10 -3
  254. package/dist/dev/ui/playback-rate-radio-group/element.js.map +1 -1
  255. package/dist/dev/ui/radio-options/controller.js +18 -5
  256. package/dist/dev/ui/radio-options/controller.js.map +1 -1
  257. package/dist/dev/ui/time-slider/markers.d.ts +48 -0
  258. package/dist/dev/ui/time-slider/markers.js +165 -0
  259. package/dist/dev/ui/time-slider/markers.js.map +1 -0
  260. package/dist/dev/version.js +1 -1
  261. package/docs/README.md +1 -1
  262. package/docs/guides/autoplay.md +2 -2
  263. package/docs/guides/background-video.md +2 -4
  264. package/docs/guides/browser-support.md +23 -15
  265. package/docs/guides/build-your-own-skin.md +3 -1
  266. package/docs/guides/cdn.md +10 -9
  267. package/docs/guides/content-security-policy.md +3 -0
  268. package/docs/guides/customize-skins.md +7 -2
  269. package/docs/guides/features.md +1 -1
  270. package/docs/guides/google-analytics.md +199 -0
  271. package/docs/guides/installation-cdn.md +4 -4
  272. package/docs/guides/installation-shadcn.md +3 -3
  273. package/docs/guides/installation-svelte.md +4 -4
  274. package/docs/guides/installation-vue.md +4 -4
  275. package/docs/guides/installation.md +4 -4
  276. package/docs/guides/internationalization.md +5 -5
  277. package/docs/guides/keyboard-shortcuts.md +11 -1
  278. package/docs/guides/llms.txt +3 -1
  279. package/docs/guides/media-sources.md +3 -0
  280. package/docs/guides/migrate-from-media-chrome.md +4 -4
  281. package/docs/guides/migrate-from-mux-player.md +9 -9
  282. package/docs/guides/migrate-from-plyr.md +8 -8
  283. package/docs/guides/migrate-from-video-js-8.md +8 -9
  284. package/docs/guides/migrate-from-vidstack.md +10 -10
  285. package/docs/guides/mux-data.md +22 -0
  286. package/docs/guides/presets.md +5 -5
  287. package/docs/guides/self-hosting.md +5 -5
  288. package/docs/guides/skins.md +21 -5
  289. package/docs/guides/timed-metadata.md +318 -0
  290. package/docs/guides/ui-components.md +1 -1
  291. package/docs/llms.txt +25 -6
  292. package/docs/reference/api/chapters-track.md +71 -0
  293. package/docs/reference/api/define-text-track.md +113 -0
  294. package/docs/reference/api/feature-playback-rate.md +54 -3
  295. package/docs/reference/api/feature-playback.md +5 -1
  296. package/docs/reference/api/feature-text-cues.md +133 -0
  297. package/docs/reference/api/feature-text-tracks.md +11 -5
  298. package/docs/reference/api/get-active-text-cues.md +69 -0
  299. package/docs/reference/api/get-text-cues.md +69 -0
  300. package/docs/reference/api/get-text-tracks.md +41 -0
  301. package/docs/reference/api/hls-metadata-track.md +48 -0
  302. package/docs/reference/api/html-create-player.md +2 -2
  303. package/docs/reference/api/llms.txt +13 -1
  304. package/docs/reference/api/media-capabilities.md +4 -4
  305. package/docs/reference/api/player-store.md +15 -7
  306. package/docs/reference/api/preset-audio.md +15 -5
  307. package/docs/reference/api/preset-background.md +2 -2
  308. package/docs/reference/api/preset-live-audio.md +15 -5
  309. package/docs/reference/api/preset-live-video.md +14 -5
  310. package/docs/reference/api/preset-video.md +14 -5
  311. package/docs/reference/api/resolve-adapter-type.md +4 -1
  312. package/docs/reference/api/ui-element.md +2 -2
  313. package/docs/reference/components/alert-dialog.md +21 -16
  314. package/docs/reference/components/audio-compat-skin.md +8 -2
  315. package/docs/reference/components/audio-neutral-skin.md +2 -2
  316. package/docs/reference/components/audio-scaffold-skin.md +2 -2
  317. package/docs/reference/components/audio-skin.md +2 -2
  318. package/docs/reference/components/audio-track-radio-group.md +2 -2
  319. package/docs/reference/components/audio.md +19 -1
  320. package/docs/reference/components/background-video-skin.md +1 -1
  321. package/docs/reference/components/background-video.md +26 -11
  322. package/docs/reference/components/buffering-indicator.md +2 -2
  323. package/docs/reference/components/captions-radio-group.md +3 -3
  324. package/docs/reference/components/cloudflare-video.md +1 -1
  325. package/docs/reference/components/controls.md +16 -3
  326. package/docs/reference/components/dailymotion-video.md +192 -0
  327. package/docs/reference/components/dash-video.md +20 -2
  328. package/docs/reference/components/dialog.md +49 -22
  329. package/docs/reference/components/error-dialog.md +13 -10
  330. package/docs/reference/components/gesture.md +2 -2
  331. package/docs/reference/components/google-analytics.md +51 -0
  332. package/docs/reference/components/google-cast.md +1 -1
  333. package/docs/reference/components/hls-audio.md +56 -2
  334. package/docs/reference/components/hls-background-video.md +25 -5
  335. package/docs/reference/components/hls-video.md +99 -7
  336. package/docs/reference/components/hlsjs-video.md +53 -12
  337. package/docs/reference/components/hotkey.md +2 -2
  338. package/docs/reference/components/live-audio-compat-skin.md +8 -2
  339. package/docs/reference/components/live-audio-neutral-skin.md +2 -2
  340. package/docs/reference/components/live-audio-scaffold-skin.md +2 -2
  341. package/docs/reference/components/live-audio-skin.md +2 -2
  342. package/docs/reference/components/live-video-compat-skin.md +12 -2
  343. package/docs/reference/components/live-video-neutral-skin.md +6 -2
  344. package/docs/reference/components/live-video-scaffold-skin.md +6 -2
  345. package/docs/reference/components/live-video-skin.md +6 -2
  346. package/docs/reference/components/llms.txt +10 -5
  347. package/docs/reference/components/mixcloud-audio.md +203 -0
  348. package/docs/reference/components/mux-audio.md +35 -2
  349. package/docs/reference/components/mux-background-video.md +1 -1
  350. package/docs/reference/components/mux-data.md +20 -2
  351. package/docs/reference/components/mux-video.md +18 -2
  352. package/docs/reference/components/native-hls-video.md +32 -2
  353. package/docs/reference/components/play-button.md +7 -5
  354. package/docs/reference/components/playback-rate-button.md +26 -7
  355. package/docs/reference/components/playback-rate-radio-group.md +7 -4
  356. package/docs/reference/components/player.md +3 -3
  357. package/docs/reference/components/playerjs-video.md +2 -2
  358. package/docs/reference/components/quality-radio-group.md +2 -2
  359. package/docs/reference/components/shaka-video.md +2 -2
  360. package/docs/reference/components/soundcloud-audio.md +227 -0
  361. package/docs/reference/components/spotify-audio.md +3 -3
  362. package/docs/reference/components/tiktok-video.md +3 -3
  363. package/docs/reference/components/time-slider-markers.md +194 -0
  364. package/docs/reference/components/time-slider.md +14 -0
  365. package/docs/reference/components/twitch-video.md +2 -3
  366. package/docs/reference/components/video-compat-skin.md +12 -2
  367. package/docs/reference/components/video-neutral-skin.md +6 -2
  368. package/docs/reference/components/video-scaffold-skin.md +6 -2
  369. package/docs/reference/components/video-skin.md +6 -2
  370. package/docs/reference/components/video.md +19 -1
  371. package/docs/reference/components/vimeo-video.md +1 -1
  372. package/docs/reference/components/wistia-video.md +1 -1
  373. package/docs/reference/components/youtube-video.md +1 -1
  374. package/package.json +60 -40
@@ -2,7 +2,7 @@
2
2
 
3
3
  Playback speed state and actions for the player store
4
4
 
5
- Controls speed of playback.
5
+ Controls speed of playback. `playbackRateAvailability` is `unsupported` when the media has no playback rate, such as an embed whose provider takes no speed command.
6
6
 
7
7
  ## Import
8
8
 
@@ -14,23 +14,74 @@ The `audioFeatures` and `videoFeatures` [feature bundles](../../guides/presets.m
14
14
 
15
15
  ## API Reference
16
16
 
17
+ ### Configuration
18
+
19
+ Attributes and matching properties the player element accepts. They exist only while this feature is selected.
20
+
21
+ | Prop | Type | Default | Description |
22
+ | --- | --- | --- | --- |
23
+ | `defaultPlaybackRates` (attribute `default-playback-rates`) | `undefined \| null \| readonly number[] \| string` | `[0.5, 0.75, 1, 1.25, 1.5, 1.75, 2]` | Rates the player's controls offer, in the order they cycle through them, unless a control sets its own `rates`. HTML takes a space-separated list, such as `default-playback-rates="0.5 1 1.5 2"`. Missing or empty input restores the defaults. Rates outside the media's range are left out, so YouTube, which plays up to `2`, may offer fewer. |
24
+
17
25
  ### State
18
26
 
19
27
  | Property | Type | Description |
20
28
  | --- | --- | --- |
21
- | `playbackRates` | `readonly number[]` | Available playback rates. |
22
29
  | `playbackRate` | `number` | Current playback rate. |
30
+ | `playbackRateAvailability` | `'available' \| 'unavailable' \| 'unsupported'` | Whether the media can change its playback rate. `unsupported` when the attached media has no `playbackRate` at all, such as an embed whose provider takes no speed command. |
31
+ | `playbackRates` | `readonly number[]` | The default rates that fit the media's range. Set them through the player, not through the store. They are listed even when the media cannot change its rate, so check `playbackRateAvailability` before offering them. |
23
32
 
24
33
  ### Actions
25
34
 
26
35
  | Action | Type | Description |
27
36
  | --- | --- | --- |
28
- | `setPlaybackRate` | `(rate: number) => void` | Set the playback rate. |
37
+ | `setPlaybackRate` | `(rate: number) => void` | Set the playback rate, clamped to the rates the media accepts. |
38
+
39
+ ### Playback rates
40
+
41
+ The player offers `0.5` through `2` in steps of `0.25` unless you set your own list. The [playback rate button](../components/playback-rate-button.md), the [playback rate radio group](../components/playback-rate-radio-group.md), and the `speedUp` and `speedDown` [hotkeys](../../guides/keyboard-shortcuts.md) use this list unless you give one of them its own.
42
+
43
+ Set the `default-playback-rates` attribute on [`<video-player>`](../components/player.md) to a space-separated list:
44
+
45
+ ```html
46
+ <video-player default-playback-rates="0.5 1 1.25 1.5 2">
47
+ <media-container>
48
+ <video src="/video.mp4"></video>
49
+ </media-container>
50
+ </video-player>
51
+ ```
52
+
53
+ The `defaultPlaybackRates` property also takes an array, such as `player.defaultPlaybackRates = [1, 2]`. Removing the attribute restores the defaults.
54
+
55
+ The button cycles through the rates in the order you list them, and the menu shows them in that order. `speedUp` and `speedDown` move to the next faster or slower rate whatever the order, and do nothing at the fastest or slowest rate. The player ignores values that aren’t positive numbers, and repeated rates. If nothing usable is left, it falls back to the defaults.
56
+
57
+ ### Rates for one control
58
+
59
+ To give one control a different list, set `rates` on it. The rest of the player keeps the default list. The control offers these rates as given, even ones outside the media’s range, which play at the nearest end of the range.
60
+
61
+ ```html
62
+ <media-playback-rate-button rates="1 1.5 2"></media-playback-rate-button>
63
+ ```
64
+
65
+ To make the speed hotkeys change speed in fixed steps instead, give `speedUp` and `speedDown` a `value`. A `value` of `0.1` moves from `1` to `1.1`, then `1.2`, and so on.
66
+
67
+ ### Rates outside the list
68
+
69
+ The media owns the current rate, so it can be one the menu doesn’t offer, such as `1.1` set through the media API or a stepped hotkey. The menu then shows that rate as an extra item, slotted before the next faster rate. Skins set it in italics, and its accessible name is “Custom, 1.1×”. The item goes away once the rate is back on the list. Normal speed (`1`) is added the same way when your list leaves it out, but isn’t marked custom.
70
+
71
+ ### Media range
72
+
73
+ Each media accepts rates within a range. Browsers play `0.0625` through `16`, YouTube `0.25` through `2`, and Vimeo up to `2`. The player leaves out any `defaultPlaybackRates` outside that range and keeps the rest in your order. If none are left, it offers the defaults within the range and warns in development. `setPlaybackRate` clamps a rate outside the range to the nearest end, and warns in development. That includes `0`, which would stop the picture while the player still reports playback; call `pause()` instead.
74
+
75
+ `playbackRates` lists rates even for a media that can’t change its rate, so check `playbackRateAvailability` before offering them.
76
+
77
+ YouTube rounds rates down to a step of `0.05`, so asking for `1.13` plays at `1.1`.
29
78
 
30
79
  ### Selector
31
80
 
32
81
  Pass `selectPlaybackRate` to [`PlayerController`](./player-controller.md) to subscribe to playback rate state. Returns `undefined` if the playback rate feature is not configured.
33
82
 
83
+ Check `playbackRateAvailability` before showing a playback rate control.
84
+
34
85
  **rate-display.ts**
35
86
 
36
87
  ```ts
@@ -4,6 +4,8 @@ Play/pause state and actions for the player store
4
4
 
5
5
  Controls play/pause state and tracks whether playback has started or is stalled.
6
6
 
7
+ When the media has `autoplay`, `autoplaying` is true from the moment a source loads until playback starts. It also turns false when the autoplay is refused: browsers don’t announce that, so it shows as the media being able to play through but staying paused, and embeds report it with a `pause` or `error` event. Treat it as playback about to begin: the play button shows pause and the buffering indicator shows while it’s true, and `pause()` cancels it.
8
+
7
9
  ## Import
8
10
 
9
11
  ```ts
@@ -22,13 +24,15 @@ The `audioFeatures`, `liveAudioFeatures`, `liveVideoFeatures`, and `videoFeature
22
24
  | `ended` | `boolean` | Whether playback has reached the end. |
23
25
  | `started` | `boolean` | Whether playback has started (played or seeked). |
24
26
  | `waiting` | `boolean` | Whether playback is stalled waiting for data. |
27
+ | `autoplay` | `boolean` | Whether the media starts playing on its own once it can. |
28
+ | `autoplaying` | `boolean` | Whether the media is trying to autoplay: `autoplay` is set, and playback hasn't started yet. Clears when playback starts, when `pause()` cancels it, and when the autoplay is refused. Browsers don't announce a refusal, so it shows as the media being able to play through but staying paused; embeds report one with a `pause` or `error` event. Controls treat it as playback that's about to begin. |
25
29
 
26
30
  ### Actions
27
31
 
28
32
  | Action | Type | Description |
29
33
  | --- | --- | --- |
30
34
  | `play` | `() => Promise<void>` | Start playback. Updates `paused` immediately when the media starts. |
31
- | `pause` | `() => void` | Pause playback. Updates `paused` immediately. |
35
+ | `pause` | `() => void` | Pause playback. Updates `paused` immediately, and cancels a pending autoplay. |
32
36
 
33
37
  ### Selector
34
38
 
@@ -0,0 +1,133 @@
1
+ # Text cues
2
+
3
+ Cues and active cues from metadata, chapters, and app text tracks
4
+
5
+ Reads the cues of text tracks, from the media and from the app, and tracks which cues are active at the current time. The [timed metadata guide](../../guides/timed-metadata.md) shows how to use it.
6
+
7
+ `textCues` has one entry per track being read, in `textTrackList` order. Each entry holds the `track` as `textTrackList` lists it, every one of its `cues` ordered by start time, and its `activeCues`. Cues are plain data with an `id`, `startTime`, `endTime`, `text`, and, when the cue carries data, a `value` and a `type`.
8
+
9
+ By default the feature reads every `metadata` and `chapters` track that isn’t `disabled`, except the `thumbnails` track. `watchTextCues(filter)` adds the tracks a filter matches until the function it returns is called.
10
+
11
+ Tracks from the media and tracks from the app are read the same way. The [text track feature](./feature-text-tracks.md) lists both in `textTrackList`, and each track’s `source` is `'media'` or `'app'`. Cue changes are kept out of the text track feature, so UI that only lists tracks doesn’t update as cues come and go.
12
+
13
+ ## Import
14
+
15
+ ```ts
16
+ import { textCuesFeature } from '@videojs/html';
17
+ ```
18
+
19
+ The `audioFeatures`, `liveAudioFeatures`, `liveVideoFeatures`, and `videoFeatures` [feature bundles](../../guides/presets.md) include this feature.
20
+
21
+ ## API Reference
22
+
23
+ ### State
24
+
25
+ | Property | Type | Description |
26
+ | --- | --- | --- |
27
+ | `textCues` | `MediaTrackCues[]` | Cues for the tracks being read: `metadata` and `chapters` tracks that aren't disabled, except the thumbnails track, plus any track a `watchTextCues()` filter matches. In `textTrackList` order. |
28
+
29
+ ### Actions
30
+
31
+ | Action | Type | Description |
32
+ | --- | --- | --- |
33
+ | `watchTextCues` | `(filter: { kind?: TextTrackKind \| readonly TextTrackKind[]; label?: string; language?: string } \| ((track: MediaTextTrack) => boolean)) => (() => void)` | Read cues for more tracks, such as captions for an interactive transcript. Cues are tracked until the returned function is called. |
34
+
35
+ ### Selector
36
+
37
+ Pass `selectTextCues` to [`PlayerController`](./player-controller.md) to subscribe to text cue state. Returns `undefined` if the text cues feature is not configured. Outside a custom element, read `player.store.textCues` in a `player.store.subscribe()` callback, or pick cues with [`getActiveTextCues`](./get-active-text-cues.md).
38
+
39
+ **cue-count.ts**
40
+
41
+ ```ts
42
+ import { createPlayer, UIElement, selectTextCues } from '@videojs/html';
43
+ import { videoFeatures } from '@videojs/html/video';
44
+
45
+ const { PlayerController } = createPlayer({ features: videoFeatures });
46
+
47
+ class CueCount extends UIElement {
48
+ readonly #textCues = new PlayerController(this, selectTextCues);
49
+ }
50
+ ```
51
+
52
+ ## Active cues
53
+
54
+ A cue is active from its `startTime` up to its `endTime`. A cue whose `endTime` equals its `startTime` is a point, and stays active for one second from where it sits, so a seek that lands far past a point never activates it. The rule is the same for tracks from the media and from the app. The one exception is a chapters track the app added: a chapter without an `endTime` runs to the next chapter, and the last one to the end of the media.
55
+
56
+ Active cues follow the media’s `currentTime` through `timeupdate` and `seeked` events, and a media track’s `cuechange` events. They aren’t frame-accurate. Updates come a few times a second, so fast playback can move past a point, or a short cue, between two of them. A cue that started since the last update counts as active for that update even when it’s already over, so playback never skips one. A seek doesn’t: the cues it jumps over stay inactive.
57
+
58
+ Cues delivered with a stream can be open-ended. Cue ends are clamped to the media duration once it’s finite.
59
+
60
+ ## Cue values
61
+
62
+ A cue’s `value` comes from the first of these that applies:
63
+
64
+ 1. The cue’s own `value`. A `DataCue`, such as the ones Safari’s native HLS creates for in-band metadata, carries one, and so do the cues hls.js creates for ID3 and `EXT-X-DATERANGE` metadata. Its `type` says what `value` holds, such as `org.id3`. A type names the shape of `value`, not where it came from, so ID3 carried in an `emsg` box is `org.id3` too.
65
+ 2. On a `metadata` track, cue text that parses as a JSON object or array.
66
+ 3. Otherwise, the cue has no `value`. Its text is always in `text`.
67
+
68
+ App cues keep the `value` and `type` they were added with.
69
+
70
+ A media publishes cues on its text tracks in the platform’s shapes. A `VTTCueLike` carries `text`, like the platform’s `VTTCue`. A `DataCueLike` carries a `value` and, when known, its `type`, like the platform’s `DataCue`. A `TextCueLike` is either one, and a single cue can be both, as the cues hls.js creates are. A custom media writes its cues in these shapes.
71
+
72
+ ## App tracks
73
+
74
+ `addTextTrack()` and `removeTextTrack()` come from the [text track feature](./feature-text-tracks.md), and are described here. `addTextTrack()` adds a track to the player rather than to the media, so it works with any media, including embeds without text tracks of their own. It takes a [track definition](./define-text-track.md) and its content, or one object describing both, and returns a handle to the track.
75
+
76
+ ```ts
77
+ const player = document.querySelector('video-player')!;
78
+ const quiz = player.store.addTextTrack({ kind: 'metadata', label: 'quiz' });
79
+
80
+ quiz.addCue({ startTime: 42, value: { question: 'Ready?' } });
81
+ quiz.remove();
82
+ ```
83
+
84
+ The track description takes these fields:
85
+
86
+ | Field | Description |
87
+ | --- | --- |
88
+ | `kind` | The track kind: `metadata`, `chapters`, `captions`, `subtitles`, or `descriptions`. |
89
+ | `label` | The track label. Defaults to `''`. |
90
+ | `language` | The track language, as a BCP 47 tag. Defaults to `''`. |
91
+ | `cues` | The track’s cues. |
92
+ | `src` | A file to load cues from. The file is fetched once the player attaches to media, so only on the client. Without a `format`, it’s WebVTT, or JSON that is an array of cues or an object with a `cues` array. |
93
+ | `format` | A function that reads the `src` file’s text into cues, such as [`podcastChapters`](./chapters-track.md). It returns an array of cues or an object with a `cues` array, and can return a promise, so a parser for another format, such as SRT, loads only when a file needs it. |
94
+
95
+ Each cue takes these fields:
96
+
97
+ | Field | Description |
98
+ | --- | --- |
99
+ | `id` | The cue’s id. When it’s missing or empty, it defaults to an id unique within the track. |
100
+ | `startTime` | Where the cue starts, in seconds. |
101
+ | `endTime` | Where the cue ends, in seconds. Omit it for a point, or, in a chapters track, for a chapter that runs to the next one. |
102
+ | `text` | The cue’s text. Defaults to `''`. |
103
+ | `value` | Structured, JSON-serializable data. |
104
+ | `type` | What `value` holds. |
105
+
106
+ The handle `addTextTrack()` returns has the track’s `id` in `textTrackList`, and `removed`, which turns `true` once the track is gone. `addCue(cue)` and `removeCue(id)` change its cues, and `remove()` removes it. `removeTextTrack(id)` removes a track the app added; tracks from the media stay.
107
+
108
+ Like a `<track>` element, an app track stays until it’s removed, through source changes and media swaps. Removing a track stops loading its `src`. A file given as `src` that fails to load leaves the track with the cues it already has.
109
+
110
+ App tracks start `hidden`. Browsers never draw `metadata` or `chapters` cues. An app `captions` or `subtitles` track is copied into the media, so the browser draws its cues when the track is selected, including in iOS fullscreen where the player’s UI isn’t shown, and the captions menu lists it. The track takes its copy’s mode, so it’s `disabled` until it’s selected and `showing` while it is.
111
+
112
+ When the media has no chapters track, the text track feature’s `chaptersCues` reads the first chapters track the app added, so the [time slider](../components/time-slider.md) can show its chapters. In the same way, when the media has no thumbnails track, `thumbnailsTrack` reads the first `metadata` track the app added with the label `thumbnails`, such as a storyboard file. Image URLs in its cues resolve against its `src`, as they do for a `<track>` element.
113
+
114
+ ## Exports
115
+
116
+ | Export | Description |
117
+ | --- | --- |
118
+ | `MediaTrackCues` | One `textCues` entry: a `track`, its `cues`, and its `activeCues`. |
119
+ | `MediaTextCue` | A cue as plain data. Its type parameter types `value`. |
120
+ | `TextCueLike` | A cue on a media’s text track: a `VTTCueLike`, a `DataCueLike`, or both. |
121
+ | `VTTCueLike` | A media cue that carries `text`, like the platform’s `VTTCue`. |
122
+ | `DataCueLike` | A media cue that carries a `value` and its `type`, like the platform’s `DataCue`. |
123
+ | `TextTrackFilter` | Picks tracks by `kind`, `label`, or `language`, or with a function. Each given field must match, and a list of kinds matches any kind in it. |
124
+ | `TextTrackSource` | Where a track came from: `'media'` or `'app'`. |
125
+ | `AddTextTrack` | The type of `addTextTrack()`. |
126
+ | `TextTrackInit` | A track description with its content. |
127
+ | `TextTrackContent` | What a track carries: `cues`, `src`, and `format`. |
128
+ | `TextCueInit` | A cue an app adds. |
129
+ | `TextCueFormat` | A function that reads a file’s text into cues. |
130
+ | `TextCueFormatResult` | What a `TextCueFormat` returns: an array of cues, or an object with a `cues` array. |
131
+ | `TextTrackHandle` | The handle `addTextTrack()` returns. |
132
+ | `InferCueValue` | The `value` type of a cue type. |
133
+ | `MediaTextCuesState` | The state this feature adds to the store. |
@@ -4,9 +4,13 @@ Subtitles, captions, and chapter track state for the player store
4
4
 
5
5
  Manages subtitles, captions, chapters, and thumbnail tracks.
6
6
 
7
- A default `kind="chapters"` track can also divide the [time slider](../components/time-slider.md) into chapter ranges and label the chapter at the current interaction position.
7
+ `textTrackList` lists the media’s tracks, then the tracks an app adds to the player with this feature’s `addTextTrack()`, described with the [text cues feature](./feature-text-cues.md). Each track’s `source` is `'media'` or `'app'`. An app `captions` or `subtitles` track is copied into the media so the browser can draw it, and it’s selected and listed like the media’s own; its copy isn’t listed separately. Media without text tracks of their own, such as embeds, list only app tracks.
8
8
 
9
- `thumbnailsTrack` is the first `kind="metadata"` track labeled `thumbnails`, or `null` when there is none. Its `crossOrigin` reports the media component’s CORS mode, or `null` when the media is not CORS-enabled. [Thumbnail](../components/thumbnail.md) reads it to fetch sprite sheets the same way the browser fetched the track.
9
+ A default `kind="chapters"` track can also divide the [time slider](../components/time-slider.md) into chapter ranges and label the chapter at the current interaction position. When the media has no chapters track, `chaptersCues` reads the first chapters track the app added instead.
10
+
11
+ This feature doesn’t track cues as they become active. The text cues feature does, for metadata and chapters tracks and for any track a reader asks for.
12
+
13
+ `thumbnailsTrack` is the first `kind="metadata"` track labeled `thumbnails`, or `null` when there is none. When the media has none, it’s the first such track the app added, with its `src` as the base for image URLs. Its `crossOrigin` reports the media component’s CORS mode, or `null` when the media is not CORS-enabled. [Thumbnail](../components/thumbnail.md) reads it to fetch sprite sheets the same way the browser fetched the track.
10
14
 
11
15
  ## Import
12
16
 
@@ -14,7 +18,7 @@ A default `kind="chapters"` track can also divide the [time slider](../component
14
18
  import { textTrackFeature } from '@videojs/html';
15
19
  ```
16
20
 
17
- The `liveVideoFeatures` and `videoFeatures` [feature bundles](../../guides/presets.md) include this feature.
21
+ The `audioFeatures`, `liveAudioFeatures`, `liveVideoFeatures`, and `videoFeatures` [feature bundles](../../guides/presets.md) include this feature.
18
22
 
19
23
  ## API Reference
20
24
 
@@ -22,10 +26,11 @@ The `liveVideoFeatures` and `videoFeatures` [feature bundles](../../guides/prese
22
26
 
23
27
  | Property | Type | Description |
24
28
  | --- | --- | --- |
25
- | `textTrackList` | `MediaTextTrack[]` | All text tracks available on the media component. |
29
+ | `textTrackList` | `MediaTextTrack[]` | Every text track: the media's, then those the app added through the player. `source` tells them apart. |
26
30
  | `subtitlesShowing` | `boolean` | Whether a captions/subtitles track is showing. |
27
- | `chaptersCues` | `MediaTextCue[]` | Cues from the first `kind="chapters"` track, with cue ends clamped to a finite media duration. |
31
+ | `chaptersCues` | `MediaTextCue[]` | Cues from the media's first `kind="chapters"` track, with cue ends clamped to a finite media duration. When the media has none, cues from the first chapters track the app added, where a chapter without an end runs to the next one and the last to the end of the media. |
28
32
  | `thumbnailsTrack` | `{ cues: MediaTextCue[]; src: string \| null; crossOrigin: 'anonymous' \| 'use-credentials' \| null } \| null` | The first thumbnails track, or `null` when there is none. |
33
+ | `addTextTrack` | `{ <Cue extends MediaTextCue>(track: TextTrackDefinition<Cue>, content?: TextTrackContent<InferCueValue<Cue>>): TextTrackHandle<InferCueValue<Cue>>; <Value = unknown>(init: TextTrackInit<Value>): TextTrackHandle<Value> }` | Add a text track from the app. It works on any media, sits next to the media's tracks in `textTrackList`, and its cues are read like theirs. Like a `<track>` element, it stays until it's removed, through source changes and media swaps. |
29
34
 
30
35
  ### Actions
31
36
 
@@ -33,6 +38,7 @@ The `liveVideoFeatures` and `videoFeatures` [feature bundles](../../guides/prese
33
38
  | --- | --- | --- |
34
39
  | `toggleSubtitles` | `(forceShow?: boolean) => boolean` | Toggle captions/subtitles visibility. Showing enables one caption/subtitle track. A track already showing stays selected. Otherwise, selection prefers the last track shown, then a track matching the browser language, then the first available track. Returns whether a track is showing. |
35
40
  | `selectSubtitlesTrack` | `(id: string \| null) => void` | Show the captions/subtitles track with `id`, or turn captions/subtitles off with `null`. |
41
+ | `removeTextTrack` | `(id: string) => void` | Remove a track the app added. Tracks from the media stay. |
36
42
 
37
43
  ### Selector
38
44
 
@@ -0,0 +1,69 @@
1
+ # getActiveTextCues
2
+
3
+ The cues active now on the text tracks a filter or track definition matches
4
+
5
+ ## Import
6
+
7
+ ```ts
8
+ import { getActiveTextCues } from '@videojs/html';
9
+ ```
10
+
11
+ `getActiveTextCues` returns the cues active at the current time on the tracks a filter or [track definition](./define-text-track.md) matches, from the media and the app alike. Cues from several tracks are merged in time order.
12
+
13
+ It reads `textCues` from the [text cues feature](./feature-text-cues.md), which describes when a cue is active, so it only finds cues on the tracks that feature reads.
14
+
15
+ Read through a definition, cues are typed by it. With a schema, cues whose value fails it are skipped.
16
+
17
+ ## Usage
18
+
19
+ Read the active cues in a `player.store.subscribe()` callback to follow playback:
20
+
21
+ ```ts
22
+ const player = document.querySelector('video-player')!;
23
+ const quiz = document.querySelector<HTMLElement>('.quiz')!;
24
+
25
+ player.store.subscribe(() => {
26
+ const [cue] = getActiveTextCues(player.store, quizTrack);
27
+
28
+ quiz.hidden = !cue;
29
+ quiz.textContent = cue?.value?.question ?? '';
30
+ });
31
+ ```
32
+
33
+ ## API Reference
34
+
35
+ ### With Definition
36
+
37
+ `getActiveTextCues<Cue extends MediaTextCue>(source, track): readonly Cue[]`
38
+
39
+ The cues active now on the tracks a track definition matches, typed by the definition. With a schema, cues whose value fails it are skipped.
40
+
41
+ `player.store.subscribe(() => { const [question] = getActiveTextCues(player.store, quizTrack); });`
42
+
43
+ #### Parameters
44
+
45
+ | Parameter | Type | Default | Description |
46
+ | --- | --- | --- | --- |
47
+ | `source` (required) | `{ textCues: readonly MediaTrackCues[] }` | — | State that carries text cues, such as the player store. |
48
+ | `track` (required) | `{ kind: 'subtitles' \| 'captions' \| 'descriptions' \| 'chapters' \| 'metadata'; label?: string; language?: string; schema?: StandardSchemaV1 }` | — | The track definition to read. |
49
+
50
+ #### Return Value
51
+
52
+ `readonly Cue[]`
53
+
54
+ ### With Filter
55
+
56
+ `getActiveTextCues(source, filter?): readonly MediaTextCue[]`
57
+
58
+ The cues active now on the tracks a filter matches, from the media or the app.
59
+
60
+ #### Parameters
61
+
62
+ | Parameter | Type | Default | Description |
63
+ | --- | --- | --- | --- |
64
+ | `source` (required) | `{ textCues: readonly MediaTrackCues[] }` | — | State that carries text cues, such as the player store. |
65
+ | `filter` | `{ kind?: TextTrackKind \| readonly TextTrackKind[]; label?: string; language?: string } \| ((track: MediaTextTrack) => boolean)` | — | Picks tracks by kind, label, or language, or with a function. Defaults to every track being read. |
66
+
67
+ #### Return Value
68
+
69
+ `readonly MediaTextCue[]`
@@ -0,0 +1,69 @@
1
+ # getTextCues
2
+
3
+ Every cue on the text tracks a filter or track definition matches
4
+
5
+ ## Import
6
+
7
+ ```ts
8
+ import { getTextCues } from '@videojs/html';
9
+ ```
10
+
11
+ `getTextCues` returns every cue on the tracks a filter or [track definition](./define-text-track.md) matches, from the media and the app alike. Cues from several tracks are merged in time order.
12
+
13
+ It reads `textCues` from the [text cues feature](./feature-text-cues.md), so it only finds cues on the tracks that feature reads: `metadata` and `chapters` tracks that aren’t `disabled`, except the `thumbnails` track, and the tracks a `watchTextCues()` filter matches.
14
+
15
+ Read through a definition, cues are typed by it. With a schema, cues whose value fails it are skipped.
16
+
17
+ ## Usage
18
+
19
+ To read tracks the feature doesn’t read by default, such as captions for a transcript, watch them first:
20
+
21
+ ```ts
22
+ const player = document.querySelector('video-player')!;
23
+ const captions = { kind: 'captions', language: 'en' } as const;
24
+
25
+ player.store.watchTextCues(captions);
26
+
27
+ player.store.subscribe(() => {
28
+ const cues = getTextCues(player.store, captions);
29
+ console.log(cues.map((cue) => cue.text));
30
+ });
31
+ ```
32
+
33
+ ## API Reference
34
+
35
+ ### With Definition
36
+
37
+ `getTextCues<Cue extends MediaTextCue>(source, track): readonly Cue[]`
38
+
39
+ Every cue on the tracks a track definition matches, typed by the definition. With a schema, cues whose value fails it are skipped.
40
+
41
+ `const questions = getTextCues(player.store, quizTrack);`
42
+
43
+ #### Parameters
44
+
45
+ | Parameter | Type | Default | Description |
46
+ | --- | --- | --- | --- |
47
+ | `source` (required) | `{ textCues: readonly MediaTrackCues[] }` | — | State that carries text cues, such as the player store. |
48
+ | `track` (required) | `{ kind: 'subtitles' \| 'captions' \| 'descriptions' \| 'chapters' \| 'metadata'; label?: string; language?: string; schema?: StandardSchemaV1 }` | — | The track definition to read. |
49
+
50
+ #### Return Value
51
+
52
+ `readonly Cue[]`
53
+
54
+ ### With Filter
55
+
56
+ `getTextCues(source, filter?): readonly MediaTextCue[]`
57
+
58
+ Every cue on the tracks a filter matches, from the media or the app.
59
+
60
+ #### Parameters
61
+
62
+ | Parameter | Type | Default | Description |
63
+ | --- | --- | --- | --- |
64
+ | `source` (required) | `{ textCues: readonly MediaTrackCues[] }` | — | State that carries text cues, such as the player store. |
65
+ | `filter` | `{ kind?: TextTrackKind \| readonly TextTrackKind[]; label?: string; language?: string } \| ((track: MediaTextTrack) => boolean)` | — | Picks tracks by kind, label, or language, or with a function. Defaults to every track being read. |
66
+
67
+ #### Return Value
68
+
69
+ `readonly MediaTextCue[]`
@@ -0,0 +1,41 @@
1
+ # getTextTracks
2
+
3
+ The text tracks a filter or track definition matches, from the media or the app
4
+
5
+ ## Import
6
+
7
+ ```ts
8
+ import { getTextTracks } from '@videojs/html';
9
+ ```
10
+
11
+ `getTextTracks` returns the tracks in `textTrackList` that a filter or [track definition](./define-text-track.md) matches, from the media and the app alike. Each track’s `source` says which. The list comes from the [text track feature](./feature-text-tracks.md).
12
+
13
+ A filter picks tracks by `kind`, `label`, or `language`, or with a function. Each given field must match, and a list of kinds matches any kind in it. Without a filter, `getTextTracks` returns every track.
14
+
15
+ ## Usage
16
+
17
+ Read the tracks in a `player.store.subscribe()` callback to follow changes:
18
+
19
+ ```ts
20
+ const player = document.querySelector('video-player')!;
21
+
22
+ player.store.subscribe(() => {
23
+ const captions = getTextTracks(player.store, { kind: ['captions', 'subtitles'] });
24
+ console.log(captions.map((track) => track.label));
25
+ });
26
+ ```
27
+
28
+ ## API Reference
29
+
30
+ `getTextTracks(source, filter?): MediaTextTrack[]`
31
+
32
+ ### Parameters
33
+
34
+ | Parameter | Type | Default | Description |
35
+ | --- | --- | --- | --- |
36
+ | `source` (required) | `{ textTrackList: readonly MediaTextTrack[] }` | — | State that lists text tracks, such as the player store. |
37
+ | `filter` | `{ kind?: TextTrackKind \| readonly TextTrackKind[]; label?: string; language?: string } \| ((track: MediaTextTrack) => boolean) \| { kind: 'subtitles' \| 'captions' \| 'descriptions' \| 'chapters' \| 'metadata'; label?: string; language?: string; schema?: StandardSchemaV1 }` | `{}` | Picks tracks by kind, label, or language, or with a function. Defaults to every track. |
38
+
39
+ ### Return Value
40
+
41
+ `MediaTextTrack[]`
@@ -0,0 +1,48 @@
1
+ # hlsMetadataTrack
2
+
3
+ A track definition for the ID3 and EXT-X-DATERANGE metadata hls.js publishes
4
+
5
+ ## Import
6
+
7
+ ```ts
8
+ import { hlsMetadataTrack } from '@videojs/html';
9
+ ```
10
+
11
+ `hlsMetadataTrack` is a [track definition](./define-text-track.md) for `{ kind: 'metadata', label: 'id3' }`, the track hls.js publishes timed metadata on. Its cues are typed as `HlsMetadataCue`. The [text cues feature](./feature-text-cues.md) reads the track like any other metadata track.
12
+
13
+ hls.js plays streams in [`HlsJsVideo`](../components/hlsjs-video.md) and the media built on it, such as [`MuxVideo`](../components/mux-video.md), when they play through Media Source Extensions. Where the browser plays HLS natively, as Safari does, in-band metadata arrives as `DataCue`s on the browser’s own metadata tracks instead; read those with a `{ kind: 'metadata' }` filter.
14
+
15
+ ## Cues
16
+
17
+ Each cue carries one ID3 frame or one `EXT-X-DATERANGE` attribute. Its `type` tells which, and narrows `value`:
18
+
19
+ | `type` | Source | `value` |
20
+ | --- | --- | --- |
21
+ | `'org.id3'` | An ID3 frame in the stream’s segments, or carried in an `emsg` box. hls.js types the second `https://aomedia.org/emsg/ID3`; the player reads both as `org.id3`. | `Id3Frame`: the frame id as `key`, such as `TXXX` or `PRIV`, its description or owner as `info`, and its `data`. |
22
+ | `'com.apple.quicktime.HLS'` | An `EXT-X-DATERANGE` tag in the playlist. | `HlsDateRangeAttribute`: the attribute name as `key`, such as `CLASS` or `X-AD-ID`, and its `data`. |
23
+
24
+ A date range’s cues span the range, from its start to its end.
25
+
26
+ ## Usage
27
+
28
+ **id3.ts**
29
+
30
+ ```ts
31
+ import { getActiveTextCues, hlsMetadataTrack } from '@videojs/html';
32
+
33
+ const player = document.querySelector('video-player')!;
34
+
35
+ player.store.subscribe(() => {
36
+ for (const cue of getActiveTextCues(player.store, hlsMetadataTrack)) {
37
+ if (cue.type === 'org.id3' && cue.value?.key === 'TXXX') console.log(cue.value.info, cue.value.data);
38
+ }
39
+ });
40
+ ```
41
+
42
+ ## Exports
43
+
44
+ | Export | Description |
45
+ | --- | --- |
46
+ | `HlsMetadataCue` | A metadata cue from hls.js, typed by its `type`. |
47
+ | `Id3Frame` | An ID3 frame: `key`, `info`, and `data`. |
48
+ | `HlsDateRangeAttribute` | One `EXT-X-DATERANGE` attribute: `key` and `data`. |
@@ -175,7 +175,7 @@ Creates a typed HTML player class and bound controller.
175
175
 
176
176
  | Parameter | Type | Default | Description |
177
177
  | --- | --- | --- | --- |
178
- | `config` (required) | `{ features: [PlayerFeature<MediaPlaybackState>, PlayerFeature<MediaPlaybackRateState>, PlayerFeature<MediaQualityState>, PlayerFeature<MediaAudioTrackState>, PlayerFeature<MediaVolumeState>, PlayerFeature<MediaTimeState>, PlayerFeature<MediaSourceState>, PlayerFeature<MediaBufferState>, PlayerFeature<MediaFullscreenState>, PlayerFeature<MediaPictureInPictureState>, PlayerFeature<MediaRemotePlaybackState>, PlayerFeature<MediaControlsState>, PlayerFeature<MediaTextTrackState>, PlayerFeature<MediaErrorState>, typeof metadataFeature] }` | — | Player configuration with features. |
178
+ | `config` (required) | `{ features: [PlayerFeature<MediaPlaybackState>, typeof playbackRateFeature, PlayerFeature<MediaQualityState>, PlayerFeature<MediaAudioTrackState>, PlayerFeature<MediaVolumeState>, PlayerFeature<MediaTimeState>, PlayerFeature<MediaSourceState>, PlayerFeature<MediaBufferState>, PlayerFeature<MediaFullscreenState>, PlayerFeature<MediaPictureInPictureState>, PlayerFeature<MediaRemotePlaybackState>, PlayerFeature<MediaControlsState>, typeof textTrackFeature, typeof textCuesFeature, PlayerFeature<MediaErrorState>, typeof metadataFeature] }` | — | Player configuration with features. |
179
179
 
180
180
  #### Return Value
181
181
 
@@ -195,7 +195,7 @@ Creates a typed HTML audio player class and bound controller.
195
195
 
196
196
  | Parameter | Type | Default | Description |
197
197
  | --- | --- | --- | --- |
198
- | `config` (required) | `{ features: [PlayerFeature<MediaPlaybackState>, PlayerFeature<MediaPlaybackRateState>, PlayerFeature<MediaVolumeState>, PlayerFeature<MediaTimeState>, PlayerFeature<MediaSourceState>, PlayerFeature<MediaBufferState>, PlayerFeature<MediaErrorState>, typeof metadataFeature] }` | — | Player configuration with features. |
198
+ | `config` (required) | `{ features: [PlayerFeature<MediaPlaybackState>, typeof playbackRateFeature, PlayerFeature<MediaVolumeState>, PlayerFeature<MediaTimeState>, PlayerFeature<MediaSourceState>, PlayerFeature<MediaBufferState>, typeof textTrackFeature, typeof textCuesFeature, PlayerFeature<MediaErrorState>, typeof metadataFeature] }` | — | Player configuration with features. |
199
199
 
200
200
  #### Return Value
201
201
 
@@ -1,6 +1,6 @@
1
1
  # Video.js v10 — HTML API
2
2
 
3
- > API reference for the player factory, presets, store controllers, features, translation tools, and utilities. Bundled with `@videojs/html` v10.2.0. Links are relative paths to files in this directory.
3
+ > API reference for the player factory, presets, store controllers, features, text tracks, translation tools, and utilities. Bundled with `@videojs/html` v10.4.0. Links are relative paths to files in this directory.
4
4
 
5
5
  ## Player
6
6
 
@@ -50,10 +50,22 @@ API reference for the feature modules passed to createPlayer, which provide play
50
50
  - [Remote Playback](./feature-remote-playback.md): Remote playback state and actions for the player store
51
51
  - [Source](./feature-source.md): Media source state and actions for the player store
52
52
  - [Stream type](./feature-stream-type.md): Stream delivery type (live / on-demand) state for the player store
53
+ - [Text cues](./feature-text-cues.md): Cues and active cues from metadata, chapters, and app text tracks
53
54
  - [Text tracks](./feature-text-tracks.md): Subtitles, captions, and chapter track state for the player store
54
55
  - [Time](./feature-time.md): Playback position and duration state for the player store
55
56
  - [Volume](./feature-volume.md): Volume level and mute state for the player store
56
57
 
58
+ ## Text tracks
59
+
60
+ API reference for reading text tracks and their cues: track definitions and readers.
61
+
62
+ - [defineTextTrack](./define-text-track.md): Define a text track once, with the type of its cue values, to add and read it with
63
+ - [getTextTracks](./get-text-tracks.md): The text tracks a filter or track definition matches, from the media or the app
64
+ - [getTextCues](./get-text-cues.md): Every cue on the text tracks a filter or track definition matches
65
+ - [getActiveTextCues](./get-active-text-cues.md): The cues active now on the text tracks a filter or track definition matches
66
+ - [chaptersTrack](./chapters-track.md): A track definition for chapters, and converters that turn chapter JSON formats into cues
67
+ - [hlsMetadataTrack](./hls-metadata-track.md): A track definition for the ID3 and EXT-X-DATERANGE metadata hls.js publishes
68
+
57
69
  ## i18n
58
70
 
59
71
  API reference for translating the player: the i18n elements, controller, and the phrase registry.
@@ -38,7 +38,7 @@ Each `isMedia*Capable` guard accepts any value and returns `false` for `null`, `
38
38
 
39
39
  A guard checks that a few members of a capability are present, then narrows to every member of that capability’s contract. The table lists both.
40
40
 
41
- Some media, such as embeds, can’t provide buffered ranges, text tracks, or remote playback, and report a shared empty placeholder in their place. `isMediaBufferCapable`, `isMediaTextTrackCapable`, and `isMediaRemotePlaybackCapable` return `false` for that placeholder.
41
+ Some media can’t provide buffered ranges, text tracks, or remote playback, and return `undefined` from `buffered` and `seekable`, `textTracks`, or `remote` instead. `isMediaBufferCapable`, `isMediaTextTrackCapable`, and `isMediaRemotePlaybackCapable` return `false` for `undefined`. Media that can provide buffered ranges but has none yet, such as an embed before it loads, reports an empty range, so `isMediaBufferCapable` returns `true`. A custom media that extends a built-in one opts out by overriding the getter to return `undefined`.
42
42
 
43
43
  A guard describes what the media object supports, not its current state. `isMediaErrorCapable` returns `true` while `error` is `null`, and `isMediaVolumeCapable` returns `true` on platforms that ignore volume changes. For current state and availability, such as `volumeAvailability` from the [volume feature](./feature-volume.md), read the player’s [features](../../guides/features.md) instead.
44
44
 
@@ -49,13 +49,13 @@ A guard describes what the media object supports, not its current state. `isMedi
49
49
  | `isMediaSourceCapable` | `src`, `currentSrc`, `readyState`, `load()` | `src`, `currentSrc`, `readyState`, `preload`, `crossOrigin`, `load()`, `canPlayType()` |
50
50
  | `isMediaVolumeCapable` | `volume`, `muted` | `volume`, `muted`, `defaultMuted` |
51
51
  | `isMediaPlaybackRateCapable` | `playbackRate` | `playbackRate`, `defaultPlaybackRate` |
52
- | `isMediaBufferCapable` | `buffered`, `seekable`, neither an empty placeholder | `buffered`, `seekable` |
52
+ | `isMediaBufferCapable` | `buffered`, `seekable`, neither `undefined` | `buffered`, `seekable` |
53
53
  | `isMediaErrorCapable` | `error` (`null` counts) | `error` |
54
- | `isMediaTextTrackCapable` | `textTracks`, not an empty placeholder | `textTracks`, `addTextTrack()` |
54
+ | `isMediaTextTrackCapable` | `textTracks` is not `undefined` | `textTracks`, `addTextTrack()` |
55
55
  | `isMediaVideoRenditionCapable` | `videoRenditions` | `videoRenditions` |
56
56
  | `isMediaAudioTrackCapable` | `audioTracks` | `audioTracks`, `addAudioTrack()`, `removeAudioTrack()` |
57
57
  | `isMediaVideoDimensionsCapable` | `videoWidth`, `videoHeight` | `videoWidth`, `videoHeight` |
58
- | `isMediaRemotePlaybackCapable` | `remote` is an object, not an empty placeholder | `remote`, `disableRemotePlayback` |
58
+ | `isMediaRemotePlaybackCapable` | `remote` is an object | `remote`, `disableRemotePlayback` |
59
59
  | `isMediaStreamTypeCapable` | `streamType` | `streamType` |
60
60
  | `isMediaLiveCapable` | `liveEdgeStart`, `targetLiveWindow` | `liveEdgeStart`, `targetLiveWindow` |
61
61