@videojs/spf 10.0.0-beta.31 → 10.0.0-beta.32

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 (520) hide show
  1. package/dist/default/core/actors/create-machine-actor.js +23 -25
  2. package/dist/default/core/actors/create-machine-actor.js.map +1 -1
  3. package/dist/default/core/actors/create-transition-actor.js +7 -9
  4. package/dist/default/core/actors/create-transition-actor.js.map +1 -1
  5. package/dist/default/core/composition/create-composition.js +26 -29
  6. package/dist/default/core/composition/create-composition.js.map +1 -1
  7. package/dist/default/core/composition/share-signals.js +12 -17
  8. package/dist/default/core/composition/share-signals.js.map +1 -1
  9. package/dist/default/core/machine.js +3 -4
  10. package/dist/default/core/machine.js.map +1 -1
  11. package/dist/default/core/reactors/create-machine-reactor.js +20 -19
  12. package/dist/default/core/reactors/create-machine-reactor.js.map +1 -1
  13. package/dist/default/core/signals/effect.js +24 -4
  14. package/dist/default/core/signals/effect.js.map +1 -1
  15. package/dist/default/core/signals/primitives.js +10 -14
  16. package/dist/default/core/signals/primitives.js.map +1 -1
  17. package/dist/default/core/signals/when.js +6 -8
  18. package/dist/default/core/signals/when.js.map +1 -1
  19. package/dist/default/core/tasks/delayed-reschedule.js +7 -11
  20. package/dist/default/core/tasks/delayed-reschedule.js.map +1 -1
  21. package/dist/default/core/tasks/task.js +59 -82
  22. package/dist/default/core/tasks/task.js.map +1 -1
  23. package/dist/default/hls.js +3 -1
  24. package/dist/default/index.js +2 -3
  25. package/dist/default/index.js.map +1 -1
  26. package/dist/default/media/abr/quality-selection.js +3 -7
  27. package/dist/default/media/abr/quality-selection.js.map +1 -1
  28. package/dist/default/media/buffer/back-buffer.js +15 -19
  29. package/dist/default/media/buffer/back-buffer.js.map +1 -1
  30. package/dist/default/media/buffer/forward-buffer.js +32 -41
  31. package/dist/default/media/buffer/forward-buffer.js.map +1 -1
  32. package/dist/default/media/dom/capabilities.js +26 -37
  33. package/dist/default/media/dom/capabilities.js.map +1 -1
  34. package/dist/default/media/dom/mse/append-segment.js +3 -5
  35. package/dist/default/media/dom/mse/append-segment.js.map +1 -1
  36. package/dist/default/media/dom/mse/buffer-flusher.js +5 -5
  37. package/dist/default/media/dom/mse/buffer-flusher.js.map +1 -1
  38. package/dist/default/media/dom/mse/duration.js +23 -31
  39. package/dist/default/media/dom/mse/duration.js.map +1 -1
  40. package/dist/default/media/dom/mse/end-of-stream.js +3 -6
  41. package/dist/default/media/dom/mse/end-of-stream.js.map +1 -1
  42. package/dist/default/media/dom/mse/mediasource-setup.js +65 -81
  43. package/dist/default/media/dom/mse/mediasource-setup.js.map +1 -1
  44. package/dist/default/media/dom/screen.js +37 -54
  45. package/dist/default/media/dom/screen.js.map +1 -1
  46. package/dist/default/media/dom/text/resolve-vtt-segment.js.map +1 -1
  47. package/dist/default/media/dom/text/text-track-slots.js +15 -23
  48. package/dist/default/media/dom/text/text-track-slots.js.map +1 -1
  49. package/dist/default/media/errors.js +25 -34
  50. package/dist/default/media/errors.js.map +1 -1
  51. package/dist/default/media/hls/parse-attributes.js +9 -26
  52. package/dist/default/media/hls/parse-attributes.js.map +1 -1
  53. package/dist/default/media/hls/parse-media-playlist.js +25 -33
  54. package/dist/default/media/hls/parse-media-playlist.js.map +1 -1
  55. package/dist/default/media/hls/parse-multivariant.js +3 -3
  56. package/dist/default/media/hls/parse-multivariant.js.map +1 -1
  57. package/dist/default/media/hls/reload-policy.js +19 -27
  58. package/dist/default/media/hls/reload-policy.js.map +1 -1
  59. package/dist/default/media/hls/resolve-url.js +1 -3
  60. package/dist/default/media/hls/resolve-url.js.map +1 -1
  61. package/dist/default/media/live-window.js +9 -13
  62. package/dist/default/media/live-window.js.map +1 -1
  63. package/dist/default/media/media-tracks/media-tracks.js +12 -17
  64. package/dist/default/media/media-tracks/media-tracks.js.map +1 -1
  65. package/dist/default/media/mp4/box.js +4 -5
  66. package/dist/default/media/mp4/box.js.map +1 -1
  67. package/dist/default/media/mp4/timestamp-origin.js +30 -42
  68. package/dist/default/media/mp4/timestamp-origin.js.map +1 -1
  69. package/dist/default/media/primitives/resolution.js +5 -8
  70. package/dist/default/media/primitives/resolution.js.map +1 -1
  71. package/dist/default/media/primitives/select-tracks.js +24 -34
  72. package/dist/default/media/primitives/select-tracks.js.map +1 -1
  73. package/dist/default/media/text/parse-vtt-timestamp-map.js +6 -8
  74. package/dist/default/media/text/parse-vtt-timestamp-map.js.map +1 -1
  75. package/dist/default/media/text/resolve-vtt-metadata.js +8 -9
  76. package/dist/default/media/text/resolve-vtt-metadata.js.map +1 -1
  77. package/dist/default/media/types/index.js +10 -18
  78. package/dist/default/media/types/index.js.map +1 -1
  79. package/dist/default/media/utils/cdn.js +10 -16
  80. package/dist/default/media/utils/cdn.js.map +1 -1
  81. package/dist/default/media/utils/preload.js +4 -6
  82. package/dist/default/media/utils/preload.js.map +1 -1
  83. package/dist/default/media/utils/track-selection.js +10 -14
  84. package/dist/default/media/utils/track-selection.js.map +1 -1
  85. package/dist/default/media/utils/tracks.js +56 -54
  86. package/dist/default/media/utils/tracks.js.map +1 -1
  87. package/dist/default/network/bandwidth-estimator.js +18 -19
  88. package/dist/default/network/bandwidth-estimator.js.map +1 -1
  89. package/dist/default/network/chunked-stream-iterable.js +4 -6
  90. package/dist/default/network/chunked-stream-iterable.js.map +1 -1
  91. package/dist/default/network/ewma.js +22 -25
  92. package/dist/default/network/ewma.js.map +1 -1
  93. package/dist/default/network/fetch.js +30 -37
  94. package/dist/default/network/fetch.js.map +1 -1
  95. package/dist/default/playback/actors/dom/segment-loader.js +28 -44
  96. package/dist/default/playback/actors/dom/segment-loader.js.map +1 -1
  97. package/dist/default/playback/actors/dom/source-buffer.js.map +1 -1
  98. package/dist/default/playback/actors/dom/text-tracks.js.map +1 -1
  99. package/dist/default/playback/actors/text-track-segment-loader.js +24 -35
  100. package/dist/default/playback/actors/text-track-segment-loader.js.map +1 -1
  101. package/dist/default/playback/adapters/hls-audio/adapter.js +23 -31
  102. package/dist/default/playback/adapters/hls-audio/adapter.js.map +1 -1
  103. package/dist/default/playback/adapters/hls-audio/media.js.map +1 -1
  104. package/dist/default/playback/adapters/hls-background-video/adapter.js +50 -70
  105. package/dist/default/playback/adapters/hls-background-video/adapter.js.map +1 -1
  106. package/dist/default/playback/adapters/hls-background-video/host.js +12 -16
  107. package/dist/default/playback/adapters/hls-background-video/host.js.map +1 -1
  108. package/dist/default/playback/adapters/hls-background-video/media.js +5 -8
  109. package/dist/default/playback/adapters/hls-background-video/media.js.map +1 -1
  110. package/dist/default/playback/adapters/hls-video/adapter.js +43 -60
  111. package/dist/default/playback/adapters/hls-video/adapter.js.map +1 -1
  112. package/dist/default/playback/adapters/hls-video/error-surface.js +13 -18
  113. package/dist/default/playback/adapters/hls-video/error-surface.js.map +1 -1
  114. package/dist/default/playback/adapters/hls-video/media-tracks.js +4 -5
  115. package/dist/default/playback/adapters/hls-video/media-tracks.js.map +1 -1
  116. package/dist/default/playback/adapters/hls-video/media.js.map +1 -1
  117. package/dist/default/playback/adapters/mux-audio/media.js +8 -12
  118. package/dist/default/playback/adapters/mux-audio/media.js.map +1 -1
  119. package/dist/default/playback/adapters/mux-video/adapter.js +25 -33
  120. package/dist/default/playback/adapters/mux-video/adapter.js.map +1 -1
  121. package/dist/default/playback/adapters/mux-video/media.js +7 -9
  122. package/dist/default/playback/adapters/mux-video/media.js.map +1 -1
  123. package/dist/default/playback/behaviors/calculate-presentation-duration.js +5 -8
  124. package/dist/default/playback/behaviors/calculate-presentation-duration.js.map +1 -1
  125. package/dist/default/playback/behaviors/collect-errors.js +39 -52
  126. package/dist/default/playback/behaviors/collect-errors.js.map +1 -1
  127. package/dist/default/playback/behaviors/derive-cdn-priority.js +16 -23
  128. package/dist/default/playback/behaviors/derive-cdn-priority.js.map +1 -1
  129. package/dist/default/playback/behaviors/dom/airplay.js +38 -61
  130. package/dist/default/playback/behaviors/dom/airplay.js.map +1 -1
  131. package/dist/default/playback/behaviors/dom/apply-start-position.js +23 -35
  132. package/dist/default/playback/behaviors/dom/apply-start-position.js.map +1 -1
  133. package/dist/default/playback/behaviors/dom/end-of-stream.js +11 -16
  134. package/dist/default/playback/behaviors/dom/end-of-stream.js.map +1 -1
  135. package/dist/default/playback/behaviors/dom/load-segments.js +27 -39
  136. package/dist/default/playback/behaviors/dom/load-segments.js.map +1 -1
  137. package/dist/default/playback/behaviors/dom/recover-end-stall.js +21 -26
  138. package/dist/default/playback/behaviors/dom/recover-end-stall.js.map +1 -1
  139. package/dist/default/playback/behaviors/dom/seek-to-live-edge.js +41 -60
  140. package/dist/default/playback/behaviors/dom/seek-to-live-edge.js.map +1 -1
  141. package/dist/default/playback/behaviors/dom/setup-buffer-actors.js +50 -74
  142. package/dist/default/playback/behaviors/dom/setup-buffer-actors.js.map +1 -1
  143. package/dist/default/playback/behaviors/dom/setup-mediasource.js +29 -43
  144. package/dist/default/playback/behaviors/dom/setup-mediasource.js.map +1 -1
  145. package/dist/default/playback/behaviors/dom/setup-text-track-actors.js.map +1 -1
  146. package/dist/default/playback/behaviors/dom/sync-live-seekable-range.js +3 -4
  147. package/dist/default/playback/behaviors/dom/sync-live-seekable-range.js.map +1 -1
  148. package/dist/default/playback/behaviors/dom/sync-text-tracks.js +30 -45
  149. package/dist/default/playback/behaviors/dom/sync-text-tracks.js.map +1 -1
  150. package/dist/default/playback/behaviors/dom/track-current-time.js +9 -11
  151. package/dist/default/playback/behaviors/dom/track-current-time.js.map +1 -1
  152. package/dist/default/playback/behaviors/dom/track-load-triggers.js +24 -32
  153. package/dist/default/playback/behaviors/dom/track-load-triggers.js.map +1 -1
  154. package/dist/default/playback/behaviors/dom/track-playback-rate.js +6 -8
  155. package/dist/default/playback/behaviors/dom/track-playback-rate.js.map +1 -1
  156. package/dist/default/playback/behaviors/dom/track-player-resolution.js +10 -14
  157. package/dist/default/playback/behaviors/dom/track-player-resolution.js.map +1 -1
  158. package/dist/default/playback/behaviors/dom/track-screen-resolution.js +8 -9
  159. package/dist/default/playback/behaviors/dom/track-screen-resolution.js.map +1 -1
  160. package/dist/default/playback/behaviors/dom/update-mediasource-duration.js +28 -43
  161. package/dist/default/playback/behaviors/dom/update-mediasource-duration.js.map +1 -1
  162. package/dist/default/playback/behaviors/establish-start-media-time.js +32 -42
  163. package/dist/default/playback/behaviors/establish-start-media-time.js.map +1 -1
  164. package/dist/default/playback/behaviors/resolve-presentation.js +13 -22
  165. package/dist/default/playback/behaviors/resolve-presentation.js.map +1 -1
  166. package/dist/default/playback/behaviors/resolve-track.js +5 -12
  167. package/dist/default/playback/behaviors/resolve-track.js.map +1 -1
  168. package/dist/default/playback/behaviors/select-tracks.js +77 -104
  169. package/dist/default/playback/behaviors/select-tracks.js.map +1 -1
  170. package/dist/default/playback/behaviors/setup-failover-monitor.js +11 -16
  171. package/dist/default/playback/behaviors/setup-failover-monitor.js.map +1 -1
  172. package/dist/default/playback/behaviors/sync-preload.js +9 -13
  173. package/dist/default/playback/behaviors/sync-preload.js.map +1 -1
  174. package/dist/default/playback/behaviors/track-switching.js +189 -173
  175. package/dist/default/playback/behaviors/track-switching.js.map +1 -1
  176. package/dist/default/playback/engines/hls/engine-audio-only.js +20 -24
  177. package/dist/default/playback/engines/hls/engine-audio-only.js.map +1 -1
  178. package/dist/default/playback/engines/hls/engine-background-video.js +22 -27
  179. package/dist/default/playback/engines/hls/engine-background-video.js.map +1 -1
  180. package/dist/default/playback/engines/hls/engine.js +22 -25
  181. package/dist/default/playback/engines/hls/engine.js.map +1 -1
  182. package/dist/default/playback/primitives/error-messages.js +16 -25
  183. package/dist/default/playback/primitives/error-messages.js.map +1 -1
  184. package/dist/default/playback/primitives/failover-fetch.js +9 -14
  185. package/dist/default/playback/primitives/failover-fetch.js.map +1 -1
  186. package/dist/default/playback/primitives/head-peek.js +7 -10
  187. package/dist/default/playback/primitives/head-peek.js.map +1 -1
  188. package/dist/default/playback/primitives/live-window.js +12 -15
  189. package/dist/default/playback/primitives/live-window.js.map +1 -1
  190. package/dist/default/playback/primitives/relocation-pipelines.js +34 -46
  191. package/dist/default/playback/primitives/relocation-pipelines.js.map +1 -1
  192. package/dist/default/playback/primitives/report-track-conditions.js +26 -38
  193. package/dist/default/playback/primitives/report-track-conditions.js.map +1 -1
  194. package/dist/default/playback/primitives/segment-load-pipeline.js +15 -15
  195. package/dist/default/playback/primitives/segment-load-pipeline.js.map +1 -1
  196. package/dist/default/playback/primitives/selection-rules.js +65 -36
  197. package/dist/default/playback/primitives/selection-rules.js.map +1 -1
  198. package/dist/default/playback/primitives/text-segment-load-pipeline.js +4 -5
  199. package/dist/default/playback/primitives/text-segment-load-pipeline.js.map +1 -1
  200. package/dist/default/playback/primitives/track-types.js +10 -18
  201. package/dist/default/playback/primitives/track-types.js.map +1 -1
  202. package/dist/dev/core/actors/actor.d.ts +4 -4
  203. package/dist/dev/core/actors/actor.d.ts.map +1 -1
  204. package/dist/dev/core/actors/create-machine-actor.d.ts +38 -47
  205. package/dist/dev/core/actors/create-machine-actor.d.ts.map +1 -1
  206. package/dist/dev/core/actors/create-machine-actor.js +23 -25
  207. package/dist/dev/core/actors/create-machine-actor.js.map +1 -1
  208. package/dist/dev/core/actors/create-transition-actor.d.ts +11 -15
  209. package/dist/dev/core/actors/create-transition-actor.d.ts.map +1 -1
  210. package/dist/dev/core/actors/create-transition-actor.js +7 -9
  211. package/dist/dev/core/actors/create-transition-actor.js.map +1 -1
  212. package/dist/dev/core/composition/create-composition.d.ts +70 -102
  213. package/dist/dev/core/composition/create-composition.d.ts.map +1 -1
  214. package/dist/dev/core/composition/create-composition.js +26 -29
  215. package/dist/dev/core/composition/create-composition.js.map +1 -1
  216. package/dist/dev/core/composition/share-signals.d.ts +17 -24
  217. package/dist/dev/core/composition/share-signals.d.ts.map +1 -1
  218. package/dist/dev/core/composition/share-signals.js +12 -17
  219. package/dist/dev/core/composition/share-signals.js.map +1 -1
  220. package/dist/dev/core/machine.d.ts +4 -4
  221. package/dist/dev/core/machine.js +3 -4
  222. package/dist/dev/core/machine.js.map +1 -1
  223. package/dist/dev/core/reactors/create-machine-reactor.d.ts +33 -39
  224. package/dist/dev/core/reactors/create-machine-reactor.d.ts.map +1 -1
  225. package/dist/dev/core/reactors/create-machine-reactor.js +20 -19
  226. package/dist/dev/core/reactors/create-machine-reactor.js.map +1 -1
  227. package/dist/dev/core/signals/effect.d.ts +3 -4
  228. package/dist/dev/core/signals/effect.d.ts.map +1 -1
  229. package/dist/dev/core/signals/effect.js +24 -4
  230. package/dist/dev/core/signals/effect.js.map +1 -1
  231. package/dist/dev/core/signals/primitives.d.ts +10 -12
  232. package/dist/dev/core/signals/primitives.d.ts.map +1 -1
  233. package/dist/dev/core/signals/primitives.js +10 -14
  234. package/dist/dev/core/signals/primitives.js.map +1 -1
  235. package/dist/dev/core/signals/when.js +6 -8
  236. package/dist/dev/core/signals/when.js.map +1 -1
  237. package/dist/dev/core/tasks/delayed-reschedule.js +7 -11
  238. package/dist/dev/core/tasks/delayed-reschedule.js.map +1 -1
  239. package/dist/dev/core/tasks/task.d.ts +51 -73
  240. package/dist/dev/core/tasks/task.d.ts.map +1 -1
  241. package/dist/dev/core/tasks/task.js +59 -82
  242. package/dist/dev/core/tasks/task.js.map +1 -1
  243. package/dist/dev/hls.d.ts +3 -1
  244. package/dist/dev/hls.js +3 -1
  245. package/dist/dev/index.d.ts +2 -3
  246. package/dist/dev/index.d.ts.map +1 -1
  247. package/dist/dev/index.js +2 -3
  248. package/dist/dev/index.js.map +1 -1
  249. package/dist/dev/media/abr/quality-selection.d.ts +7 -10
  250. package/dist/dev/media/abr/quality-selection.d.ts.map +1 -1
  251. package/dist/dev/media/abr/quality-selection.js +3 -7
  252. package/dist/dev/media/abr/quality-selection.js.map +1 -1
  253. package/dist/dev/media/buffer/back-buffer.d.ts +2 -7
  254. package/dist/dev/media/buffer/back-buffer.d.ts.map +1 -1
  255. package/dist/dev/media/buffer/back-buffer.js +15 -19
  256. package/dist/dev/media/buffer/back-buffer.js.map +1 -1
  257. package/dist/dev/media/buffer/forward-buffer.d.ts +2 -7
  258. package/dist/dev/media/buffer/forward-buffer.d.ts.map +1 -1
  259. package/dist/dev/media/buffer/forward-buffer.js +32 -41
  260. package/dist/dev/media/buffer/forward-buffer.js.map +1 -1
  261. package/dist/dev/media/dom/capabilities.js +26 -37
  262. package/dist/dev/media/dom/capabilities.js.map +1 -1
  263. package/dist/dev/media/dom/mse/append-segment.d.ts +3 -5
  264. package/dist/dev/media/dom/mse/append-segment.d.ts.map +1 -1
  265. package/dist/dev/media/dom/mse/append-segment.js +3 -5
  266. package/dist/dev/media/dom/mse/append-segment.js.map +1 -1
  267. package/dist/dev/media/dom/mse/buffer-flusher.d.ts +5 -5
  268. package/dist/dev/media/dom/mse/buffer-flusher.js +5 -5
  269. package/dist/dev/media/dom/mse/buffer-flusher.js.map +1 -1
  270. package/dist/dev/media/dom/mse/duration.js +23 -31
  271. package/dist/dev/media/dom/mse/duration.js.map +1 -1
  272. package/dist/dev/media/dom/mse/end-of-stream.js +3 -6
  273. package/dist/dev/media/dom/mse/end-of-stream.js.map +1 -1
  274. package/dist/dev/media/dom/mse/mediasource-setup.js +65 -81
  275. package/dist/dev/media/dom/mse/mediasource-setup.js.map +1 -1
  276. package/dist/dev/media/dom/screen.d.ts.map +1 -1
  277. package/dist/dev/media/dom/screen.js +37 -54
  278. package/dist/dev/media/dom/screen.js.map +1 -1
  279. package/dist/dev/media/dom/text/resolve-vtt-segment.d.ts.map +1 -1
  280. package/dist/dev/media/dom/text/resolve-vtt-segment.js.map +1 -1
  281. package/dist/dev/media/dom/text/text-track-slots.d.ts +10 -16
  282. package/dist/dev/media/dom/text/text-track-slots.d.ts.map +1 -1
  283. package/dist/dev/media/dom/text/text-track-slots.js +15 -23
  284. package/dist/dev/media/dom/text/text-track-slots.js.map +1 -1
  285. package/dist/dev/media/errors.d.ts +32 -46
  286. package/dist/dev/media/errors.d.ts.map +1 -1
  287. package/dist/dev/media/errors.js +25 -34
  288. package/dist/dev/media/errors.js.map +1 -1
  289. package/dist/dev/media/hls/parse-attributes.js +9 -26
  290. package/dist/dev/media/hls/parse-attributes.js.map +1 -1
  291. package/dist/dev/media/hls/parse-media-playlist.js +25 -33
  292. package/dist/dev/media/hls/parse-media-playlist.js.map +1 -1
  293. package/dist/dev/media/hls/parse-multivariant.js +3 -3
  294. package/dist/dev/media/hls/parse-multivariant.js.map +1 -1
  295. package/dist/dev/media/hls/reload-policy.js +19 -27
  296. package/dist/dev/media/hls/reload-policy.js.map +1 -1
  297. package/dist/dev/media/hls/resolve-url.js +1 -3
  298. package/dist/dev/media/hls/resolve-url.js.map +1 -1
  299. package/dist/dev/media/live-window.js +9 -13
  300. package/dist/dev/media/live-window.js.map +1 -1
  301. package/dist/dev/media/media-tracks/media-tracks.d.ts +8 -13
  302. package/dist/dev/media/media-tracks/media-tracks.d.ts.map +1 -1
  303. package/dist/dev/media/media-tracks/media-tracks.js +12 -17
  304. package/dist/dev/media/media-tracks/media-tracks.js.map +1 -1
  305. package/dist/dev/media/mp4/box.js +4 -5
  306. package/dist/dev/media/mp4/box.js.map +1 -1
  307. package/dist/dev/media/mp4/timestamp-origin.js +30 -42
  308. package/dist/dev/media/mp4/timestamp-origin.js.map +1 -1
  309. package/dist/dev/media/primitives/resolution.d.ts +6 -8
  310. package/dist/dev/media/primitives/resolution.d.ts.map +1 -1
  311. package/dist/dev/media/primitives/resolution.js +5 -8
  312. package/dist/dev/media/primitives/resolution.js.map +1 -1
  313. package/dist/dev/media/primitives/select-tracks.js +24 -34
  314. package/dist/dev/media/primitives/select-tracks.js.map +1 -1
  315. package/dist/dev/media/text/parse-vtt-timestamp-map.js +6 -8
  316. package/dist/dev/media/text/parse-vtt-timestamp-map.js.map +1 -1
  317. package/dist/dev/media/text/resolve-vtt-metadata.js +8 -9
  318. package/dist/dev/media/text/resolve-vtt-metadata.js.map +1 -1
  319. package/dist/dev/media/types/index.d.ts +106 -177
  320. package/dist/dev/media/types/index.d.ts.map +1 -1
  321. package/dist/dev/media/types/index.js +10 -18
  322. package/dist/dev/media/types/index.js.map +1 -1
  323. package/dist/dev/media/utils/cdn.d.ts +4 -6
  324. package/dist/dev/media/utils/cdn.d.ts.map +1 -1
  325. package/dist/dev/media/utils/cdn.js +10 -16
  326. package/dist/dev/media/utils/cdn.js.map +1 -1
  327. package/dist/dev/media/utils/preload.js +4 -6
  328. package/dist/dev/media/utils/preload.js.map +1 -1
  329. package/dist/dev/media/utils/track-selection.js +10 -14
  330. package/dist/dev/media/utils/track-selection.js.map +1 -1
  331. package/dist/dev/media/utils/tracks.js +56 -54
  332. package/dist/dev/media/utils/tracks.js.map +1 -1
  333. package/dist/dev/network/bandwidth-estimator.d.ts +7 -9
  334. package/dist/dev/network/bandwidth-estimator.d.ts.map +1 -1
  335. package/dist/dev/network/bandwidth-estimator.js +18 -19
  336. package/dist/dev/network/bandwidth-estimator.js.map +1 -1
  337. package/dist/dev/network/chunked-stream-iterable.js +4 -6
  338. package/dist/dev/network/chunked-stream-iterable.js.map +1 -1
  339. package/dist/dev/network/ewma.js +22 -25
  340. package/dist/dev/network/ewma.js.map +1 -1
  341. package/dist/dev/network/fetch.js +30 -37
  342. package/dist/dev/network/fetch.js.map +1 -1
  343. package/dist/dev/playback/actors/dom/segment-loader.d.ts +7 -11
  344. package/dist/dev/playback/actors/dom/segment-loader.d.ts.map +1 -1
  345. package/dist/dev/playback/actors/dom/segment-loader.js +28 -44
  346. package/dist/dev/playback/actors/dom/segment-loader.js.map +1 -1
  347. package/dist/dev/playback/actors/dom/source-buffer.d.ts +5 -7
  348. package/dist/dev/playback/actors/dom/source-buffer.d.ts.map +1 -1
  349. package/dist/dev/playback/actors/dom/source-buffer.js.map +1 -1
  350. package/dist/dev/playback/actors/dom/text-tracks.js.map +1 -1
  351. package/dist/dev/playback/actors/text-track-segment-loader.d.ts +10 -16
  352. package/dist/dev/playback/actors/text-track-segment-loader.d.ts.map +1 -1
  353. package/dist/dev/playback/actors/text-track-segment-loader.js +24 -35
  354. package/dist/dev/playback/actors/text-track-segment-loader.js.map +1 -1
  355. package/dist/dev/playback/actors/text-tracks.d.ts +5 -8
  356. package/dist/dev/playback/actors/text-tracks.d.ts.map +1 -1
  357. package/dist/dev/playback/adapters/hls-audio/adapter.d.ts +11 -14
  358. package/dist/dev/playback/adapters/hls-audio/adapter.d.ts.map +1 -1
  359. package/dist/dev/playback/adapters/hls-audio/adapter.js +23 -31
  360. package/dist/dev/playback/adapters/hls-audio/adapter.js.map +1 -1
  361. package/dist/dev/playback/adapters/hls-audio/media.d.ts.map +1 -1
  362. package/dist/dev/playback/adapters/hls-audio/media.js.map +1 -1
  363. package/dist/dev/playback/adapters/hls-background-video/adapter.d.ts +28 -39
  364. package/dist/dev/playback/adapters/hls-background-video/adapter.d.ts.map +1 -1
  365. package/dist/dev/playback/adapters/hls-background-video/adapter.js +50 -70
  366. package/dist/dev/playback/adapters/hls-background-video/adapter.js.map +1 -1
  367. package/dist/dev/playback/adapters/hls-background-video/host.d.ts +12 -16
  368. package/dist/dev/playback/adapters/hls-background-video/host.d.ts.map +1 -1
  369. package/dist/dev/playback/adapters/hls-background-video/host.js +12 -16
  370. package/dist/dev/playback/adapters/hls-background-video/host.js.map +1 -1
  371. package/dist/dev/playback/adapters/hls-background-video/media.d.ts +5 -8
  372. package/dist/dev/playback/adapters/hls-background-video/media.d.ts.map +1 -1
  373. package/dist/dev/playback/adapters/hls-background-video/media.js +5 -8
  374. package/dist/dev/playback/adapters/hls-background-video/media.js.map +1 -1
  375. package/dist/dev/playback/adapters/hls-video/adapter.d.ts +12 -14
  376. package/dist/dev/playback/adapters/hls-video/adapter.d.ts.map +1 -1
  377. package/dist/dev/playback/adapters/hls-video/adapter.js +43 -60
  378. package/dist/dev/playback/adapters/hls-video/adapter.js.map +1 -1
  379. package/dist/dev/playback/adapters/hls-video/error-surface.d.ts +4 -5
  380. package/dist/dev/playback/adapters/hls-video/error-surface.d.ts.map +1 -1
  381. package/dist/dev/playback/adapters/hls-video/error-surface.js +13 -18
  382. package/dist/dev/playback/adapters/hls-video/error-surface.js.map +1 -1
  383. package/dist/dev/playback/adapters/hls-video/media-tracks.d.ts +4 -5
  384. package/dist/dev/playback/adapters/hls-video/media-tracks.d.ts.map +1 -1
  385. package/dist/dev/playback/adapters/hls-video/media-tracks.js +4 -5
  386. package/dist/dev/playback/adapters/hls-video/media-tracks.js.map +1 -1
  387. package/dist/dev/playback/adapters/hls-video/media.d.ts.map +1 -1
  388. package/dist/dev/playback/adapters/hls-video/media.js.map +1 -1
  389. package/dist/dev/playback/adapters/mux-audio/media.d.ts +8 -12
  390. package/dist/dev/playback/adapters/mux-audio/media.d.ts.map +1 -1
  391. package/dist/dev/playback/adapters/mux-audio/media.js +8 -12
  392. package/dist/dev/playback/adapters/mux-audio/media.js.map +1 -1
  393. package/dist/dev/playback/adapters/mux-video/adapter.d.ts +9 -11
  394. package/dist/dev/playback/adapters/mux-video/adapter.d.ts.map +1 -1
  395. package/dist/dev/playback/adapters/mux-video/adapter.js +25 -33
  396. package/dist/dev/playback/adapters/mux-video/adapter.js.map +1 -1
  397. package/dist/dev/playback/adapters/mux-video/media.d.ts +7 -9
  398. package/dist/dev/playback/adapters/mux-video/media.d.ts.map +1 -1
  399. package/dist/dev/playback/adapters/mux-video/media.js +7 -9
  400. package/dist/dev/playback/adapters/mux-video/media.js.map +1 -1
  401. package/dist/dev/playback/behaviors/calculate-presentation-duration.d.ts +5 -8
  402. package/dist/dev/playback/behaviors/calculate-presentation-duration.d.ts.map +1 -1
  403. package/dist/dev/playback/behaviors/calculate-presentation-duration.js +5 -8
  404. package/dist/dev/playback/behaviors/calculate-presentation-duration.js.map +1 -1
  405. package/dist/dev/playback/behaviors/collect-errors.d.ts +2 -0
  406. package/dist/dev/playback/behaviors/collect-errors.js +39 -52
  407. package/dist/dev/playback/behaviors/collect-errors.js.map +1 -1
  408. package/dist/dev/playback/behaviors/derive-cdn-priority.js +16 -23
  409. package/dist/dev/playback/behaviors/derive-cdn-priority.js.map +1 -1
  410. package/dist/dev/playback/behaviors/dom/airplay.js +38 -61
  411. package/dist/dev/playback/behaviors/dom/airplay.js.map +1 -1
  412. package/dist/dev/playback/behaviors/dom/apply-start-position.js +23 -35
  413. package/dist/dev/playback/behaviors/dom/apply-start-position.js.map +1 -1
  414. package/dist/dev/playback/behaviors/dom/end-of-stream.js +11 -16
  415. package/dist/dev/playback/behaviors/dom/end-of-stream.js.map +1 -1
  416. package/dist/dev/playback/behaviors/dom/load-segments.d.ts +5 -8
  417. package/dist/dev/playback/behaviors/dom/load-segments.d.ts.map +1 -1
  418. package/dist/dev/playback/behaviors/dom/load-segments.js +27 -39
  419. package/dist/dev/playback/behaviors/dom/load-segments.js.map +1 -1
  420. package/dist/dev/playback/behaviors/dom/recover-end-stall.js +21 -26
  421. package/dist/dev/playback/behaviors/dom/recover-end-stall.js.map +1 -1
  422. package/dist/dev/playback/behaviors/dom/seek-to-live-edge.js +41 -60
  423. package/dist/dev/playback/behaviors/dom/seek-to-live-edge.js.map +1 -1
  424. package/dist/dev/playback/behaviors/dom/setup-buffer-actors.js +50 -74
  425. package/dist/dev/playback/behaviors/dom/setup-buffer-actors.js.map +1 -1
  426. package/dist/dev/playback/behaviors/dom/setup-mediasource.js +29 -43
  427. package/dist/dev/playback/behaviors/dom/setup-mediasource.js.map +1 -1
  428. package/dist/dev/playback/behaviors/dom/setup-text-track-actors.d.ts +3 -3
  429. package/dist/dev/playback/behaviors/dom/setup-text-track-actors.d.ts.map +1 -1
  430. package/dist/dev/playback/behaviors/dom/setup-text-track-actors.js.map +1 -1
  431. package/dist/dev/playback/behaviors/dom/sync-live-seekable-range.js +3 -4
  432. package/dist/dev/playback/behaviors/dom/sync-live-seekable-range.js.map +1 -1
  433. package/dist/dev/playback/behaviors/dom/sync-text-tracks.js +30 -45
  434. package/dist/dev/playback/behaviors/dom/sync-text-tracks.js.map +1 -1
  435. package/dist/dev/playback/behaviors/dom/track-current-time.d.ts +2 -2
  436. package/dist/dev/playback/behaviors/dom/track-current-time.d.ts.map +1 -1
  437. package/dist/dev/playback/behaviors/dom/track-current-time.js +9 -11
  438. package/dist/dev/playback/behaviors/dom/track-current-time.js.map +1 -1
  439. package/dist/dev/playback/behaviors/dom/track-load-triggers.d.ts +6 -12
  440. package/dist/dev/playback/behaviors/dom/track-load-triggers.d.ts.map +1 -1
  441. package/dist/dev/playback/behaviors/dom/track-load-triggers.js +24 -32
  442. package/dist/dev/playback/behaviors/dom/track-load-triggers.js.map +1 -1
  443. package/dist/dev/playback/behaviors/dom/track-playback-rate.d.ts +2 -2
  444. package/dist/dev/playback/behaviors/dom/track-playback-rate.d.ts.map +1 -1
  445. package/dist/dev/playback/behaviors/dom/track-playback-rate.js +6 -8
  446. package/dist/dev/playback/behaviors/dom/track-playback-rate.js.map +1 -1
  447. package/dist/dev/playback/behaviors/dom/track-player-resolution.d.ts.map +1 -1
  448. package/dist/dev/playback/behaviors/dom/track-player-resolution.js +10 -14
  449. package/dist/dev/playback/behaviors/dom/track-player-resolution.js.map +1 -1
  450. package/dist/dev/playback/behaviors/dom/track-screen-resolution.js +8 -9
  451. package/dist/dev/playback/behaviors/dom/track-screen-resolution.js.map +1 -1
  452. package/dist/dev/playback/behaviors/dom/update-mediasource-duration.js +28 -43
  453. package/dist/dev/playback/behaviors/dom/update-mediasource-duration.js.map +1 -1
  454. package/dist/dev/playback/behaviors/establish-start-media-time.d.ts +15 -19
  455. package/dist/dev/playback/behaviors/establish-start-media-time.d.ts.map +1 -1
  456. package/dist/dev/playback/behaviors/establish-start-media-time.js +32 -42
  457. package/dist/dev/playback/behaviors/establish-start-media-time.js.map +1 -1
  458. package/dist/dev/playback/behaviors/resolve-presentation.d.ts.map +1 -1
  459. package/dist/dev/playback/behaviors/resolve-presentation.js +13 -22
  460. package/dist/dev/playback/behaviors/resolve-presentation.js.map +1 -1
  461. package/dist/dev/playback/behaviors/resolve-track.js +5 -12
  462. package/dist/dev/playback/behaviors/resolve-track.js.map +1 -1
  463. package/dist/dev/playback/behaviors/select-tracks.d.ts +28 -39
  464. package/dist/dev/playback/behaviors/select-tracks.d.ts.map +1 -1
  465. package/dist/dev/playback/behaviors/select-tracks.js +77 -104
  466. package/dist/dev/playback/behaviors/select-tracks.js.map +1 -1
  467. package/dist/dev/playback/behaviors/setup-failover-monitor.d.ts +1 -4
  468. package/dist/dev/playback/behaviors/setup-failover-monitor.d.ts.map +1 -1
  469. package/dist/dev/playback/behaviors/setup-failover-monitor.js +11 -16
  470. package/dist/dev/playback/behaviors/setup-failover-monitor.js.map +1 -1
  471. package/dist/dev/playback/behaviors/sync-preload.js +9 -13
  472. package/dist/dev/playback/behaviors/sync-preload.js.map +1 -1
  473. package/dist/dev/playback/behaviors/track-switching.d.ts +110 -0
  474. package/dist/dev/playback/behaviors/track-switching.d.ts.map +1 -0
  475. package/dist/dev/playback/behaviors/track-switching.js +189 -173
  476. package/dist/dev/playback/behaviors/track-switching.js.map +1 -1
  477. package/dist/dev/playback/engines/hls/engine-audio-only.d.ts +59 -72
  478. package/dist/dev/playback/engines/hls/engine-audio-only.d.ts.map +1 -1
  479. package/dist/dev/playback/engines/hls/engine-audio-only.js +20 -24
  480. package/dist/dev/playback/engines/hls/engine-audio-only.js.map +1 -1
  481. package/dist/dev/playback/engines/hls/engine-background-video.d.ts +51 -78
  482. package/dist/dev/playback/engines/hls/engine-background-video.d.ts.map +1 -1
  483. package/dist/dev/playback/engines/hls/engine-background-video.js +22 -27
  484. package/dist/dev/playback/engines/hls/engine-background-video.js.map +1 -1
  485. package/dist/dev/playback/engines/hls/engine.d.ts +115 -155
  486. package/dist/dev/playback/engines/hls/engine.d.ts.map +1 -1
  487. package/dist/dev/playback/engines/hls/engine.js +22 -25
  488. package/dist/dev/playback/engines/hls/engine.js.map +1 -1
  489. package/dist/dev/playback/primitives/derive-start-media-time.d.ts +3 -3
  490. package/dist/dev/playback/primitives/derive-start-media-time.d.ts.map +1 -1
  491. package/dist/dev/playback/primitives/error-messages.js +16 -25
  492. package/dist/dev/playback/primitives/error-messages.js.map +1 -1
  493. package/dist/dev/playback/primitives/failover-fetch.js +9 -14
  494. package/dist/dev/playback/primitives/failover-fetch.js.map +1 -1
  495. package/dist/dev/playback/primitives/head-peek.js +7 -10
  496. package/dist/dev/playback/primitives/head-peek.js.map +1 -1
  497. package/dist/dev/playback/primitives/live-window.js +12 -15
  498. package/dist/dev/playback/primitives/live-window.js.map +1 -1
  499. package/dist/dev/playback/primitives/relocation-pipelines.js +34 -46
  500. package/dist/dev/playback/primitives/relocation-pipelines.js.map +1 -1
  501. package/dist/dev/playback/primitives/report-track-conditions.d.ts +1 -4
  502. package/dist/dev/playback/primitives/report-track-conditions.d.ts.map +1 -1
  503. package/dist/dev/playback/primitives/report-track-conditions.js +26 -38
  504. package/dist/dev/playback/primitives/report-track-conditions.js.map +1 -1
  505. package/dist/dev/playback/primitives/segment-load-pipeline.js +15 -15
  506. package/dist/dev/playback/primitives/segment-load-pipeline.js.map +1 -1
  507. package/dist/dev/playback/primitives/selection-rules.d.ts +45 -17
  508. package/dist/dev/playback/primitives/selection-rules.d.ts.map +1 -1
  509. package/dist/dev/playback/primitives/selection-rules.js +65 -36
  510. package/dist/dev/playback/primitives/selection-rules.js.map +1 -1
  511. package/dist/dev/playback/primitives/source-buffer-messages.d.ts +6 -9
  512. package/dist/dev/playback/primitives/source-buffer-messages.d.ts.map +1 -1
  513. package/dist/dev/playback/primitives/text-segment-load-pipeline.d.ts +20 -29
  514. package/dist/dev/playback/primitives/text-segment-load-pipeline.d.ts.map +1 -1
  515. package/dist/dev/playback/primitives/text-segment-load-pipeline.js +4 -5
  516. package/dist/dev/playback/primitives/text-segment-load-pipeline.js.map +1 -1
  517. package/dist/dev/playback/primitives/text-track-messages.d.ts.map +1 -1
  518. package/dist/dev/playback/primitives/track-types.js +10 -18
  519. package/dist/dev/playback/primitives/track-types.js.map +1 -1
  520. package/package.json +25 -28
@@ -6,33 +6,28 @@ import { shallowEqual } from "@videojs/utils/object";
6
6
  /**
7
7
  * Screen resolution, as the signal source for a screen-size rendition cap.
8
8
  *
9
- * Reported as a width and a height rather than a `"720p"`-style tier, because
10
- * the cap that consumes it compares against real track dimensions. A tier only
11
- * describes a track once you assume its aspect ratio, and that assumption
9
+ * Reported as a width and a height rather than a `"720p"`-style tier, because the cap that consumes it compares against
10
+ * real track dimensions. A tier only describes a track once you assume its aspect ratio, and that assumption
12
11
  * mis-measures an anamorphic or otherwise non-16:9 rendition.
13
12
  *
14
- * The signal source for the screen-size cap in
15
- * `internal/design/spf/features/rendition-selection-caps.md`.
13
+ * The signal source for the screen-size cap in `internal/design/spf/features/rendition-selection-caps.md`.
16
14
  *
17
- * The screen underneath a window is not stable: rotating a device swaps the axes,
18
- * and unplugging a monitor or dragging the window to another display changes the
19
- * numbers *and* which physical screen they describe. So `getScreenResolution`
20
- * reads at call time and caches nothing, and `watchScreenResolution` layers the
21
- * reacting on top rather than the reader holding state of its own.
15
+ * The screen underneath a window is not stable: rotating a device swaps the axes, and unplugging a monitor or dragging
16
+ * the window to another display changes the numbers _and_ which physical screen they describe. So `getScreenResolution`
17
+ * reads at call time and caches nothing, and `watchScreenResolution` layers the reacting on top rather than the reader
18
+ * holding state of its own.
22
19
  */
23
20
  /**
24
21
  * Read the screen's resolution, or `undefined` where there isn't one to read.
25
22
  *
26
- * `undefined` means "unknown", which is the answer a cap needs in order to not
27
- * cap. `screenResolutionCap` reads it that way and declines to narrow, so an
28
- * unknown screen is "no cap" rather than a cap of zero the reading a naive
29
- * `?? 0` would produce, which would pin every source to its smallest rendition on
30
- * exactly the environments we know least about.
23
+ * `undefined` means "unknown", which is the answer a cap needs in order to not cap. `screenResolutionCap` reads it that
24
+ * way and declines to narrow, so an unknown screen is "no cap" rather than a cap of zero — the reading a naive `?? 0`
25
+ * would produce, which would pin every source to its smallest rendition on exactly the environments we know least
26
+ * about.
31
27
  *
32
- * Dimensions are reported as-is, including the axis swap a rotated device
33
- * applies to them. Normalizing orientation away is a policy questionwhether a
34
- * cap should flap on rotation, or hold the larger budget across both — and
35
- * belongs to the cap rather than to the reading.
28
+ * Dimensions are reported as-is, including the axis swap a rotated device applies to them. Normalizing orientation away
29
+ * is a policy question whether a cap should flap on rotation, or hold the larger budget across both and belongs to
30
+ * the cap rather than to the reading.
36
31
  */
37
32
  function getScreenResolution({ useDevicePixelRatio } = { useDevicePixelRatio: true }) {
38
33
  const screen = globalThis.screen;
@@ -40,49 +35,37 @@ function getScreenResolution({ useDevicePixelRatio } = { useDevicePixelRatio: tr
40
35
  return scaleResolution(screen, useDevicePixelRatio ? getDevicePixelRatio() : 1);
41
36
  }
42
37
  /**
43
- * Call `onChange` whenever {@link getScreenResolution} would start answering
44
- * differently. Returns a function that stops watching.
38
+ * Call `onChange` whenever {@link getScreenResolution} would start answering differently. Returns a function that stops
39
+ * watching.
45
40
  *
46
- * There is no single event for "the screen changed", so this subscribes to every
47
- * signal that implies one and compares readings to decide whether anything
48
- * actually moved. Comparing is what makes that safe: the signals overlap and
49
- * `resize` in particular is noisy, so over-subscribing costs a discarded read
50
- * rather than a spurious call.
41
+ * There is no single event for "the screen changed", so this subscribes to every signal that implies one and compares
42
+ * readings to decide whether anything actually moved. Comparing is what makes that safe: the signals overlap and
43
+ * `resize` in particular is noisy, so over-subscribing costs a discarded read rather than a spurious call.
51
44
  *
52
- * `onChange` is called once on subscribe with the starting value — including
53
- * `undefined` where there is no screen and after that only on a genuine change.
54
- * So a consumer gets its initial state from the watcher and never has to pair it
45
+ * `onChange` is called once on subscribe with the starting value — including `undefined` where there is no screen — and
46
+ * after that only on a genuine change. So a consumer gets its initial state from the watcher and never has to pair it
55
47
  * with a separate {@link getScreenResolution} call.
56
48
  *
57
49
  * The signals, and what each one is here for:
58
50
  *
59
- * - **`screen`'s own `change`** — the screen itself being reconfigured, or the
60
- * window landing on a different one. The direct signal, and the only one that
61
- * catches a window moving between two same-size, same-ratio displays. From the
62
- * Window Management API, but on the base `Screen` rather than behind
63
- * `getScreenDetails()`, so it needs no permission — only a secure context.
64
- * Measured present in Chromium and absent in WebKit and Firefox, hence the
65
- * three below rather than this alone.
66
- * - **`resize`** the window changing size, which is also what the OS does to it
67
- * when the display it was on goes away.
68
- * - **`screen.orientation` change** — rotation, which swaps the axes without
69
- * necessarily resizing the window.
70
- * - **a `(resolution: <ratio>dppx)` media query** (`watchDevicePixelRatio`) — the
71
- * device pixel ratio changing under a window that kept its size, which is the
72
- * cross-display drag between displays of different density.
51
+ * - **`screen`'s own `change`** — the screen itself being reconfigured, or the window landing on a different one. The
52
+ * direct signal, and the only one that catches a window moving between two same-size, same-ratio displays. From the
53
+ * Window Management API, but on the base `Screen` rather than behind `getScreenDetails()`, so it needs no permission
54
+ * only a secure context. Measured present in Chromium and absent in WebKit and Firefox, hence the three below
55
+ * rather than this alone.
56
+ * - **`resize`** the window changing size, which is also what the OS does to it when the display it was on goes away.
57
+ * - **`screen.orientation` change** rotation, which swaps the axes without necessarily resizing the window.
58
+ * - **a `(resolution: <ratio>dppx)` media query** (`watchDevicePixelRatio`) the device pixel ratio changing under a
59
+ * window that kept its size, which is the cross-display drag between displays of different density.
73
60
  *
74
- * Worth keeping despite looking redundant, because it is the only coverage that
75
- * case has in WebKit and Firefox: neither implements `screen`'s change event,
76
- * and the drag doesn't resize the window. It is also a cleaner signal in Safari
77
- * than elsewhere WebKit holds `devicePixelRatio` independent of page zoom, so
78
- * there it moves only on a real density change, where Chromium and Gecko fold
79
- * zoom into it as well.
61
+ * Worth keeping despite looking redundant, because it is the only coverage that case has in WebKit and Firefox: neither
62
+ * implements `screen`'s change event, and the drag doesn't resize the window. It is also a cleaner signal in Safari
63
+ * than elsewhere WebKit holds `devicePixelRatio` independent of page zoom, so there it moves only on a real density
64
+ * change, where Chromium and Gecko fold zoom into it as well.
80
65
  *
81
- * ⚠️ Known gap, on engines without `screen`'s change event: dragging a window
82
- * between two different-size displays that share a ratio, without the window
83
- * resizing, changes the reading with nothing firing. Closing it there would mean
84
- * polling, whose interval and battery cost are a policy decision this function
85
- * shouldn't be making.
66
+ * ⚠️ Known gap, on engines without `screen`'s change event: dragging a window between two different-size displays that
67
+ * share a ratio, without the window resizing, changes the reading with nothing firing. Closing it there would mean
68
+ * polling, whose interval and battery cost are a policy decision this function shouldn't be making.
86
69
  */
87
70
  function watchScreenResolution(onChange, options = { useDevicePixelRatio: true }) {
88
71
  const disconnect = new AbortController();
@@ -1 +1 @@
1
- {"version":3,"file":"screen.js","names":[],"sources":["../../../../src/media/dom/screen.ts"],"sourcesContent":["/**\n * Screen resolution, as the signal source for a screen-size rendition cap.\n *\n * Reported as a width and a height rather than a `\"720p\"`-style tier, because\n * the cap that consumes it compares against real track dimensions. A tier only\n * describes a track once you assume its aspect ratio, and that assumption\n * mis-measures an anamorphic or otherwise non-16:9 rendition.\n *\n * The signal source for the screen-size cap in\n * `internal/design/spf/features/rendition-selection-caps.md`.\n *\n * The screen underneath a window is not stable: rotating a device swaps the axes,\n * and unplugging a monitor or dragging the window to another display changes the\n * numbers *and* which physical screen they describe. So `getScreenResolution`\n * reads at call time and caches nothing, and `watchScreenResolution` layers the\n * reacting on top rather than the reader holding state of its own.\n */\n\nimport { getDevicePixelRatio, listen, watchDevicePixelRatio } from '@videojs/utils/dom';\nimport { shallowEqual } from '@videojs/utils/object';\nimport { isFunction } from '@videojs/utils/predicate';\nimport { type Resolution, scaleResolution } from '../primitives/resolution';\n\n/** A screen's pixel dimensions. */\nexport type ScreenResolution = Resolution;\n\nexport interface ScreenResolutionOptions {\n /**\n * Scale the reading from CSS pixels into device pixels. On by default, since\n * device pixels are what the screen actually has, and a rendition's dimensions\n * are in the same units.\n *\n * Opt out for CSS pixels. Note that derating — a 3x phone rarely wanting 3x the\n * pixels of its layout — is a scale applied over this reading rather than a\n * reason to turn it off.\n *\n * ⚠️ Chromium and Gecko fold page zoom into `devicePixelRatio`, so with this on,\n * zooming moves the reading even though the screen didn't change. WebKit holds\n * the ratio independent of zoom and is unaffected. Whether a cap should track\n * zoom is the cap's call; this flag is only what puts zoom in scope.\n */\n useDevicePixelRatio: boolean;\n}\n\n/**\n * Read the screen's resolution, or `undefined` where there isn't one to read.\n *\n * `undefined` means \"unknown\", which is the answer a cap needs in order to not\n * cap. `screenResolutionCap` reads it that way and declines to narrow, so an\n * unknown screen is \"no cap\" rather than a cap of zero — the reading a naive\n * `?? 0` would produce, which would pin every source to its smallest rendition on\n * exactly the environments we know least about.\n *\n * Dimensions are reported as-is, including the axis swap a rotated device\n * applies to them. Normalizing orientation away is a policy question — whether a\n * cap should flap on rotation, or hold the larger budget across both — and\n * belongs to the cap rather than to the reading.\n */\nexport function getScreenResolution(\n { useDevicePixelRatio }: ScreenResolutionOptions = { useDevicePixelRatio: true }\n): ScreenResolution | undefined {\n const screen = globalThis.screen;\n if (!screen) return undefined;\n\n // A missing or nonsense ratio falls back to 1 (see `getDevicePixelRatio`): a\n // CSS-pixel reading is still true and still cappable, so it isn't worth failing\n // the whole answer over. Rounding, and the nothing-to-report case a `NaN` or\n // zero dimension lands in, belong to `scaleResolution`.\n return scaleResolution(screen, useDevicePixelRatio ? getDevicePixelRatio() : 1);\n}\n\n/**\n * Call `onChange` whenever {@link getScreenResolution} would start answering\n * differently. Returns a function that stops watching.\n *\n * There is no single event for \"the screen changed\", so this subscribes to every\n * signal that implies one and compares readings to decide whether anything\n * actually moved. Comparing is what makes that safe: the signals overlap and\n * `resize` in particular is noisy, so over-subscribing costs a discarded read\n * rather than a spurious call.\n *\n * `onChange` is called once on subscribe with the starting value — including\n * `undefined` where there is no screen — and after that only on a genuine change.\n * So a consumer gets its initial state from the watcher and never has to pair it\n * with a separate {@link getScreenResolution} call.\n *\n * The signals, and what each one is here for:\n *\n * - **`screen`'s own `change`** — the screen itself being reconfigured, or the\n * window landing on a different one. The direct signal, and the only one that\n * catches a window moving between two same-size, same-ratio displays. From the\n * Window Management API, but on the base `Screen` rather than behind\n * `getScreenDetails()`, so it needs no permission — only a secure context.\n * Measured present in Chromium and absent in WebKit and Firefox, hence the\n * three below rather than this alone.\n * - **`resize`** — the window changing size, which is also what the OS does to it\n * when the display it was on goes away.\n * - **`screen.orientation` change** — rotation, which swaps the axes without\n * necessarily resizing the window.\n * - **a `(resolution: <ratio>dppx)` media query** (`watchDevicePixelRatio`) — the\n * device pixel ratio changing under a window that kept its size, which is the\n * cross-display drag between displays of different density.\n *\n * Worth keeping despite looking redundant, because it is the only coverage that\n * case has in WebKit and Firefox: neither implements `screen`'s change event,\n * and the drag doesn't resize the window. It is also a cleaner signal in Safari\n * than elsewhere — WebKit holds `devicePixelRatio` independent of page zoom, so\n * there it moves only on a real density change, where Chromium and Gecko fold\n * zoom into it as well.\n *\n * ⚠️ Known gap, on engines without `screen`'s change event: dragging a window\n * between two different-size displays that share a ratio, without the window\n * resizing, changes the reading with nothing firing. Closing it there would mean\n * polling, whose interval and battery cost are a policy decision this function\n * shouldn't be making.\n */\nexport function watchScreenResolution(\n onChange: (resolution: ScreenResolution | undefined) => void,\n options: ScreenResolutionOptions = { useDevicePixelRatio: true }\n): () => void {\n // One signal for every listener, so stopping is one call rather than a handle\n // per subscription. Also makes a late ratio re-arm inert: `addEventListener`\n // drops a listener whose signal has already aborted.\n const disconnect = new AbortController();\n const { signal } = disconnect;\n let current = getScreenResolution(options);\n\n const check = () => {\n const next = getScreenResolution(options);\n if (shallowEqual(current, next)) return;\n\n current = next;\n onChange(next);\n };\n\n // Deliver the starting value up front, so a consumer gets its initial state from\n // the watcher rather than having to pair it with a separate read. Unconditional,\n // rather than falling out of comparing against an empty `current`: an unknown\n // reading is a value too, and a consumer that only ever heard from us about a\n // *known* screen couldn't tell \"there is no screen\" from \"not called yet\".\n //\n // Before the listeners rather than after, so a callback that throws takes\n // nothing with it — there is no subscription yet to strand.\n onChange(current);\n\n watchDevicePixelRatio(check, signal);\n\n // Each signal is optional for the same reason the reading is: an environment\n // missing one has nothing to report from it, which is not a reason to fail.\n // `screen`'s own change event is subscribed without feature-detecting — where\n // it isn't implemented it simply never fires, and a signal that never fires\n // costs nothing under comparison.\n const screen = globalThis.screen;\n const orientation = screen?.orientation;\n\n if (globalThis.window) listen(globalThis.window, 'resize', check, { signal });\n // NOTE: Chromium browsers support screen change event.\n // See: https://developer.mozilla.org/en-US/docs/Web/API/Screen/change_event\n if (isEventTarget(screen)) listen(screen, 'change', check, { signal });\n if (orientation) listen(orientation, 'change', check, { signal });\n\n return () => disconnect.abort();\n}\n\nfunction isEventTarget(value: any): value is EventTarget {\n return isFunction(value?.addEventListener);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0DA,SAAgB,oBACd,EAAE,wBAAiD,EAAE,qBAAqB,KAAK,GACjD;CAC9B,MAAM,SAAS,WAAW;CAC1B,IAAI,CAAC,QAAQ,OAAO,KAAA;CAMpB,OAAO,gBAAgB,QAAQ,sBAAsB,oBAAoB,IAAI,CAAC;AAChF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,SAAgB,sBACd,UACA,UAAmC,EAAE,qBAAqB,KAAK,GACnD;CAIZ,MAAM,aAAa,IAAI,gBAAgB;CACvC,MAAM,EAAE,WAAW;CACnB,IAAI,UAAU,oBAAoB,OAAO;CAEzC,MAAM,cAAc;EAClB,MAAM,OAAO,oBAAoB,OAAO;EACxC,IAAI,aAAa,SAAS,IAAI,GAAG;EAEjC,UAAU;EACV,SAAS,IAAI;CACf;CAUA,SAAS,OAAO;CAEhB,sBAAsB,OAAO,MAAM;CAOnC,MAAM,SAAS,WAAW;CAC1B,MAAM,cAAc,QAAQ;CAE5B,IAAI,WAAW,QAAQ,OAAO,WAAW,QAAQ,UAAU,OAAO,EAAE,OAAO,CAAC;CAG5E,IAAI,cAAc,MAAM,GAAG,OAAO,QAAQ,UAAU,OAAO,EAAE,OAAO,CAAC;CACrE,IAAI,aAAa,OAAO,aAAa,UAAU,OAAO,EAAE,OAAO,CAAC;CAEhE,aAAa,WAAW,MAAM;AAChC;AAEA,SAAS,cAAc,OAAkC;CACvD,OAAO,WAAW,OAAO,gBAAgB;AAC3C"}
1
+ {"version":3,"file":"screen.js","names":[],"sources":["../../../../src/media/dom/screen.ts"],"sourcesContent":["/**\n * Screen resolution, as the signal source for a screen-size rendition cap.\n *\n * Reported as a width and a height rather than a `\"720p\"`-style tier, because the cap that consumes it compares against\n * real track dimensions. A tier only describes a track once you assume its aspect ratio, and that assumption\n * mis-measures an anamorphic or otherwise non-16:9 rendition.\n *\n * The signal source for the screen-size cap in `internal/design/spf/features/rendition-selection-caps.md`.\n *\n * The screen underneath a window is not stable: rotating a device swaps the axes, and unplugging a monitor or dragging\n * the window to another display changes the numbers _and_ which physical screen they describe. So `getScreenResolution`\n * reads at call time and caches nothing, and `watchScreenResolution` layers the reacting on top rather than the reader\n * holding state of its own.\n */\n\nimport { getDevicePixelRatio, listen, watchDevicePixelRatio } from '@videojs/utils/dom';\nimport { shallowEqual } from '@videojs/utils/object';\nimport { isFunction } from '@videojs/utils/predicate';\n\nimport { type Resolution, scaleResolution } from '../primitives/resolution';\n\n/** A screen's pixel dimensions. */\nexport type ScreenResolution = Resolution;\n\nexport interface ScreenResolutionOptions {\n /**\n * Scale the reading from CSS pixels into device pixels. On by default, since device pixels are what the screen\n * actually has, and a rendition's dimensions are in the same units.\n *\n * Opt out for CSS pixels. Note that derating — a 3x phone rarely wanting 3x the pixels of its layout — is a scale\n * applied over this reading rather than a reason to turn it off.\n *\n * ⚠️ Chromium and Gecko fold page zoom into `devicePixelRatio`, so with this on, zooming moves the reading even\n * though the screen didn't change. WebKit holds the ratio independent of zoom and is unaffected. Whether a cap should\n * track zoom is the cap's call; this flag is only what puts zoom in scope.\n */\n useDevicePixelRatio: boolean;\n}\n\n/**\n * Read the screen's resolution, or `undefined` where there isn't one to read.\n *\n * `undefined` means \"unknown\", which is the answer a cap needs in order to not cap. `screenResolutionCap` reads it that\n * way and declines to narrow, so an unknown screen is \"no cap\" rather than a cap of zero — the reading a naive `?? 0`\n * would produce, which would pin every source to its smallest rendition on exactly the environments we know least\n * about.\n *\n * Dimensions are reported as-is, including the axis swap a rotated device applies to them. Normalizing orientation away\n * is a policy question — whether a cap should flap on rotation, or hold the larger budget across both — and belongs to\n * the cap rather than to the reading.\n */\nexport function getScreenResolution(\n { useDevicePixelRatio }: ScreenResolutionOptions = { useDevicePixelRatio: true }\n): ScreenResolution | undefined {\n const screen = globalThis.screen;\n if (!screen) return undefined;\n\n // A missing or nonsense ratio falls back to 1 (see `getDevicePixelRatio`): a\n // CSS-pixel reading is still true and still cappable, so it isn't worth failing\n // the whole answer over. Rounding, and the nothing-to-report case a `NaN` or\n // zero dimension lands in, belong to `scaleResolution`.\n return scaleResolution(screen, useDevicePixelRatio ? getDevicePixelRatio() : 1);\n}\n\n/**\n * Call `onChange` whenever {@link getScreenResolution} would start answering differently. Returns a function that stops\n * watching.\n *\n * There is no single event for \"the screen changed\", so this subscribes to every signal that implies one and compares\n * readings to decide whether anything actually moved. Comparing is what makes that safe: the signals overlap and\n * `resize` in particular is noisy, so over-subscribing costs a discarded read rather than a spurious call.\n *\n * `onChange` is called once on subscribe with the starting value — including `undefined` where there is no screen — and\n * after that only on a genuine change. So a consumer gets its initial state from the watcher and never has to pair it\n * with a separate {@link getScreenResolution} call.\n *\n * The signals, and what each one is here for:\n *\n * - **`screen`'s own `change`** — the screen itself being reconfigured, or the window landing on a different one. The\n * direct signal, and the only one that catches a window moving between two same-size, same-ratio displays. From the\n * Window Management API, but on the base `Screen` rather than behind `getScreenDetails()`, so it needs no permission\n * — only a secure context. Measured present in Chromium and absent in WebKit and Firefox, hence the three below\n * rather than this alone.\n * - **`resize`** — the window changing size, which is also what the OS does to it when the display it was on goes away.\n * - **`screen.orientation` change** — rotation, which swaps the axes without necessarily resizing the window.\n * - **a `(resolution: <ratio>dppx)` media query** (`watchDevicePixelRatio`) — the device pixel ratio changing under a\n * window that kept its size, which is the cross-display drag between displays of different density.\n *\n * Worth keeping despite looking redundant, because it is the only coverage that case has in WebKit and Firefox: neither\n * implements `screen`'s change event, and the drag doesn't resize the window. It is also a cleaner signal in Safari\n * than elsewhere — WebKit holds `devicePixelRatio` independent of page zoom, so there it moves only on a real density\n * change, where Chromium and Gecko fold zoom into it as well.\n *\n * ⚠️ Known gap, on engines without `screen`'s change event: dragging a window between two different-size displays that\n * share a ratio, without the window resizing, changes the reading with nothing firing. Closing it there would mean\n * polling, whose interval and battery cost are a policy decision this function shouldn't be making.\n */\nexport function watchScreenResolution(\n onChange: (resolution: ScreenResolution | undefined) => void,\n options: ScreenResolutionOptions = { useDevicePixelRatio: true }\n): () => void {\n // One signal for every listener, so stopping is one call rather than a handle\n // per subscription. Also makes a late ratio re-arm inert: `addEventListener`\n // drops a listener whose signal has already aborted.\n const disconnect = new AbortController();\n const { signal } = disconnect;\n let current = getScreenResolution(options);\n\n const check = () => {\n const next = getScreenResolution(options);\n if (shallowEqual(current, next)) return;\n\n current = next;\n onChange(next);\n };\n\n // Deliver the starting value up front, so a consumer gets its initial state from\n // the watcher rather than having to pair it with a separate read. Unconditional,\n // rather than falling out of comparing against an empty `current`: an unknown\n // reading is a value too, and a consumer that only ever heard from us about a\n // *known* screen couldn't tell \"there is no screen\" from \"not called yet\".\n //\n // Before the listeners rather than after, so a callback that throws takes\n // nothing with it — there is no subscription yet to strand.\n onChange(current);\n\n watchDevicePixelRatio(check, signal);\n\n // Each signal is optional for the same reason the reading is: an environment\n // missing one has nothing to report from it, which is not a reason to fail.\n // `screen`'s own change event is subscribed without feature-detecting — where\n // it isn't implemented it simply never fires, and a signal that never fires\n // costs nothing under comparison.\n const screen = globalThis.screen;\n const orientation = screen?.orientation;\n\n if (globalThis.window) listen(globalThis.window, 'resize', check, { signal });\n\n // NOTE: Chromium browsers support screen change event.\n // See: https://developer.mozilla.org/en-US/docs/Web/API/Screen/change_event\n if (isEventTarget(screen)) listen(screen, 'change', check, { signal });\n\n if (orientation) listen(orientation, 'change', check, { signal });\n\n return () => disconnect.abort();\n}\n\nfunction isEventTarget(value: any): value is EventTarget {\n return isFunction(value?.addEventListener);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDA,SAAgB,oBACd,EAAE,wBAAiD,EAAE,qBAAqB,KAAK,GACjD;CAC9B,MAAM,SAAS,WAAW;CAC1B,IAAI,CAAC,QAAQ,OAAO,KAAA;CAMpB,OAAO,gBAAgB,QAAQ,sBAAsB,oBAAoB,IAAI,CAAC;AAChF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,SAAgB,sBACd,UACA,UAAmC,EAAE,qBAAqB,KAAK,GACnD;CAIZ,MAAM,aAAa,IAAI,gBAAgB;CACvC,MAAM,EAAE,WAAW;CACnB,IAAI,UAAU,oBAAoB,OAAO;CAEzC,MAAM,cAAc;EAClB,MAAM,OAAO,oBAAoB,OAAO;EACxC,IAAI,aAAa,SAAS,IAAI,GAAG;EAEjC,UAAU;EACV,SAAS,IAAI;CACf;CAUA,SAAS,OAAO;CAEhB,sBAAsB,OAAO,MAAM;CAOnC,MAAM,SAAS,WAAW;CAC1B,MAAM,cAAc,QAAQ;CAE5B,IAAI,WAAW,QAAQ,OAAO,WAAW,QAAQ,UAAU,OAAO,EAAE,OAAO,CAAC;CAI5E,IAAI,cAAc,MAAM,GAAG,OAAO,QAAQ,UAAU,OAAO,EAAE,OAAO,CAAC;CAErE,IAAI,aAAa,OAAO,aAAa,UAAU,OAAO,EAAE,OAAO,CAAC;CAEhE,aAAa,WAAW,MAAM;AAChC;AAEA,SAAS,cAAc,OAAkC;CACvD,OAAO,WAAW,OAAO,gBAAgB;AAC3C"}
@@ -1 +1 @@
1
- {"version":3,"file":"resolve-vtt-segment.d.ts","names":[],"sources":["../../../../../src/media/dom/text/resolve-vtt-segment.ts"],"mappings":";iBAuBgB,kBAAkB,cAAc,QAAQ;iBAkDxC"}
1
+ {"version":3,"file":"resolve-vtt-segment.d.ts","names":[],"sources":["../../../../../src/media/dom/text/resolve-vtt-segment.ts"],"mappings":";iBAwBgB,kBAAkB,cAAc,QAAQ;iBAoDxC"}
@@ -1 +1 @@
1
- {"version":3,"file":"resolve-vtt-segment.js","names":[],"sources":["../../../../../src/media/dom/text/resolve-vtt-segment.ts"],"sourcesContent":["/**\n * Parse a VTT segment using browser's native parser.\n *\n * Creates a dummy video element with a track element to leverage\n * the browser's optimized VTT parsing. Returns parsed VTTCue objects.\n */\n\nimport { resolveVttSegmentMetadata, type TextSegmentMetadata } from '../../text/resolve-vtt-metadata';\n\n// Singleton dummy video (reused across all parsing)\nlet dummyVideo: HTMLVideoElement | null = null;\n\nfunction ensureDummyVideo(): HTMLVideoElement {\n if (!dummyVideo) {\n dummyVideo = document.createElement('video');\n dummyVideo.muted = true;\n dummyVideo.preload = 'none';\n dummyVideo.style.display = 'none';\n dummyVideo.crossOrigin = 'anonymous';\n }\n return dummyVideo;\n}\n\nexport function resolveVttSegment(url: string): Promise<VTTCue[]> {\n const video = ensureDummyVideo();\n const track = document.createElement('track');\n track.kind = 'subtitles';\n\n return new Promise((resolve, reject) => {\n const onLoad = (): void => {\n const cues: VTTCue[] = [];\n const textTrack = track.track;\n\n if (textTrack.cues) {\n for (let i = 0; i < textTrack.cues.length; i++) {\n const cue = textTrack.cues[i];\n if (cue) {\n cues.push(cue as VTTCue);\n }\n }\n }\n\n cleanup();\n resolve(cues);\n };\n\n const onError = (): void => {\n cleanup();\n reject(new Error(`Failed to load VTT segment: ${url}`));\n };\n\n const cleanup = (): void => {\n track.removeEventListener('load', onLoad);\n track.removeEventListener('error', onError);\n video.removeChild(track);\n };\n\n track.addEventListener('load', onLoad);\n track.addEventListener('error', onError);\n video.appendChild(track);\n // Force the browser to load and parse THIS track's resource by activating\n // it explicitly. Relying on `default = true` only works for the first track\n // appended to the reused dummy video: the media element's automatic\n // text-track selection runs once, so on Firefox every subsequent `<track>`\n // stays inactive, its resource is never fetched, and `load` never fires —\n // stranding all cues past the first segment. Setting `mode = 'hidden'`\n // (active but not rendered — this video is never shown) loads each segment\n // on every browser.\n track.track.mode = 'hidden';\n track.src = url;\n });\n}\n\nexport function destroyVttResolver(): void {\n dummyVideo = null;\n}\n\n/**\n * A resolved VTT segment paired with its header metadata — the shape used when a\n * caller needs the `X-TIMESTAMP-MAP` correlation (e.g. non-zero-PTS sources),\n * not just the cues.\n */\nexport interface ResolvedVttSegment {\n cues: VTTCue[];\n metadata: TextSegmentMetadata;\n}\n\n/**\n * Resolve a VTT segment's cues and header metadata together. Cues still come\n * from the browser's native parser ({@link resolveVttSegment}); the header is\n * scraped in parallel ({@link resolveVttSegmentMetadata}).\n */\nexport function resolveVttSegmentWithMetadata(url: string): Promise<ResolvedVttSegment> {\n return Promise.all([resolveVttSegment(url), resolveVttSegmentMetadata(url)]).then(([cues, metadata]) => ({\n cues,\n metadata,\n }));\n}\n"],"mappings":";AAUA,IAAI,aAAsC;AAE1C,SAAS,mBAAqC;CAC5C,IAAI,CAAC,YAAY;EACf,aAAa,SAAS,cAAc,OAAO;EAC3C,WAAW,QAAQ;EACnB,WAAW,UAAU;EACrB,WAAW,MAAM,UAAU;EAC3B,WAAW,cAAc;CAC3B;CACA,OAAO;AACT;AAEA,SAAgB,kBAAkB,KAAgC;CAChE,MAAM,QAAQ,iBAAiB;CAC/B,MAAM,QAAQ,SAAS,cAAc,OAAO;CAC5C,MAAM,OAAO;CAEb,OAAO,IAAI,SAAS,SAAS,WAAW;EACtC,MAAM,eAAqB;GACzB,MAAM,OAAiB,CAAC;GACxB,MAAM,YAAY,MAAM;GAExB,IAAI,UAAU,MACZ,KAAK,IAAI,IAAI,GAAG,IAAI,UAAU,KAAK,QAAQ,KAAK;IAC9C,MAAM,MAAM,UAAU,KAAK;IAC3B,IAAI,KACF,KAAK,KAAK,GAAa;GAE3B;GAGF,QAAQ;GACR,QAAQ,IAAI;EACd;EAEA,MAAM,gBAAsB;GAC1B,QAAQ;GACR,uBAAO,IAAI,MAAM,+BAA+B,KAAK,CAAC;EACxD;EAEA,MAAM,gBAAsB;GAC1B,MAAM,oBAAoB,QAAQ,MAAM;GACxC,MAAM,oBAAoB,SAAS,OAAO;GAC1C,MAAM,YAAY,KAAK;EACzB;EAEA,MAAM,iBAAiB,QAAQ,MAAM;EACrC,MAAM,iBAAiB,SAAS,OAAO;EACvC,MAAM,YAAY,KAAK;EASvB,MAAM,MAAM,OAAO;EACnB,MAAM,MAAM;CACd,CAAC;AACH;AAEA,SAAgB,qBAA2B;CACzC,aAAa;AACf"}
1
+ {"version":3,"file":"resolve-vtt-segment.js","names":[],"sources":["../../../../../src/media/dom/text/resolve-vtt-segment.ts"],"sourcesContent":["/**\n * Parse a VTT segment using browser's native parser.\n *\n * Creates a dummy video element with a track element to leverage the browser's optimized VTT parsing. Returns parsed\n * VTTCue objects.\n */\n\nimport { resolveVttSegmentMetadata, type TextSegmentMetadata } from '../../text/resolve-vtt-metadata';\n\n// Singleton dummy video (reused across all parsing)\nlet dummyVideo: HTMLVideoElement | null = null;\n\nfunction ensureDummyVideo(): HTMLVideoElement {\n if (!dummyVideo) {\n dummyVideo = document.createElement('video');\n dummyVideo.muted = true;\n dummyVideo.preload = 'none';\n dummyVideo.style.display = 'none';\n dummyVideo.crossOrigin = 'anonymous';\n }\n\n return dummyVideo;\n}\n\nexport function resolveVttSegment(url: string): Promise<VTTCue[]> {\n const video = ensureDummyVideo();\n const track = document.createElement('track');\n\n track.kind = 'subtitles';\n\n return new Promise((resolve, reject) => {\n const onLoad = (): void => {\n const cues: VTTCue[] = [];\n const textTrack = track.track;\n\n if (textTrack.cues) {\n for (let i = 0; i < textTrack.cues.length; i++) {\n const cue = textTrack.cues[i];\n\n if (cue) {\n cues.push(cue as VTTCue);\n }\n }\n }\n\n cleanup();\n resolve(cues);\n };\n\n const onError = (): void => {\n cleanup();\n reject(new Error(`Failed to load VTT segment: ${url}`));\n };\n\n const cleanup = (): void => {\n track.removeEventListener('load', onLoad);\n track.removeEventListener('error', onError);\n video.removeChild(track);\n };\n\n track.addEventListener('load', onLoad);\n track.addEventListener('error', onError);\n video.appendChild(track);\n // Force the browser to load and parse THIS track's resource by activating\n // it explicitly. Relying on `default = true` only works for the first track\n // appended to the reused dummy video: the media element's automatic\n // text-track selection runs once, so on Firefox every subsequent `<track>`\n // stays inactive, its resource is never fetched, and `load` never fires —\n // stranding all cues past the first segment. Setting `mode = 'hidden'`\n // (active but not rendered — this video is never shown) loads each segment\n // on every browser.\n track.track.mode = 'hidden';\n track.src = url;\n });\n}\n\nexport function destroyVttResolver(): void {\n dummyVideo = null;\n}\n\n/**\n * A resolved VTT segment paired with its header metadata — the shape used when a caller needs the `X-TIMESTAMP-MAP`\n * correlation (e.g. non-zero-PTS sources), not just the cues.\n */\nexport interface ResolvedVttSegment {\n cues: VTTCue[];\n metadata: TextSegmentMetadata;\n}\n\n/**\n * Resolve a VTT segment's cues and header metadata together. Cues still come from the browser's native parser ({@link\n * resolveVttSegment}); the header is scraped in parallel ({@link resolveVttSegmentMetadata}).\n */\nexport function resolveVttSegmentWithMetadata(url: string): Promise<ResolvedVttSegment> {\n return Promise.all([resolveVttSegment(url), resolveVttSegmentMetadata(url)]).then(([cues, metadata]) => ({\n cues,\n metadata,\n }));\n}\n"],"mappings":";AAUA,IAAI,aAAsC;AAE1C,SAAS,mBAAqC;CAC5C,IAAI,CAAC,YAAY;EACf,aAAa,SAAS,cAAc,OAAO;EAC3C,WAAW,QAAQ;EACnB,WAAW,UAAU;EACrB,WAAW,MAAM,UAAU;EAC3B,WAAW,cAAc;CAC3B;CAEA,OAAO;AACT;AAEA,SAAgB,kBAAkB,KAAgC;CAChE,MAAM,QAAQ,iBAAiB;CAC/B,MAAM,QAAQ,SAAS,cAAc,OAAO;CAE5C,MAAM,OAAO;CAEb,OAAO,IAAI,SAAS,SAAS,WAAW;EACtC,MAAM,eAAqB;GACzB,MAAM,OAAiB,CAAC;GACxB,MAAM,YAAY,MAAM;GAExB,IAAI,UAAU,MACZ,KAAK,IAAI,IAAI,GAAG,IAAI,UAAU,KAAK,QAAQ,KAAK;IAC9C,MAAM,MAAM,UAAU,KAAK;IAE3B,IAAI,KACF,KAAK,KAAK,GAAa;GAE3B;GAGF,QAAQ;GACR,QAAQ,IAAI;EACd;EAEA,MAAM,gBAAsB;GAC1B,QAAQ;GACR,uBAAO,IAAI,MAAM,+BAA+B,KAAK,CAAC;EACxD;EAEA,MAAM,gBAAsB;GAC1B,MAAM,oBAAoB,QAAQ,MAAM;GACxC,MAAM,oBAAoB,SAAS,OAAO;GAC1C,MAAM,YAAY,KAAK;EACzB;EAEA,MAAM,iBAAiB,QAAQ,MAAM;EACrC,MAAM,iBAAiB,SAAS,OAAO;EACvC,MAAM,YAAY,KAAK;EASvB,MAAM,MAAM,OAAO;EACnB,MAAM,MAAM;CACd,CAAC;AACH;AAEA,SAAgB,qBAA2B;CACzC,aAAa;AACf"}
@@ -1,28 +1,22 @@
1
1
  import { PartiallyResolvedTextTrack, TextTrack } from "../../types/index.js";
2
2
  //#region src/media/dom/text/text-track-slots.d.ts
3
3
  /**
4
- * Allocate text-track slots on `mediaElement` for each model track by creating
5
- * and appending `<track>` children. Marks each element with `data-src-track`
6
- * so it can be distinguished from `<track>` children the host page added
7
- * directly used by `getShowingSubtitlesTrackFromMedia` and
8
- * `removeAllSubtitlesTracksFromMedia` to scope their reads/removals to
9
- * SPF-owned slots. The spec has no `removeTextTrack` API, so creating
10
- * `<track>` elements is the only mechanism for adding *and* removing entries
11
- * to `mediaElement.textTracks`.
4
+ * Allocate text-track slots on `mediaElement` for each model track by creating and appending `<track>` children. Marks
5
+ * each element with `data-src-track` so it can be distinguished from `<track>` children the host page added directly —
6
+ * used by `getShowingSubtitlesTrackFromMedia` and `removeAllSubtitlesTracksFromMedia` to scope their reads/removals to
7
+ * SPF-owned slots. The spec has no `removeTextTrack` API, so creating `<track>` elements is the only mechanism for
8
+ * adding _and_ removing entries to `mediaElement.textTracks`.
12
9
  */
13
10
  declare function addSubtitlesTracksToMedia(mediaElement: HTMLMediaElement, modelTextTracks: readonly (PartiallyResolvedTextTrack | TextTrack)[]): void;
14
11
  /**
15
- * Return the SPF-owned subtitle/caption `TextTrack` currently in `'showing'`
16
- * mode, or `undefined` if none. Restricts the search to slots created by
17
- * `addSubtitlesTracksToMedia` (via the `data-src-track` selector) so a showing
18
- * track that the host page added directly is ignored — SPF selection only
19
- * mirrors tracks it owns.
12
+ * Return the SPF-owned subtitle/caption `TextTrack` currently in `'showing'` mode, or `undefined` if none. Restricts
13
+ * the search to slots created by `addSubtitlesTracksToMedia` (via the `data-src-track` selector) so a showing track
14
+ * that the host page added directly is ignored — SPF selection only mirrors tracks it owns.
20
15
  */
21
16
  declare function getShowingSubtitlesTrackFromMedia(mediaElement: HTMLMediaElement): globalThis.TextTrack | undefined;
22
17
  /**
23
- * Remove every SPF-owned `<track>` child from `mediaElement` (those tagged
24
- * with `data-src-track` by `addSubtitlesTracksToMedia`). `<track>` elements
25
- * the host page added directly are left in place.
18
+ * Remove every SPF-owned `<track>` child from `mediaElement` (those tagged with `data-src-track` by
19
+ * `addSubtitlesTracksToMedia`). `<track>` elements the host page added directly are left in place.
26
20
  */
27
21
  declare function removeAllSubtitlesTracksFromMedia(mediaElement: HTMLMediaElement): void;
28
22
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"text-track-slots.d.ts","names":[],"sources":["../../../../../src/media/dom/text/text-track-slots.ts"],"mappings":";;;;;;;;;;;;iBAqBgB,0BACd,cAAc,kBACd,2BAA2B,6BAA6B;;;;;;;;iBA0B1C,kCAAkC,cAAc,mBAAmB,WAAW;;;;;;iBAgB9E,kCAAkC,cAAc"}
1
+ {"version":3,"file":"text-track-slots.d.ts","names":[],"sources":["../../../../../src/media/dom/text/text-track-slots.ts"],"mappings":";;;;;;;;;iBAiBgB,0BACd,cAAc,kBACd,2BAA2B,6BAA6B;;;;;;iBA2B1C,kCAAkC,cAAc,mBAAmB,WAAW;;;;;iBAe9E,kCAAkC,cAAc"}
@@ -1,20 +1,16 @@
1
1
  import { isCaptionOrSubtitleTrack } from "@videojs/utils/dom";
2
2
  //#region src/media/dom/text/text-track-slots.ts
3
3
  /**
4
- * SPF-owned `<track>` selector. Each slot created by
5
- * `addSubtitlesTracksToMedia` carries this attribute so reads and removals can
6
- * filter SPF-owned tracks from host-page-owned ones.
4
+ * SPF-owned `<track>` selector. Each slot created by `addSubtitlesTracksToMedia` carries this attribute so reads and
5
+ * removals can filter SPF-owned tracks from host-page-owned ones.
7
6
  */
8
7
  const SPF_TRACK_SELECTOR = "track[data-src-track]";
9
8
  /**
10
- * Allocate text-track slots on `mediaElement` for each model track by creating
11
- * and appending `<track>` children. Marks each element with `data-src-track`
12
- * so it can be distinguished from `<track>` children the host page added
13
- * directly used by `getShowingSubtitlesTrackFromMedia` and
14
- * `removeAllSubtitlesTracksFromMedia` to scope their reads/removals to
15
- * SPF-owned slots. The spec has no `removeTextTrack` API, so creating
16
- * `<track>` elements is the only mechanism for adding *and* removing entries
17
- * to `mediaElement.textTracks`.
9
+ * Allocate text-track slots on `mediaElement` for each model track by creating and appending `<track>` children. Marks
10
+ * each element with `data-src-track` so it can be distinguished from `<track>` children the host page added directly —
11
+ * used by `getShowingSubtitlesTrackFromMedia` and `removeAllSubtitlesTracksFromMedia` to scope their reads/removals to
12
+ * SPF-owned slots. The spec has no `removeTextTrack` API, so creating `<track>` elements is the only mechanism for
13
+ * adding _and_ removing entries to `mediaElement.textTracks`.
18
14
  */
19
15
  function addSubtitlesTracksToMedia(mediaElement, modelTextTracks) {
20
16
  for (const modelTrack of modelTextTracks) {
@@ -28,11 +24,9 @@ function addSubtitlesTracksToMedia(mediaElement, modelTextTracks) {
28
24
  }
29
25
  }
30
26
  /**
31
- * Return the SPF-owned subtitle/caption `TextTrack` currently in `'showing'`
32
- * mode, or `undefined` if none. Restricts the search to slots created by
33
- * `addSubtitlesTracksToMedia` (via the `data-src-track` selector) so a showing
34
- * track that the host page added directly is ignored — SPF selection only
35
- * mirrors tracks it owns.
27
+ * Return the SPF-owned subtitle/caption `TextTrack` currently in `'showing'` mode, or `undefined` if none. Restricts
28
+ * the search to slots created by `addSubtitlesTracksToMedia` (via the `data-src-track` selector) so a showing track
29
+ * that the host page added directly is ignored — SPF selection only mirrors tracks it owns.
36
30
  */
37
31
  function getShowingSubtitlesTrackFromMedia(mediaElement) {
38
32
  const elements = mediaElement.querySelectorAll(SPF_TRACK_SELECTOR);
@@ -42,19 +36,17 @@ function getShowingSubtitlesTrackFromMedia(mediaElement) {
42
36
  }
43
37
  }
44
38
  /**
45
- * Remove every SPF-owned `<track>` child from `mediaElement` (those tagged
46
- * with `data-src-track` by `addSubtitlesTracksToMedia`). `<track>` elements
47
- * the host page added directly are left in place.
39
+ * Remove every SPF-owned `<track>` child from `mediaElement` (those tagged with `data-src-track` by
40
+ * `addSubtitlesTracksToMedia`). `<track>` elements the host page added directly are left in place.
48
41
  */
49
42
  function removeAllSubtitlesTracksFromMedia(mediaElement) {
50
43
  const elements = mediaElement.querySelectorAll(SPF_TRACK_SELECTOR);
51
44
  for (const el of elements) el.remove();
52
45
  }
53
46
  /**
54
- * Apply a selection to a `TextTrackList` by setting each subtitle/caption
55
- * track's `mode` to `'showing'` if its `id` matches `selectedId` and
56
- * `'disabled'` otherwise. Tracks of other kinds (chapters, metadata,
57
- * descriptions) are left untouched — they may be owned by the host page.
47
+ * Apply a selection to a `TextTrackList` by setting each subtitle/caption track's `mode` to `'showing'` if its `id`
48
+ * matches `selectedId` and `'disabled'` otherwise. Tracks of other kinds (chapters, metadata, descriptions) are left
49
+ * untouched they may be owned by the host page.
58
50
  */
59
51
  function syncTextTrackModes(textTracks, selectedId) {
60
52
  for (let i = 0; i < textTracks.length; i++) {
@@ -1 +1 @@
1
- {"version":3,"file":"text-track-slots.js","names":[],"sources":["../../../../../src/media/dom/text/text-track-slots.ts"],"sourcesContent":["import { isCaptionOrSubtitleTrack } from '@videojs/utils/dom';\n\nimport type { PartiallyResolvedTextTrack, TextTrack } from '../../types';\n\n/**\n * SPF-owned `<track>` selector. Each slot created by\n * `addSubtitlesTracksToMedia` carries this attribute so reads and removals can\n * filter SPF-owned tracks from host-page-owned ones.\n */\nconst SPF_TRACK_SELECTOR = 'track[data-src-track]';\n\n/**\n * Allocate text-track slots on `mediaElement` for each model track by creating\n * and appending `<track>` children. Marks each element with `data-src-track`\n * so it can be distinguished from `<track>` children the host page added\n * directly — used by `getShowingSubtitlesTrackFromMedia` and\n * `removeAllSubtitlesTracksFromMedia` to scope their reads/removals to\n * SPF-owned slots. The spec has no `removeTextTrack` API, so creating\n * `<track>` elements is the only mechanism for adding *and* removing entries\n * to `mediaElement.textTracks`.\n */\nexport function addSubtitlesTracksToMedia(\n mediaElement: HTMLMediaElement,\n modelTextTracks: readonly (PartiallyResolvedTextTrack | TextTrack)[]\n): void {\n for (const modelTrack of modelTextTracks) {\n const el = document.createElement('track');\n el.id = modelTrack.id;\n el.kind = modelTrack.kind;\n el.label = modelTrack.label;\n el.toggleAttribute('data-src-track', true);\n if (modelTrack.language) el.srclang = modelTrack.language;\n // Deliberately NOT propagating `modelTrack.default` to the `default`\n // attribute: that makes the browser auto-activate the slot on insertion,\n // which fires a `change` that `syncTextTracks` records as user intent —\n // auto-enabling captions past SPF's opt-in policy (`enableDefaultTrack`\n // governs DEFAULT=YES handling in `switchTextTrack`, not the browser). SPF\n // owns selection; these slots are containers, so they carry no selection hint.\n mediaElement.appendChild(el);\n }\n}\n\n/**\n * Return the SPF-owned subtitle/caption `TextTrack` currently in `'showing'`\n * mode, or `undefined` if none. Restricts the search to slots created by\n * `addSubtitlesTracksToMedia` (via the `data-src-track` selector) so a showing\n * track that the host page added directly is ignored — SPF selection only\n * mirrors tracks it owns.\n */\nexport function getShowingSubtitlesTrackFromMedia(mediaElement: HTMLMediaElement): globalThis.TextTrack | undefined {\n const elements = mediaElement.querySelectorAll<HTMLTrackElement>(SPF_TRACK_SELECTOR);\n for (const el of elements) {\n const track = el.track;\n if (track.mode === 'showing' && isCaptionOrSubtitleTrack(track)) {\n return track;\n }\n }\n return undefined;\n}\n\n/**\n * Remove every SPF-owned `<track>` child from `mediaElement` (those tagged\n * with `data-src-track` by `addSubtitlesTracksToMedia`). `<track>` elements\n * the host page added directly are left in place.\n */\nexport function removeAllSubtitlesTracksFromMedia(mediaElement: HTMLMediaElement): void {\n const elements = mediaElement.querySelectorAll<HTMLTrackElement>(SPF_TRACK_SELECTOR);\n for (const el of elements) {\n el.remove();\n }\n}\n\n/**\n * Apply a selection to a `TextTrackList` by setting each subtitle/caption\n * track's `mode` to `'showing'` if its `id` matches `selectedId` and\n * `'disabled'` otherwise. Tracks of other kinds (chapters, metadata,\n * descriptions) are left untouched — they may be owned by the host page.\n */\nexport function syncTextTrackModes(textTracks: TextTrackList, selectedId: string | undefined): void {\n for (let i = 0; i < textTracks.length; i++) {\n const track = textTracks[i]!;\n if (!isCaptionOrSubtitleTrack(track)) continue;\n track.mode = track.id === selectedId ? 'showing' : 'disabled';\n }\n}\n"],"mappings":";;;;;;;AASA,MAAM,qBAAqB;;;;;;;;;;;AAY3B,SAAgB,0BACd,cACA,iBACM;CACN,KAAK,MAAM,cAAc,iBAAiB;EACxC,MAAM,KAAK,SAAS,cAAc,OAAO;EACzC,GAAG,KAAK,WAAW;EACnB,GAAG,OAAO,WAAW;EACrB,GAAG,QAAQ,WAAW;EACtB,GAAG,gBAAgB,kBAAkB,IAAI;EACzC,IAAI,WAAW,UAAU,GAAG,UAAU,WAAW;EAOjD,aAAa,YAAY,EAAE;CAC7B;AACF;;;;;;;;AASA,SAAgB,kCAAkC,cAAkE;CAClH,MAAM,WAAW,aAAa,iBAAmC,kBAAkB;CACnF,KAAK,MAAM,MAAM,UAAU;EACzB,MAAM,QAAQ,GAAG;EACjB,IAAI,MAAM,SAAS,aAAa,yBAAyB,KAAK,GAC5D,OAAO;CAEX;AAEF;;;;;;AAOA,SAAgB,kCAAkC,cAAsC;CACtF,MAAM,WAAW,aAAa,iBAAmC,kBAAkB;CACnF,KAAK,MAAM,MAAM,UACf,GAAG,OAAO;AAEd;;;;;;;AAQA,SAAgB,mBAAmB,YAA2B,YAAsC;CAClG,KAAK,IAAI,IAAI,GAAG,IAAI,WAAW,QAAQ,KAAK;EAC1C,MAAM,QAAQ,WAAW;EACzB,IAAI,CAAC,yBAAyB,KAAK,GAAG;EACtC,MAAM,OAAO,MAAM,OAAO,aAAa,YAAY;CACrD;AACF"}
1
+ {"version":3,"file":"text-track-slots.js","names":[],"sources":["../../../../../src/media/dom/text/text-track-slots.ts"],"sourcesContent":["import { isCaptionOrSubtitleTrack } from '@videojs/utils/dom';\n\nimport type { PartiallyResolvedTextTrack, TextTrack } from '../../types';\n\n/**\n * SPF-owned `<track>` selector. Each slot created by `addSubtitlesTracksToMedia` carries this attribute so reads and\n * removals can filter SPF-owned tracks from host-page-owned ones.\n */\nconst SPF_TRACK_SELECTOR = 'track[data-src-track]';\n\n/**\n * Allocate text-track slots on `mediaElement` for each model track by creating and appending `<track>` children. Marks\n * each element with `data-src-track` so it can be distinguished from `<track>` children the host page added directly —\n * used by `getShowingSubtitlesTrackFromMedia` and `removeAllSubtitlesTracksFromMedia` to scope their reads/removals to\n * SPF-owned slots. The spec has no `removeTextTrack` API, so creating `<track>` elements is the only mechanism for\n * adding _and_ removing entries to `mediaElement.textTracks`.\n */\nexport function addSubtitlesTracksToMedia(\n mediaElement: HTMLMediaElement,\n modelTextTracks: readonly (PartiallyResolvedTextTrack | TextTrack)[]\n): void {\n for (const modelTrack of modelTextTracks) {\n const el = document.createElement('track');\n\n el.id = modelTrack.id;\n el.kind = modelTrack.kind;\n el.label = modelTrack.label;\n el.toggleAttribute('data-src-track', true);\n\n if (modelTrack.language) el.srclang = modelTrack.language;\n\n // Deliberately NOT propagating `modelTrack.default` to the `default`\n // attribute: that makes the browser auto-activate the slot on insertion,\n // which fires a `change` that `syncTextTracks` records as user intent —\n // auto-enabling captions past SPF's opt-in policy (`enableDefaultTrack`\n // governs DEFAULT=YES handling in `switchTextTrack`, not the browser). SPF\n // owns selection; these slots are containers, so they carry no selection hint.\n mediaElement.appendChild(el);\n }\n}\n\n/**\n * Return the SPF-owned subtitle/caption `TextTrack` currently in `'showing'` mode, or `undefined` if none. Restricts\n * the search to slots created by `addSubtitlesTracksToMedia` (via the `data-src-track` selector) so a showing track\n * that the host page added directly is ignored — SPF selection only mirrors tracks it owns.\n */\nexport function getShowingSubtitlesTrackFromMedia(mediaElement: HTMLMediaElement): globalThis.TextTrack | undefined {\n const elements = mediaElement.querySelectorAll<HTMLTrackElement>(SPF_TRACK_SELECTOR);\n\n for (const el of elements) {\n const track = el.track;\n if (track.mode === 'showing' && isCaptionOrSubtitleTrack(track)) return track;\n }\n\n return undefined;\n}\n\n/**\n * Remove every SPF-owned `<track>` child from `mediaElement` (those tagged with `data-src-track` by\n * `addSubtitlesTracksToMedia`). `<track>` elements the host page added directly are left in place.\n */\nexport function removeAllSubtitlesTracksFromMedia(mediaElement: HTMLMediaElement): void {\n const elements = mediaElement.querySelectorAll<HTMLTrackElement>(SPF_TRACK_SELECTOR);\n\n for (const el of elements) {\n el.remove();\n }\n}\n\n/**\n * Apply a selection to a `TextTrackList` by setting each subtitle/caption track's `mode` to `'showing'` if its `id`\n * matches `selectedId` and `'disabled'` otherwise. Tracks of other kinds (chapters, metadata, descriptions) are left\n * untouched — they may be owned by the host page.\n */\nexport function syncTextTrackModes(textTracks: TextTrackList, selectedId: string | undefined): void {\n for (let i = 0; i < textTracks.length; i++) {\n const track = textTracks[i]!;\n if (!isCaptionOrSubtitleTrack(track)) continue;\n\n track.mode = track.id === selectedId ? 'showing' : 'disabled';\n }\n}\n"],"mappings":";;;;;;AAQA,MAAM,qBAAqB;;;;;;;;AAS3B,SAAgB,0BACd,cACA,iBACM;CACN,KAAK,MAAM,cAAc,iBAAiB;EACxC,MAAM,KAAK,SAAS,cAAc,OAAO;EAEzC,GAAG,KAAK,WAAW;EACnB,GAAG,OAAO,WAAW;EACrB,GAAG,QAAQ,WAAW;EACtB,GAAG,gBAAgB,kBAAkB,IAAI;EAEzC,IAAI,WAAW,UAAU,GAAG,UAAU,WAAW;EAQjD,aAAa,YAAY,EAAE;CAC7B;AACF;;;;;;AAOA,SAAgB,kCAAkC,cAAkE;CAClH,MAAM,WAAW,aAAa,iBAAmC,kBAAkB;CAEnF,KAAK,MAAM,MAAM,UAAU;EACzB,MAAM,QAAQ,GAAG;EACjB,IAAI,MAAM,SAAS,aAAa,yBAAyB,KAAK,GAAG,OAAO;CAC1E;AAGF;;;;;AAMA,SAAgB,kCAAkC,cAAsC;CACtF,MAAM,WAAW,aAAa,iBAAmC,kBAAkB;CAEnF,KAAK,MAAM,MAAM,UACf,GAAG,OAAO;AAEd;;;;;;AAOA,SAAgB,mBAAmB,YAA2B,YAAsC;CAClG,KAAK,IAAI,IAAI,GAAG,IAAI,WAAW,QAAQ,KAAK;EAC1C,MAAM,QAAQ,WAAW;EACzB,IAAI,CAAC,yBAAyB,KAAK,GAAG;EAEtC,MAAM,OAAO,MAAM,OAAO,aAAa,YAAY;CACrD;AACF"}
@@ -1,37 +1,29 @@
1
1
  //#region src/media/errors.d.ts
2
2
  /**
3
- * SVTA 2070 (Standardized Error Codes) — the vocabulary for identifying a
4
- * playback failure or notice, independent of how it's transported or who
5
- * decides what to do about it.
3
+ * SVTA 2070 (Standardized Error Codes) — the vocabulary for identifying a playback failure or notice, independent of
4
+ * how it's transported or who decides what to do about it.
6
5
  *
7
- * A code is a single integer: the leading digit(s) are the **category** (the
8
- * error's domain) and the trailing three are the **index** (the specific error
9
- * within it). Four digits for natively-defined errors, five when an external
10
- * standard is embedded `"03404"` is an HTTP 404 under the network category.
11
- * Categories are `0` unknown, `1` media content, `2` playback, `3` network,
12
- * `4` content protection, `5` accessibility, `6` remote play, `7` advertising,
13
- * `99` custom.
6
+ * A code is a single integer: the leading digit(s) are the **category** (the error's domain) and the trailing three are
7
+ * the **index** (the specific error within it). Four digits for natively-defined errors, five when an external standard
8
+ * is embedded — `"03404"` is an HTTP 404 under the network category. Categories are `0` unknown, `1` media content, `2`
9
+ * playback, `3` network, `4` content protection, `5` accessibility, `6` remote play, `7` advertising, `99` custom.
14
10
  *
15
11
  * Two properties of the spec shape the types here:
16
12
  *
17
- * - **Severity is deliberately not part of a code.** Per §Approach, "impact
18
- * varies with player implementation, breaking the consistency of a specific
19
- * error mapping to single code." So an error carries no fatal flag — whether a
20
- * condition is fatal depends on the composition observing it, and is decided
21
- * downstream.
22
- * - **Reporting is partial and stacked** (Principles 5–6). Errors are reported
23
- * as encountered, most of them non-fatal, and the *sequence* carries causation
24
- * a single value can't.
13
+ * - **Severity is deliberately not part of a code.** Per §Approach, "impact varies with player implementation, breaking
14
+ * the consistency of a specific error mapping to single code." So an error carries no fatal flag — whether a
15
+ * condition is fatal depends on the composition observing it, and is decided downstream.
16
+ * - **Reporting is partial and stacked** (Principles 5–6). Errors are reported as encountered, most of them non-fatal,
17
+ * and the _sequence_ carries causation a single value can't.
25
18
  *
26
19
  * See `internal/design/spf/features/errors.md`.
27
20
  */
28
21
  /**
29
22
  * A reported condition, identified by its SVTA code.
30
23
  *
31
- * Named for the spec rather than the engine because the vocabulary is
32
- * format- and player-neutral. Not `MediaError` that name belongs to the
33
- * `@videojs/media` DOM-facing class this eventually maps *onto*, and the mapping
34
- * is the point at which severity and user-facing text get decided.
24
+ * Named for the spec rather than the engine because the vocabulary is format- and player-neutral. Not `MediaError` —
25
+ * that name belongs to the `@videojs/media` DOM-facing class this eventually maps _onto_, and the mapping is the point
26
+ * at which severity and user-facing text get decided.
35
27
  */
36
28
  interface SvtaError {
37
29
  /** The SVTA code — see {@link svtaCategory} / {@link svtaIndex}. */
@@ -42,39 +34,33 @@ interface SvtaError {
42
34
  data?: unknown;
43
35
  }
44
36
  /**
45
- * SVTA 99 [Custom] 001 — this engine has no pipeline for something the source
46
- * requires, so the source is unplayable *here* rather than broken.
37
+ * SVTA 99 [Custom] 001 — this engine has no pipeline for something the source requires, so the source is unplayable
38
+ * _here_ rather than broken.
47
39
  *
48
- * Custom rather than standard because the standard codes available describe
49
- * either narrower or wider things. The causes (1004/1005 unsupported format,
50
- * 4008 unsupported DRM) say what one rendition hit; the verdicts (2011/2012 no
51
- * supported track) say a type emptied without saying why it's unfixable. And
52
- * 2039 "Manifest feature unsupported" covers features that are unsupported but
53
- * still *playable* — LL-HLS degrading to standard live is a 2039 — so
54
- * overloading it for a fatal condition would make it useless for the notices it
55
- * belongs on.
40
+ * Custom rather than standard because the standard codes available describe either narrower or wider things. The causes
41
+ * (1004/1005 unsupported format, 4008 unsupported DRM) say what one rendition hit; the verdicts (2011/2012 no supported
42
+ * track) say a type emptied without saying why it's unfixable. And 2039 "Manifest feature unsupported" covers features
43
+ * that are unsupported but still _playable_ — LL-HLS degrading to standard live is a 2039 so overloading it for a
44
+ * fatal condition would make it useless for the notices it belongs on.
56
45
  *
57
- * Index `001`: the spec defines only `99000` (Unknown) for the custom category
58
- * and leaves the rest to the publisher, so this is the first code we define.
46
+ * Index `001`: the spec defines only `99000` (Unknown) for the custom category and leaves the rest to the publisher, so
47
+ * this is the first code we define.
59
48
  *
60
- * Five digits, and deliberately not special-cased anywhere: {@link svtaCategory}
61
- * and {@link svtaIndex} decompose it correctly by arithmetic alone, because
62
- * every standard category is below `8000` and custom starts at `99000`.
49
+ * Five digits, and deliberately not special-cased anywhere: {@link svtaCategory} and {@link svtaIndex} decompose it
50
+ * correctly by arithmetic alone, because every standard category is below `8000` and custom starts at `99000`.
63
51
  */
64
52
  declare const SVTA_UNSUPPORTED_PLAYBACK_FEATURE = 99001;
65
53
  /**
66
- * The error's domain — `code / 1000`, per the spec's "divide by one thousand to
67
- * obtain the error category". Works uniformly across the four-digit native form
68
- * and the five-digit form embedding an external standard: `"03404"` is
69
- * numerically 3404, which decomposes identically. That also makes a numeric code
70
- * immune to the spec's inconsistent zero-padding (§Approach writes a
71
- * category-unknown network error as `"0300"` where the error index implies
72
- * category 3 / index 000).
54
+ * The error's domain — `code / 1000`, per the spec's "divide by one thousand to obtain the error category". Works
55
+ * uniformly across the four-digit native form and the five-digit form embedding an external standard: `"03404"` is
56
+ * numerically 3404, which decomposes identically. That also makes a numeric code immune to the spec's inconsistent
57
+ * zero-padding (§Approach writes a category-unknown network error as `"0300"` where the error index implies category 3
58
+ * / index 000).
73
59
  */
74
60
  declare function svtaCategory(code: number): number;
75
61
  /**
76
- * The specific error within its category — `code % 1000`. For a five-digit code
77
- * this is the embedded external value (an HTTP status, a VAST code).
62
+ * The specific error within its category — `code % 1000`. For a five-digit code this is the embedded external value (an
63
+ * HTTP status, a VAST code).
78
64
  */
79
65
  declare function svtaIndex(code: number): number;
80
66
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","names":[],"sources":["../../../src/media/errors.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAmCiB;;EAEf;;EAEA;;EAEA;;;;;;;;;;;;;;;;;;;;;;cAoDW;;;;;;;;;;iBAWG,aAAa;;;;;iBAQb,UAAU"}
1
+ {"version":3,"file":"errors.d.ts","names":[],"sources":["../../../src/media/errors.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;UA2BiB;;EAEf;;EAEA;;EAEA;;;;;;;;;;;;;;;;;;cA6CW;;;;;;;;iBASG,aAAa;;;;;iBAQb,UAAU"}
@@ -4,61 +4,52 @@ const SVTA_UNSUPPORTED_VIDEO_FORMAT = 1004;
4
4
  /** SVTA 1 [Media Content] 005 — the audio counterpart of {@link SVTA_UNSUPPORTED_VIDEO_FORMAT}. */
5
5
  const SVTA_UNSUPPORTED_AUDIO_FORMAT = 1005;
6
6
  /**
7
- * SVTA 4 [Content Protection] 008 — unsupported or unavailable DRM system. Used
8
- * for "this source is encrypted and we have no decryption pipeline," which is
9
- * detection, not a license failure.
7
+ * SVTA 4 [Content Protection] 008 — unsupported or unavailable DRM system. Used for "this source is encrypted and we
8
+ * have no decryption pipeline," which is detection, not a license failure.
10
9
  */
11
10
  const SVTA_UNSUPPORTED_DRM_SYSTEM = 4008;
12
11
  /**
13
12
  * SVTA 2 [Playback] 011 — no video track the environment can play.
14
13
  *
15
- * Covers both ways a composition can end up with nothing to select: renditions
16
- * that existed and were all excluded as unplayable, and where the composition
17
- * composes `reportAbsentTrackType` to say it needs the type a source carrying
18
- * none to begin with. Deliberately one code for both, because they are the same
19
- * answer to a viewer, and because the alternative is a code the SVTA spec doesn't
20
- * define. Whether an absent type is a failure is the composition's to state,
21
- * which is why it opts in rather than being read off the source.
14
+ * Covers both ways a composition can end up with nothing to select: renditions that existed and were all excluded as
15
+ * unplayable, and where the composition composes `reportAbsentTrackType` to say it needs the type — a source carrying
16
+ * none to begin with. Deliberately one code for both, because they are the same answer to a viewer, and because the
17
+ * alternative is a code the SVTA spec doesn't define. Whether an absent type is a failure is the composition's to
18
+ * state, which is why it opts in rather than being read off the source.
22
19
  */
23
20
  const SVTA_NO_SUPPORTED_VIDEO_TRACK = 2011;
24
21
  /** SVTA 2 [Playback] 012 — the audio counterpart of {@link SVTA_NO_SUPPORTED_VIDEO_TRACK}. */
25
22
  const SVTA_NO_SUPPORTED_AUDIO_TRACK = 2012;
26
23
  /**
27
- * SVTA 99 [Custom] 001 — this engine has no pipeline for something the source
28
- * requires, so the source is unplayable *here* rather than broken.
24
+ * SVTA 99 [Custom] 001 — this engine has no pipeline for something the source requires, so the source is unplayable
25
+ * _here_ rather than broken.
29
26
  *
30
- * Custom rather than standard because the standard codes available describe
31
- * either narrower or wider things. The causes (1004/1005 unsupported format,
32
- * 4008 unsupported DRM) say what one rendition hit; the verdicts (2011/2012 no
33
- * supported track) say a type emptied without saying why it's unfixable. And
34
- * 2039 "Manifest feature unsupported" covers features that are unsupported but
35
- * still *playable* — LL-HLS degrading to standard live is a 2039 — so
36
- * overloading it for a fatal condition would make it useless for the notices it
37
- * belongs on.
27
+ * Custom rather than standard because the standard codes available describe either narrower or wider things. The causes
28
+ * (1004/1005 unsupported format, 4008 unsupported DRM) say what one rendition hit; the verdicts (2011/2012 no supported
29
+ * track) say a type emptied without saying why it's unfixable. And 2039 "Manifest feature unsupported" covers features
30
+ * that are unsupported but still _playable_ — LL-HLS degrading to standard live is a 2039 so overloading it for a
31
+ * fatal condition would make it useless for the notices it belongs on.
38
32
  *
39
- * Index `001`: the spec defines only `99000` (Unknown) for the custom category
40
- * and leaves the rest to the publisher, so this is the first code we define.
33
+ * Index `001`: the spec defines only `99000` (Unknown) for the custom category and leaves the rest to the publisher, so
34
+ * this is the first code we define.
41
35
  *
42
- * Five digits, and deliberately not special-cased anywhere: {@link svtaCategory}
43
- * and {@link svtaIndex} decompose it correctly by arithmetic alone, because
44
- * every standard category is below `8000` and custom starts at `99000`.
36
+ * Five digits, and deliberately not special-cased anywhere: {@link svtaCategory} and {@link svtaIndex} decompose it
37
+ * correctly by arithmetic alone, because every standard category is below `8000` and custom starts at `99000`.
45
38
  */
46
39
  const SVTA_UNSUPPORTED_PLAYBACK_FEATURE = 99001;
47
40
  /**
48
- * The error's domain — `code / 1000`, per the spec's "divide by one thousand to
49
- * obtain the error category". Works uniformly across the four-digit native form
50
- * and the five-digit form embedding an external standard: `"03404"` is
51
- * numerically 3404, which decomposes identically. That also makes a numeric code
52
- * immune to the spec's inconsistent zero-padding (§Approach writes a
53
- * category-unknown network error as `"0300"` where the error index implies
54
- * category 3 / index 000).
41
+ * The error's domain — `code / 1000`, per the spec's "divide by one thousand to obtain the error category". Works
42
+ * uniformly across the four-digit native form and the five-digit form embedding an external standard: `"03404"` is
43
+ * numerically 3404, which decomposes identically. That also makes a numeric code immune to the spec's inconsistent
44
+ * zero-padding (§Approach writes a category-unknown network error as `"0300"` where the error index implies category 3
45
+ * / index 000).
55
46
  */
56
47
  function svtaCategory(code) {
57
48
  return Math.floor(code / 1e3);
58
49
  }
59
50
  /**
60
- * The specific error within its category — `code % 1000`. For a five-digit code
61
- * this is the embedded external value (an HTTP status, a VAST code).
51
+ * The specific error within its category — `code % 1000`. For a five-digit code this is the embedded external value (an
52
+ * HTTP status, a VAST code).
62
53
  */
63
54
  function svtaIndex(code) {
64
55
  return code % 1e3;