mattebox 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (335) hide show
  1. package/dist/cdn/mattebox.dash-drm.min.js +3 -3
  2. package/dist/cdn/mattebox.dash.min.js +3 -3
  3. package/dist/cdn/mattebox.dual-drm.min.js +3 -3
  4. package/dist/cdn/mattebox.dual-ts-drm.min.js +3 -3
  5. package/dist/cdn/mattebox.dual-ts.min.js +3 -3
  6. package/dist/cdn/mattebox.dual.min.js +3 -3
  7. package/dist/cdn/mattebox.hls-drm.min.js +3 -3
  8. package/dist/cdn/mattebox.hls-ts-drm.min.js +3 -3
  9. package/dist/cdn/mattebox.hls-ts.min.js +3 -3
  10. package/dist/cdn/mattebox.hls.min.js +3 -3
  11. package/dist/cdn/mattebox.kernel.min.js +1 -1
  12. package/dist/cdn/mattebox.min.js +3 -6
  13. package/dist/containers/adts.d.ts +10 -0
  14. package/dist/containers/adts.d.ts.map +1 -1
  15. package/dist/containers/adts.js +27 -7
  16. package/dist/containers/adts.js.map +1 -1
  17. package/dist/containers/codec-probe/index.d.ts +0 -6
  18. package/dist/containers/codec-probe/index.d.ts.map +1 -1
  19. package/dist/containers/codec-probe/index.js +14 -23
  20. package/dist/containers/codec-probe/index.js.map +1 -1
  21. package/dist/containers/fmp4/fit.d.ts +26 -0
  22. package/dist/containers/fmp4/fit.d.ts.map +1 -0
  23. package/dist/containers/fmp4/fit.js +49 -0
  24. package/dist/containers/fmp4/fit.js.map +1 -0
  25. package/dist/containers/fmp4/writer.d.ts +7 -0
  26. package/dist/containers/fmp4/writer.d.ts.map +1 -1
  27. package/dist/containers/fmp4/writer.js +9 -1
  28. package/dist/containers/fmp4/writer.js.map +1 -1
  29. package/dist/containers/id3.d.ts.map +1 -1
  30. package/dist/containers/id3.js +2 -1
  31. package/dist/containers/id3.js.map +1 -1
  32. package/dist/containers/mp4-box/index.d.ts +75 -7
  33. package/dist/containers/mp4-box/index.d.ts.map +1 -1
  34. package/dist/containers/mp4-box/index.js +225 -49
  35. package/dist/containers/mp4-box/index.js.map +1 -1
  36. package/dist/containers/packed-audio/index.d.ts.map +1 -1
  37. package/dist/containers/packed-audio/index.js +9 -27
  38. package/dist/containers/packed-audio/index.js.map +1 -1
  39. package/dist/containers/sei.d.ts +5 -0
  40. package/dist/containers/sei.d.ts.map +1 -1
  41. package/dist/containers/sei.js +5 -2
  42. package/dist/containers/sei.js.map +1 -1
  43. package/dist/containers/ts-transmux/demux.d.ts +7 -1
  44. package/dist/containers/ts-transmux/demux.d.ts.map +1 -1
  45. package/dist/containers/ts-transmux/demux.js +38 -17
  46. package/dist/containers/ts-transmux/demux.js.map +1 -1
  47. package/dist/containers/ts-transmux/h264.d.ts.map +1 -1
  48. package/dist/containers/ts-transmux/h264.js +1 -17
  49. package/dist/containers/ts-transmux/h264.js.map +1 -1
  50. package/dist/containers/ts-transmux/index.d.ts.map +1 -1
  51. package/dist/containers/ts-transmux/index.js +11 -2
  52. package/dist/containers/ts-transmux/index.js.map +1 -1
  53. package/dist/containers/ts-transmux/transmux.d.ts.map +1 -1
  54. package/dist/containers/ts-transmux/transmux.js +6 -36
  55. package/dist/containers/ts-transmux/transmux.js.map +1 -1
  56. package/dist/{stages/text-webvtt/parse.d.ts → containers/webvtt.d.ts} +4 -3
  57. package/dist/containers/webvtt.d.ts.map +1 -0
  58. package/dist/{stages/text-webvtt/parse.js → containers/webvtt.js} +1 -1
  59. package/dist/containers/webvtt.js.map +1 -0
  60. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.149.0 → _@oxc-project_runtime@0.150.0}/helpers/esm/asyncToGenerator.js +1 -1
  61. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.149.0 → _@oxc-project_runtime@0.150.0}/helpers/esm/defineProperty.js +1 -1
  62. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.149.0 → _@oxc-project_runtime@0.150.0}/helpers/esm/objectSpread2.js +1 -1
  63. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.149.0 → _@oxc-project_runtime@0.150.0}/helpers/esm/objectWithoutProperties.js +1 -1
  64. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.149.0 → _@oxc-project_runtime@0.150.0}/helpers/esm/objectWithoutPropertiesLoose.js +1 -1
  65. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.149.0 → _@oxc-project_runtime@0.150.0}/helpers/esm/toPrimitive.js +1 -1
  66. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.149.0 → _@oxc-project_runtime@0.150.0}/helpers/esm/toPropertyKey.js +1 -1
  67. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.149.0 → _@oxc-project_runtime@0.150.0}/helpers/esm/typeof.js +1 -1
  68. package/dist/es2015/containers/adts.js +28 -8
  69. package/dist/es2015/containers/codec-probe/index.js +17 -26
  70. package/dist/es2015/containers/fmp4/fit.js +46 -0
  71. package/dist/es2015/containers/fmp4/writer.js +9 -1
  72. package/dist/es2015/containers/id3.js +3 -3
  73. package/dist/es2015/containers/mp4-box/index.js +224 -39
  74. package/dist/es2015/containers/packed-audio/index.js +6 -33
  75. package/dist/es2015/containers/sei.js +6 -3
  76. package/dist/es2015/containers/ts-transmux/demux.js +41 -22
  77. package/dist/es2015/containers/ts-transmux/h264.js +2 -18
  78. package/dist/es2015/containers/ts-transmux/index.js +9 -9
  79. package/dist/es2015/containers/ts-transmux/transmux.js +8 -39
  80. package/dist/es2015/{stages/text-webvtt/parse.js → containers/webvtt.js} +2 -2
  81. package/dist/es2015/index.js +40 -42
  82. package/dist/es2015/kernel/append-queue.js +1 -1
  83. package/dist/es2015/kernel/base64.js +25 -0
  84. package/dist/es2015/kernel/context.js +7 -0
  85. package/dist/es2015/kernel/effects.js +21 -1
  86. package/dist/es2015/kernel/loader.js +5 -4
  87. package/dist/es2015/kernel/mime.js +5 -1
  88. package/dist/es2015/kernel/mse.js +27 -71
  89. package/dist/es2015/kernel/prepare.js +77 -0
  90. package/dist/es2015/kernel/presentation.js +24 -0
  91. package/dist/es2015/kernel/reducer.js +279 -124
  92. package/dist/es2015/kernel/refresh.js +35 -0
  93. package/dist/es2015/kernel/rendition-select.js +109 -4
  94. package/dist/es2015/kernel/scheduler.js +23 -5
  95. package/dist/es2015/kernel/sinks/text-track-sink.js +27 -26
  96. package/dist/es2015/kernel/timeline.js +22 -1
  97. package/dist/es2015/kernel/trace.js +1 -1
  98. package/dist/es2015/kernel/track-registry.js +10 -2
  99. package/dist/es2015/kernel/transport.js +4 -4
  100. package/dist/es2015/kernel/url.js +12 -0
  101. package/dist/es2015/presets/define.js +2 -2
  102. package/dist/es2015/presets/full/index.js +9 -3
  103. package/dist/es2015/presets/tiers.js +7 -6
  104. package/dist/es2015/protocols/adapter-shared.js +28 -0
  105. package/dist/es2015/protocols/dash-cmaf/index.js +132 -88
  106. package/dist/es2015/protocols/dash-cmaf/parse.js +62 -64
  107. package/dist/es2015/protocols/dash-live/index.js +62 -37
  108. package/dist/es2015/protocols/dimensions.js +15 -0
  109. package/dist/es2015/protocols/hls-cmaf/index.js +108 -95
  110. package/dist/es2015/protocols/hls-cmaf/lexer.js +3 -0
  111. package/dist/es2015/protocols/hls-cmaf/parse.js +167 -56
  112. package/dist/es2015/protocols/hls-cmaf/unavailable.js +43 -0
  113. package/dist/es2015/protocols/hls-live/index.js +187 -109
  114. package/dist/es2015/stages/abr/index.js +8 -11
  115. package/dist/es2015/stages/abr-persist/index.js +18 -11
  116. package/dist/es2015/stages/aes-128/index.js +15 -8
  117. package/dist/es2015/stages/alt-audio/index.js +25 -13
  118. package/dist/es2015/stages/chapters/index.js +151 -0
  119. package/dist/es2015/stages/chapters/parse.js +149 -0
  120. package/dist/es2015/stages/cmaf-timing/index.js +24 -39
  121. package/dist/es2015/stages/cmcd/index.js +29 -6
  122. package/dist/es2015/stages/codec-switch/index.js +2 -5
  123. package/dist/es2015/stages/content-steering/index.js +13 -16
  124. package/dist/es2015/stages/eme-cenc/index.js +10 -4
  125. package/dist/es2015/stages/eme-core/index.js +31 -13
  126. package/dist/es2015/stages/eme-fairplay/index.js +12 -8
  127. package/dist/es2015/stages/nal-scan/index.js +30 -140
  128. package/dist/es2015/stages/recovery/index.js +47 -54
  129. package/dist/es2015/stages/text-cea608/decode.js +1 -1
  130. package/dist/es2015/stages/text-cea608/index.js +3 -17
  131. package/dist/es2015/stages/text-webvtt/index.js +1 -1
  132. package/dist/es2015/stages/text-webvtt-segmented/index.js +15 -8
  133. package/dist/es2015/stages/thumbnails/index.js +213 -43
  134. package/dist/es2015/stages/trick-play/index.js +463 -0
  135. package/dist/index.d.ts +6 -0
  136. package/dist/index.d.ts.map +1 -1
  137. package/dist/index.js +36 -53
  138. package/dist/index.js.map +1 -1
  139. package/dist/kernel/base64.d.ts +9 -0
  140. package/dist/kernel/base64.d.ts.map +1 -0
  141. package/dist/kernel/base64.js +26 -0
  142. package/dist/kernel/base64.js.map +1 -0
  143. package/dist/kernel/context.d.ts +5 -1
  144. package/dist/kernel/context.d.ts.map +1 -1
  145. package/dist/kernel/context.js +10 -0
  146. package/dist/kernel/context.js.map +1 -1
  147. package/dist/kernel/effects.d.ts +9 -1
  148. package/dist/kernel/effects.d.ts.map +1 -1
  149. package/dist/kernel/effects.js +12 -0
  150. package/dist/kernel/effects.js.map +1 -1
  151. package/dist/kernel/lifecycle.js +1 -1
  152. package/dist/kernel/lifecycle.js.map +1 -1
  153. package/dist/kernel/loader.d.ts.map +1 -1
  154. package/dist/kernel/loader.js +5 -7
  155. package/dist/kernel/loader.js.map +1 -1
  156. package/dist/kernel/mime.d.ts +2 -0
  157. package/dist/kernel/mime.d.ts.map +1 -1
  158. package/dist/kernel/mime.js +4 -0
  159. package/dist/kernel/mime.js.map +1 -1
  160. package/dist/kernel/mse.d.ts +6 -10
  161. package/dist/kernel/mse.d.ts.map +1 -1
  162. package/dist/kernel/mse.js +20 -73
  163. package/dist/kernel/mse.js.map +1 -1
  164. package/dist/kernel/prepare.d.ts +28 -0
  165. package/dist/kernel/prepare.d.ts.map +1 -0
  166. package/dist/kernel/prepare.js +89 -0
  167. package/dist/kernel/prepare.js.map +1 -0
  168. package/dist/kernel/presentation.d.ts +20 -0
  169. package/dist/kernel/presentation.d.ts.map +1 -0
  170. package/dist/kernel/presentation.js +25 -0
  171. package/dist/kernel/presentation.js.map +1 -0
  172. package/dist/kernel/reducer.d.ts +24 -0
  173. package/dist/kernel/reducer.d.ts.map +1 -1
  174. package/dist/kernel/reducer.js +375 -152
  175. package/dist/kernel/reducer.js.map +1 -1
  176. package/dist/kernel/refresh.d.ts +14 -0
  177. package/dist/kernel/refresh.d.ts.map +1 -0
  178. package/dist/kernel/refresh.js +51 -0
  179. package/dist/kernel/refresh.js.map +1 -0
  180. package/dist/kernel/rendition-select.d.ts +38 -5
  181. package/dist/kernel/rendition-select.d.ts.map +1 -1
  182. package/dist/kernel/rendition-select.js +134 -2
  183. package/dist/kernel/rendition-select.js.map +1 -1
  184. package/dist/kernel/scheduler.d.ts +18 -3
  185. package/dist/kernel/scheduler.d.ts.map +1 -1
  186. package/dist/kernel/scheduler.js +32 -7
  187. package/dist/kernel/scheduler.js.map +1 -1
  188. package/dist/kernel/sinks/text-track-sink.d.ts +9 -0
  189. package/dist/kernel/sinks/text-track-sink.d.ts.map +1 -1
  190. package/dist/kernel/sinks/text-track-sink.js +29 -29
  191. package/dist/kernel/sinks/text-track-sink.js.map +1 -1
  192. package/dist/kernel/timeline.d.ts +26 -7
  193. package/dist/kernel/timeline.d.ts.map +1 -1
  194. package/dist/kernel/timeline.js +21 -7
  195. package/dist/kernel/timeline.js.map +1 -1
  196. package/dist/kernel/track-registry.d.ts.map +1 -1
  197. package/dist/kernel/track-registry.js +17 -1
  198. package/dist/kernel/track-registry.js.map +1 -1
  199. package/dist/kernel/transport.d.ts.map +1 -1
  200. package/dist/kernel/transport.js +1 -0
  201. package/dist/kernel/transport.js.map +1 -1
  202. package/dist/kernel/url.d.ts +4 -0
  203. package/dist/kernel/url.d.ts.map +1 -0
  204. package/dist/kernel/url.js +11 -0
  205. package/dist/kernel/url.js.map +1 -0
  206. package/dist/presets/full/index.d.ts.map +1 -1
  207. package/dist/presets/full/index.js +8 -2
  208. package/dist/presets/full/index.js.map +1 -1
  209. package/dist/presets/tiers.d.ts +7 -6
  210. package/dist/presets/tiers.d.ts.map +1 -1
  211. package/dist/presets/tiers.js +7 -6
  212. package/dist/presets/tiers.js.map +1 -1
  213. package/dist/protocols/adapter-shared.d.ts +23 -0
  214. package/dist/protocols/adapter-shared.d.ts.map +1 -0
  215. package/dist/protocols/adapter-shared.js +23 -0
  216. package/dist/protocols/adapter-shared.js.map +1 -0
  217. package/dist/protocols/dash-cmaf/index.d.ts +2 -2
  218. package/dist/protocols/dash-cmaf/index.d.ts.map +1 -1
  219. package/dist/protocols/dash-cmaf/index.js +150 -97
  220. package/dist/protocols/dash-cmaf/index.js.map +1 -1
  221. package/dist/protocols/dash-cmaf/parse.d.ts +2 -5
  222. package/dist/protocols/dash-cmaf/parse.d.ts.map +1 -1
  223. package/dist/protocols/dash-cmaf/parse.js +46 -39
  224. package/dist/protocols/dash-cmaf/parse.js.map +1 -1
  225. package/dist/protocols/dash-live/index.d.ts.map +1 -1
  226. package/dist/protocols/dash-live/index.js +67 -25
  227. package/dist/protocols/dash-live/index.js.map +1 -1
  228. package/dist/protocols/dimensions.d.ts +8 -0
  229. package/dist/protocols/dimensions.d.ts.map +1 -0
  230. package/dist/protocols/dimensions.js +13 -0
  231. package/dist/protocols/dimensions.js.map +1 -0
  232. package/dist/protocols/hls-cmaf/index.d.ts +3 -2
  233. package/dist/protocols/hls-cmaf/index.d.ts.map +1 -1
  234. package/dist/protocols/hls-cmaf/index.js +127 -114
  235. package/dist/protocols/hls-cmaf/index.js.map +1 -1
  236. package/dist/protocols/hls-cmaf/lexer.d.ts.map +1 -1
  237. package/dist/protocols/hls-cmaf/lexer.js +3 -0
  238. package/dist/protocols/hls-cmaf/lexer.js.map +1 -1
  239. package/dist/protocols/hls-cmaf/parse.d.ts +22 -14
  240. package/dist/protocols/hls-cmaf/parse.d.ts.map +1 -1
  241. package/dist/protocols/hls-cmaf/parse.js +196 -69
  242. package/dist/protocols/hls-cmaf/parse.js.map +1 -1
  243. package/dist/protocols/hls-cmaf/unavailable.d.ts +17 -0
  244. package/dist/protocols/hls-cmaf/unavailable.d.ts.map +1 -0
  245. package/dist/protocols/hls-cmaf/unavailable.js +38 -0
  246. package/dist/protocols/hls-cmaf/unavailable.js.map +1 -0
  247. package/dist/protocols/hls-live/index.d.ts +17 -0
  248. package/dist/protocols/hls-live/index.d.ts.map +1 -1
  249. package/dist/protocols/hls-live/index.js +202 -106
  250. package/dist/protocols/hls-live/index.js.map +1 -1
  251. package/dist/stages/abr/index.d.ts.map +1 -1
  252. package/dist/stages/abr/index.js +8 -14
  253. package/dist/stages/abr/index.js.map +1 -1
  254. package/dist/stages/abr-cap-size/index.d.ts +1 -1
  255. package/dist/stages/abr-persist/index.d.ts.map +1 -1
  256. package/dist/stages/abr-persist/index.js +17 -7
  257. package/dist/stages/abr-persist/index.js.map +1 -1
  258. package/dist/stages/aes-128/index.d.ts +0 -9
  259. package/dist/stages/aes-128/index.d.ts.map +1 -1
  260. package/dist/stages/aes-128/index.js +15 -13
  261. package/dist/stages/aes-128/index.js.map +1 -1
  262. package/dist/stages/alt-audio/index.d.ts +16 -0
  263. package/dist/stages/alt-audio/index.d.ts.map +1 -1
  264. package/dist/stages/alt-audio/index.js +28 -15
  265. package/dist/stages/alt-audio/index.js.map +1 -1
  266. package/dist/stages/chapters/index.d.ts +20 -0
  267. package/dist/stages/chapters/index.d.ts.map +1 -0
  268. package/dist/stages/chapters/index.js +141 -0
  269. package/dist/stages/chapters/index.js.map +1 -0
  270. package/dist/stages/chapters/parse.d.ts +47 -0
  271. package/dist/stages/chapters/parse.d.ts.map +1 -0
  272. package/dist/stages/chapters/parse.js +168 -0
  273. package/dist/stages/chapters/parse.js.map +1 -0
  274. package/dist/stages/cmaf-timing/index.d.ts.map +1 -1
  275. package/dist/stages/cmaf-timing/index.js +33 -42
  276. package/dist/stages/cmaf-timing/index.js.map +1 -1
  277. package/dist/stages/cmcd/index.d.ts +0 -11
  278. package/dist/stages/cmcd/index.d.ts.map +1 -1
  279. package/dist/stages/cmcd/index.js +30 -12
  280. package/dist/stages/cmcd/index.js.map +1 -1
  281. package/dist/stages/codec-switch/index.d.ts.map +1 -1
  282. package/dist/stages/codec-switch/index.js +3 -8
  283. package/dist/stages/codec-switch/index.js.map +1 -1
  284. package/dist/stages/content-steering/index.d.ts.map +1 -1
  285. package/dist/stages/content-steering/index.js +12 -9
  286. package/dist/stages/content-steering/index.js.map +1 -1
  287. package/dist/stages/eme-cenc/index.d.ts +0 -7
  288. package/dist/stages/eme-cenc/index.d.ts.map +1 -1
  289. package/dist/stages/eme-cenc/index.js +9 -5
  290. package/dist/stages/eme-cenc/index.js.map +1 -1
  291. package/dist/stages/eme-core/index.d.ts.map +1 -1
  292. package/dist/stages/eme-core/index.js +31 -15
  293. package/dist/stages/eme-core/index.js.map +1 -1
  294. package/dist/stages/eme-fairplay/index.d.ts +0 -7
  295. package/dist/stages/eme-fairplay/index.d.ts.map +1 -1
  296. package/dist/stages/eme-fairplay/index.js +11 -9
  297. package/dist/stages/eme-fairplay/index.js.map +1 -1
  298. package/dist/stages/nal-scan/index.d.ts.map +1 -1
  299. package/dist/stages/nal-scan/index.js +32 -145
  300. package/dist/stages/nal-scan/index.js.map +1 -1
  301. package/dist/stages/recovery/index.d.ts.map +1 -1
  302. package/dist/stages/recovery/index.js +42 -56
  303. package/dist/stages/recovery/index.js.map +1 -1
  304. package/dist/stages/text-cea608/index.d.ts +11 -0
  305. package/dist/stages/text-cea608/index.d.ts.map +1 -1
  306. package/dist/stages/text-cea608/index.js +3 -23
  307. package/dist/stages/text-cea608/index.js.map +1 -1
  308. package/dist/stages/text-webvtt/index.d.ts +12 -0
  309. package/dist/stages/text-webvtt/index.d.ts.map +1 -1
  310. package/dist/stages/text-webvtt/index.js +1 -1
  311. package/dist/stages/text-webvtt/index.js.map +1 -1
  312. package/dist/stages/text-webvtt-segmented/index.d.ts.map +1 -1
  313. package/dist/stages/text-webvtt-segmented/index.js +11 -8
  314. package/dist/stages/text-webvtt-segmented/index.js.map +1 -1
  315. package/dist/stages/thumbnails/index.d.ts +39 -10
  316. package/dist/stages/thumbnails/index.d.ts.map +1 -1
  317. package/dist/stages/thumbnails/index.js +220 -30
  318. package/dist/stages/thumbnails/index.js.map +1 -1
  319. package/dist/stages/trick-play/index.d.ts +51 -0
  320. package/dist/stages/trick-play/index.d.ts.map +1 -0
  321. package/dist/stages/trick-play/index.js +480 -0
  322. package/dist/stages/trick-play/index.js.map +1 -0
  323. package/dist/types/ir.d.ts +40 -1
  324. package/dist/types/ir.d.ts.map +1 -1
  325. package/dist/types/kernel.d.ts +41 -13
  326. package/dist/types/kernel.d.ts.map +1 -1
  327. package/dist/types/kernel.js +2 -1
  328. package/dist/types/kernel.js.map +1 -1
  329. package/dist/types/messages.d.ts +61 -10
  330. package/dist/types/messages.d.ts.map +1 -1
  331. package/dist/types/stage.d.ts +18 -0
  332. package/dist/types/stage.d.ts.map +1 -1
  333. package/package.json +1 -1
  334. package/dist/stages/text-webvtt/parse.d.ts.map +0 -1
  335. package/dist/stages/text-webvtt/parse.js.map +0 -1
@@ -1,22 +1,9 @@
1
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.149.0/helpers/esm/objectSpread2.js";
1
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.150.0/helpers/esm/objectSpread2.js";
2
+ import { resolveUrl } from "../../kernel/url.js";
3
+ import { manifestError } from "../adapter-shared.js";
4
+ import { dimensions } from "../dimensions.js";
2
5
  import { lex } from "./lexer.js";
3
6
  //#region src/protocols/hls-cmaf/parse.ts
4
- function manifestError(reason) {
5
- return {
6
- category: "manifest",
7
- code: "MANIFEST_PARSE_FAILED",
8
- fatal: true,
9
- recoverable: false,
10
- context: { reason }
11
- };
12
- }
13
- function resolve(uri, baseUrl) {
14
- try {
15
- return new URL(uri, baseUrl).href;
16
- } catch (_unused) {
17
- return uri;
18
- }
19
- }
20
7
  /** n@o or n (continuing after the previous range). RFC 8216 §4.3.2.2. */
21
8
  function parseByteRange(value, previousEnd) {
22
9
  const [lengthText, offsetText] = value.split("@");
@@ -39,7 +26,7 @@ function segmentKeyFrom(key, baseUrl) {
39
26
  const iv = key.attributes.IV;
40
27
  return _objectSpread2({
41
28
  method: "AES-128",
42
- uri: resolve(key.attributes.URI, baseUrl)
29
+ uri: resolveUrl(key.attributes.URI, baseUrl)
43
30
  }, iv !== void 0 ? { iv: iv.replace(/^0x/i, "").toLowerCase().padStart(32, "0") } : {});
44
31
  }
45
32
  function protectionFrom(key, baseUrl) {
@@ -50,13 +37,30 @@ function protectionFrom(key, baseUrl) {
50
37
  systemId: (_key$attributes$KEYFO = key.attributes.KEYFORMAT) !== null && _key$attributes$KEYFO !== void 0 ? _key$attributes$KEYFO : null,
51
38
  scheme: method.toLowerCase(),
52
39
  keyId: (_key$attributes$KEYID = key.attributes.KEYID) !== null && _key$attributes$KEYID !== void 0 ? _key$attributes$KEYID : null,
53
- licenseUrl: key.attributes.URI !== void 0 ? resolve(key.attributes.URI, baseUrl) : null,
40
+ licenseUrl: key.attributes.URI !== void 0 ? resolveUrl(key.attributes.URI, baseUrl) : null,
54
41
  initData: null,
55
42
  initDataType: null
56
43
  }] };
57
44
  }
58
45
  const AUDIO_CODECS = /^(mp4a|ac-3|ec-3|opus|flac)/i;
59
46
  /**
47
+ * A tile grid from LAYOUT="CxR" and a tile RESOLUTION, both from the Roku
48
+ * image-playlist specification (EXT-X-IMAGE-STREAM-INF, EXT-X-TILES).
49
+ * DURATION, when present, is the seconds each tile covers.
50
+ */
51
+ function tileGridFrom(attributes) {
52
+ const layout = dimensions(attributes.LAYOUT);
53
+ const size = dimensions(attributes.RESOLUTION);
54
+ if (layout === null || size === null) return null;
55
+ const duration = Number(attributes.DURATION);
56
+ return _objectSpread2({
57
+ columns: layout[0],
58
+ rows: layout[1],
59
+ width: size[0],
60
+ height: size[1]
61
+ }, duration > 0 ? { duration } : {});
62
+ }
63
+ /**
60
64
  * Rewrites the legacy decimal AVC codec form some packagers still emit into
61
65
  * the RFC 6381 hex form MSE demands. `avc1.66.30` (profile 66, level 30) is
62
66
  * accepted by Firefox but rejected by Chrome's isTypeSupported, which is why a
@@ -107,6 +111,7 @@ function parseMediaPlaylist(text, baseUrl) {
107
111
  let playlistType = null;
108
112
  let protection = null;
109
113
  let pendingKey = null;
114
+ let tiles = null;
110
115
  let dateAnchor;
111
116
  let pendingDate = null;
112
117
  let pendingDuration = null;
@@ -146,7 +151,7 @@ function parseMediaPlaylist(text, baseUrl) {
146
151
  const uri = line.attributes.URI;
147
152
  if (uri !== void 0) {
148
153
  const range = line.attributes.BYTERANGE !== void 0 ? parseByteRange(line.attributes.BYTERANGE, null) : null;
149
- init = _objectSpread2({ url: resolve(uri, baseUrl) }, range !== null ? { byteRange: range } : {});
154
+ init = _objectSpread2({ url: resolveUrl(uri, baseUrl) }, range !== null ? { byteRange: range } : {});
150
155
  }
151
156
  break;
152
157
  }
@@ -160,6 +165,9 @@ function parseMediaPlaylist(text, baseUrl) {
160
165
  if (Number.isFinite(parsed)) pendingDate = parsed / 1e3;
161
166
  break;
162
167
  }
168
+ case "EXT-X-TILES":
169
+ var _tiles;
170
+ tiles = (_tiles = tiles) !== null && _tiles !== void 0 ? _tiles : tileGridFrom(line.attributes);
163
171
  }
164
172
  continue;
165
173
  }
@@ -176,7 +184,7 @@ function parseMediaPlaylist(text, baseUrl) {
176
184
  seq,
177
185
  start,
178
186
  duration: pendingDuration,
179
- url: resolve(line.uri, baseUrl)
187
+ url: resolveUrl(line.uri, baseUrl)
180
188
  }, pendingRange !== null ? { byteRange: pendingRange } : {}), pendingDiscontinuity ? { discontinuity: true } : {}), pendingKey !== null ? { key: pendingKey } : {}));
181
189
  previousRangeEnd = pendingRange !== null ? pendingRange.end : previousRangeEnd;
182
190
  start += pendingDuration;
@@ -186,7 +194,7 @@ function parseMediaPlaylist(text, baseUrl) {
186
194
  pendingDiscontinuity = false;
187
195
  }
188
196
  return {
189
- playlist: _objectSpread2({
197
+ playlist: _objectSpread2(_objectSpread2({
190
198
  segments,
191
199
  init,
192
200
  targetDuration,
@@ -194,7 +202,7 @@ function parseMediaPlaylist(text, baseUrl) {
194
202
  endlist,
195
203
  playlistType,
196
204
  protection
197
- }, dateAnchor !== void 0 ? { dateAnchor } : {}),
205
+ }, dateAnchor !== void 0 ? { dateAnchor } : {}), tiles !== null ? { tiles } : {}),
198
206
  error: null
199
207
  };
200
208
  }
@@ -203,6 +211,87 @@ function mediaContentType(type) {
203
211
  if (type === "SUBTITLES") return "text";
204
212
  return null;
205
213
  }
214
+ /**
215
+ * The rendition fields a tag with a URI attribute declares: the Roku
216
+ * EXT-X-IMAGE-STREAM-INF and the RFC 8216 §4.3.4.3 EXT-X-I-FRAME-STREAM-INF.
217
+ * RESOLUTION names the rendition, BANDWIDTH when it is missing.
218
+ */
219
+ function uriStreamRendition(attributes, prefix, baseUrl) {
220
+ var _attributes$RESOLUTIO;
221
+ if (attributes.URI === void 0) return null;
222
+ const size = dimensions(attributes.RESOLUTION);
223
+ return _objectSpread2({
224
+ id: `${prefix}-${(_attributes$RESOLUTIO = attributes.RESOLUTION) !== null && _attributes$RESOLUTIO !== void 0 ? _attributes$RESOLUTIO : attributes.BANDWIDTH}`,
225
+ bitrate: Number(attributes.BANDWIDTH) || 0,
226
+ playlistUrl: resolveUrl(attributes.URI, baseUrl)
227
+ }, size !== null ? {
228
+ width: size[0],
229
+ height: size[1]
230
+ } : {});
231
+ }
232
+ /**
233
+ * Image playlists (Roku EXT-X-IMAGE-STREAM-INF) as one image track, one
234
+ * rendition per playlist. RESOLUTION is the size of one tile. The grid is
235
+ * known here only when the tag carries LAYOUT; otherwise it arrives with the
236
+ * media playlist's EXT-X-TILES. The kernel schedules no image track; the
237
+ * thumbnails stage reads it.
238
+ */
239
+ function imageTrack(streams, baseUrl) {
240
+ const renditions = [];
241
+ for (const { attributes } of streams) {
242
+ var _attributes$CODECS, _attributes$CODECS2;
243
+ const base = uriStreamRendition(attributes, "i", baseUrl);
244
+ if (base === null || renditions.some((r) => r.id === base.id)) continue;
245
+ const tiles = tileGridFrom(attributes);
246
+ renditions.push(_objectSpread2(_objectSpread2({}, base), {}, {
247
+ codecs: (_attributes$CODECS = attributes.CODECS) !== null && _attributes$CODECS !== void 0 ? _attributes$CODECS : null,
248
+ mimeType: /png/i.test((_attributes$CODECS2 = attributes.CODECS) !== null && _attributes$CODECS2 !== void 0 ? _attributes$CODECS2 : "") ? "image/png" : "image/jpeg",
249
+ segments: []
250
+ }, tiles !== null ? { tiles } : {}));
251
+ }
252
+ const first = renditions[0];
253
+ if (first === void 0) return null;
254
+ return {
255
+ id: "image-main",
256
+ contentType: "image",
257
+ mimeType: first.mimeType,
258
+ protection: null,
259
+ renditions
260
+ };
261
+ }
262
+ /**
263
+ * I-frame playlists (RFC 8216 §4.3.4.3) as one video track with role
264
+ * 'trick'. Their media playlists carry EXT-X-I-FRAMES-ONLY and byte ranges
265
+ * into the normal segments. Normal playback never selects the track.
266
+ */
267
+ function trickTrack(streams, baseUrl, protection) {
268
+ const renditions = [];
269
+ for (const { attributes } of streams) {
270
+ const base = uriStreamRendition(attributes, "t", baseUrl);
271
+ if (base === null || renditions.some((r) => r.id === base.id)) continue;
272
+ const pathway = attributes["PATHWAY-ID"];
273
+ renditions.push(_objectSpread2(_objectSpread2({}, base), {}, {
274
+ codecs: splitCodecs(attributes.CODECS).video,
275
+ mimeType: "video/mp4",
276
+ segments: []
277
+ }, pathway !== void 0 ? { pathway } : {}));
278
+ }
279
+ if (renditions.length === 0) return null;
280
+ return {
281
+ id: "video-trick",
282
+ contentType: "video",
283
+ mimeType: "video/mp4",
284
+ role: "trick",
285
+ protection,
286
+ renditions
287
+ };
288
+ }
289
+ /** RFC 8216 §4.3.4.4: DATA-ID is required, with VALUE or URI, and an optional LANGUAGE. */
290
+ function sessionDataFrom(attributes, baseUrl) {
291
+ const id = attributes["DATA-ID"];
292
+ if (id === void 0) return null;
293
+ return _objectSpread2(_objectSpread2(_objectSpread2({ id }, attributes.VALUE !== void 0 ? { value: attributes.VALUE } : {}), attributes.URI !== void 0 ? { uri: resolveUrl(attributes.URI, baseUrl) } : {}), attributes.LANGUAGE !== void 0 ? { lang: attributes.LANGUAGE } : {});
294
+ }
206
295
  /** parse either playlist form into a Presentation. Never throws. */
207
296
  function parse(text, baseUrl) {
208
297
  if (!text.trimStart().startsWith("#EXTM3U")) return {
@@ -263,6 +352,9 @@ function parse(text, baseUrl) {
263
352
  }
264
353
  const mediaEntries = [];
265
354
  const variants = [];
355
+ const imageStreams = [];
356
+ const iframeStreams = [];
357
+ const sessionData = [];
266
358
  let sessionProtection = null;
267
359
  let steering;
268
360
  let pendingStreamInf = null;
@@ -275,22 +367,27 @@ function parse(text, baseUrl) {
275
367
  groupId: (_line$attributes$GROU = line.attributes["GROUP-ID"]) !== null && _line$attributes$GROU !== void 0 ? _line$attributes$GROU : "",
276
368
  name: (_line$attributes$NAME = line.attributes.NAME) !== null && _line$attributes$NAME !== void 0 ? _line$attributes$NAME : "",
277
369
  attributes: line.attributes,
278
- uri: line.attributes.URI !== void 0 ? resolve(line.attributes.URI, baseUrl) : null
370
+ uri: line.attributes.URI !== void 0 ? resolveUrl(line.attributes.URI, baseUrl) : null
279
371
  });
280
372
  } else if (line.name === "EXT-X-STREAM-INF") pendingStreamInf = line;
281
- else if (line.name === "EXT-X-SESSION-KEY") {
373
+ else if (line.name === "EXT-X-IMAGE-STREAM-INF") imageStreams.push(line);
374
+ else if (line.name === "EXT-X-I-FRAME-STREAM-INF") iframeStreams.push(line);
375
+ else if (line.name === "EXT-X-SESSION-DATA") {
376
+ const entry = sessionDataFrom(line.attributes, baseUrl);
377
+ if (entry !== null) sessionData.push(entry);
378
+ } else if (line.name === "EXT-X-SESSION-KEY") {
282
379
  var _protectionFrom2;
283
380
  sessionProtection = (_protectionFrom2 = protectionFrom(line, baseUrl)) !== null && _protectionFrom2 !== void 0 ? _protectionFrom2 : sessionProtection;
284
381
  } else if (line.name === "EXT-X-CONTENT-STEERING") {
285
382
  const serverUri = line.attributes["SERVER-URI"];
286
- if (serverUri !== void 0) steering = _objectSpread2({ serverUri: resolve(serverUri, baseUrl) }, line.attributes["PATHWAY-ID"] !== void 0 ? { defaultPathway: line.attributes["PATHWAY-ID"] } : {});
383
+ if (serverUri !== void 0) steering = _objectSpread2({ serverUri: resolveUrl(serverUri, baseUrl) }, line.attributes["PATHWAY-ID"] !== void 0 ? { defaultPathway: line.attributes["PATHWAY-ID"] } : {});
287
384
  }
288
385
  continue;
289
386
  }
290
387
  if (pendingStreamInf !== null) {
291
388
  variants.push({
292
389
  attributes: pendingStreamInf.attributes,
293
- uri: resolve(line.uri, baseUrl)
390
+ uri: resolveUrl(line.uri, baseUrl)
294
391
  });
295
392
  pendingStreamInf = null;
296
393
  }
@@ -303,9 +400,9 @@ function parse(text, baseUrl) {
303
400
  const audioOnlyVariants = [];
304
401
  const couplings = [];
305
402
  for (const variant of variants) {
403
+ var _dimensions;
306
404
  const bandwidth = Number(variant.attributes.BANDWIDTH) || 0;
307
- const resolution = variant.attributes.RESOLUTION;
308
- const [width, height] = resolution !== void 0 ? resolution.split("x").map((n) => Number(n)) : [];
405
+ const [width, height] = (_dimensions = dimensions(variant.attributes.RESOLUTION)) !== null && _dimensions !== void 0 ? _dimensions : [];
309
406
  const { video, audio } = splitCodecs(variant.attributes.CODECS);
310
407
  if (video === null && audio !== null) {
311
408
  audioOnlyVariants.push(variant);
@@ -324,7 +421,7 @@ function parse(text, baseUrl) {
324
421
  mimeType: "video/mp4",
325
422
  segments: [],
326
423
  playlistUrl: variant.uri
327
- }, pathway !== void 0 ? { pathway } : {}), width !== void 0 && Number.isFinite(width) ? { width } : {}), height !== void 0 && Number.isFinite(height) ? { height } : {}), Number.isFinite(frameRate) ? { frameRate } : {}));
424
+ }, pathway !== void 0 ? { pathway } : {}), width !== void 0 ? { width } : {}), height !== void 0 ? { height } : {}), Number.isFinite(frameRate) ? { frameRate } : {}));
328
425
  const requires = {};
329
426
  if (variant.attributes.AUDIO !== void 0) requires.audio = variant.attributes.AUDIO;
330
427
  if (variant.attributes.SUBTITLES !== void 0) requires.text = variant.attributes.SUBTITLES;
@@ -385,8 +482,12 @@ function parse(text, baseUrl) {
385
482
  playlistUrl: entry.uri
386
483
  }] }));
387
484
  }
485
+ const trick = trickTrack(iframeStreams, baseUrl, sessionProtection);
486
+ if (trick !== null) tracks.push(trick);
487
+ const images = imageTrack(imageStreams, baseUrl);
488
+ if (images !== null) tracks.push(images);
388
489
  return {
389
- presentation: _objectSpread2({
490
+ presentation: _objectSpread2(_objectSpread2({
390
491
  id: baseUrl,
391
492
  isLive: false,
392
493
  periods: [{
@@ -395,7 +496,7 @@ function parse(text, baseUrl) {
395
496
  tracks
396
497
  }],
397
498
  couplings
398
- }, steering !== void 0 ? { steering } : {}),
499
+ }, steering !== void 0 ? { steering } : {}), sessionData.length > 0 ? { sessionData } : {}),
399
500
  error: null
400
501
  };
401
502
  }
@@ -422,36 +523,46 @@ function timelineShift(previous, next) {
422
523
  return last.start + (first.seq - last.seq) * average - first.start;
423
524
  }
424
525
  /**
425
- * Immutably merges a fetched media playlist into the rendition that
426
- * referenced it. Duration, liveness, init, and protection all come from
427
- * the media playlist; the presentation learns them here. On a live refresh
428
- * the new window is rebased onto the running timeline first, so segment start
429
- * times stay absolute across reloads.
526
+ * The PLAYLIST_REFRESHED fact that merges a fetched media playlist into the
527
+ * rendition that referenced it, or null when the playlist is older than
528
+ * what the rendition holds. On a live refresh the new window is rebased
529
+ * onto the running timeline first, so segment start times stay absolute
530
+ * across reloads. The kernel merges the fact into the presentation it
531
+ * holds when the fact lands (applyRefresh).
430
532
  */
431
- function mergePlaylist(presentation, renditionId, playlist) {
432
- var _presentation$duratio;
533
+ function refreshFor(presentation, renditionId, playlist) {
433
534
  let previous = [];
434
- for (const period of presentation.periods) for (const track of period.tracks) for (const rendition of track.renditions) if (rendition.id === renditionId) previous = rendition.segments;
535
+ let sibling = [];
536
+ for (const period of presentation.periods) for (const track of period.tracks) {
537
+ if (!track.renditions.some((r) => r.id === renditionId)) continue;
538
+ for (const rendition of track.renditions) if (rendition.id === renditionId) previous = rendition.segments;
539
+ else if (Array.isArray(rendition.segments) && rendition.segments.length > 0) {
540
+ const candidate = rendition.segments;
541
+ const newest = (list) => {
542
+ var _list$seq, _list;
543
+ return (_list$seq = (_list = list[list.length - 1]) === null || _list === void 0 ? void 0 : _list.seq) !== null && _list$seq !== void 0 ? _list$seq : -1;
544
+ };
545
+ if (newest(candidate) > newest(sibling)) sibling = candidate;
546
+ }
547
+ }
435
548
  const knownLast = Array.isArray(previous) ? previous[previous.length - 1] : void 0;
436
549
  const incomingLast = playlist.segments[playlist.segments.length - 1];
437
- if (knownLast !== void 0 && incomingLast !== void 0 && !playlist.endlist && incomingLast.seq < knownLast.seq) return presentation;
438
- const shift = timelineShift(previous, playlist.segments);
550
+ if (knownLast !== void 0 && incomingLast !== void 0 && !playlist.endlist && incomingLast.seq < knownLast.seq) return null;
551
+ const shift = timelineShift(!playlist.endlist && knownLast === void 0 && sibling.length > 0 ? sibling : previous, playlist.segments);
439
552
  const segments = shift === 0 ? playlist.segments : playlist.segments.map((s) => _objectSpread2(_objectSpread2({}, s), {}, { start: s.start + shift }));
440
- const duration = segments.reduce((sum, s) => sum + s.duration, 0);
441
- const dateAnchor = playlist.dateAnchor !== void 0 ? {
553
+ return _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
554
+ type: "PLAYLIST_REFRESHED",
555
+ trackId: renditionId,
556
+ renditionId,
557
+ mediaSequence: playlist.mediaSequence,
558
+ segments
559
+ }, playlist.init !== null ? { init: playlist.init } : {}), playlist.tiles !== void 0 ? { tiles: playlist.tiles } : {}), {}, {
560
+ protection: playlist.protection,
561
+ endlist: playlist.endlist
562
+ }, playlist.endlist ? {} : { updatePeriod: playlist.targetDuration || 4 }), playlist.dateAnchor !== void 0 ? { dateAnchor: {
442
563
  wallClock: playlist.dateAnchor.wallClock,
443
564
  presentationTime: playlist.dateAnchor.presentationTime + shift
444
- } : void 0;
445
- const periods = presentation.periods.map((period) => _objectSpread2(_objectSpread2({}, period), {}, { tracks: period.tracks.map((track) => {
446
- var _track$protection;
447
- if (!track.renditions.some((r) => r.id === renditionId)) return track;
448
- return _objectSpread2(_objectSpread2({}, track), {}, {
449
- protection: (_track$protection = track.protection) !== null && _track$protection !== void 0 ? _track$protection : playlist.protection,
450
- renditions: track.renditions.map((rendition) => rendition.id === renditionId ? _objectSpread2(_objectSpread2({}, rendition), {}, { segments }, playlist.init !== null ? { init: playlist.init } : {}) : rendition)
451
- });
452
- }) }));
453
- const knownDuration = (_presentation$duratio = presentation.duration) !== null && _presentation$duratio !== void 0 ? _presentation$duratio : 0;
454
- return _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, presentation), {}, { isLive: !playlist.endlist }, playlist.endlist ? { duration: Math.max(knownDuration, duration) } : {}), playlist.endlist ? {} : { live: _objectSpread2(_objectSpread2({}, presentation.live), {}, { updatePeriod: playlist.targetDuration || 4 }, dateAnchor !== void 0 ? { dateAnchor } : {}) }), {}, { periods });
565
+ } } : {});
455
566
  }
456
567
  //#endregion
457
- export { mergePlaylist, normalizeAvcCodec, parse, parseMediaPlaylist };
568
+ export { normalizeAvcCodec, parse, parseMediaPlaylist, refreshFor };
@@ -0,0 +1,43 @@
1
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.150.0/helpers/esm/objectSpread2.js";
2
+ import { isTrick } from "../../kernel/presentation.js";
3
+ import { withDeadGroups } from "../../kernel/rendition-select.js";
4
+ //#region src/protocols/hls-cmaf/unavailable.ts
5
+ /**
6
+ * What a playlist that cannot be used means for playback. Pure; shared by
7
+ * hls-cmaf (a playlist that fails to load) and hls-live (a playlist that
8
+ * keeps failing to reload). Each keeps its own constraint source, because
9
+ * CONSTRAIN replaces a source's constraint and two slices writing one source
10
+ * in the same turn would erase each other's exclusions.
11
+ */
12
+ /** Renditions whose playlist failed to load (hls-cmaf). */
13
+ const LOAD_FAILED = "hls:unavailable";
14
+ /** Renditions whose playlist kept failing to reload (hls-live). */
15
+ const RELOAD_FAILED = "hls-live:unavailable";
16
+ /**
17
+ * The messages that stop relying on the renditions in `ids`, the whole list
18
+ * `source` excludes. A failed audio group takes the variants that require
19
+ * it, so arbitration moves to a variant on a working group and alt-audio
20
+ * follows. A CONSTRAIN when playback can go on; a fatal MANIFEST_FAILED
21
+ * when a video track has no rendition left, or when the active audio track
22
+ * has none and no variant names an audio group to move to.
23
+ */
24
+ function unavailableMessages(kernel, source, ids, error) {
25
+ var _kernel$quality$const, _kernel$quality$const2;
26
+ const presentation = kernel.presentation;
27
+ if (presentation === null) return [];
28
+ const other = source === "hls:unavailable" ? RELOAD_FAILED : LOAD_FAILED;
29
+ const excluded = withDeadGroups(presentation, /* @__PURE__ */ new Set([...ids, ...(_kernel$quality$const = (_kernel$quality$const2 = kernel.quality.constraints.get(other)) === null || _kernel$quality$const2 === void 0 ? void 0 : _kernel$quality$const2.excludeIds) !== null && _kernel$quality$const !== void 0 ? _kernel$quality$const : []]));
30
+ const grouped = presentation.couplings.some((c) => c.requires.audio !== void 0);
31
+ const activeAudio = kernel.tracks.active.get("audio");
32
+ if (presentation.periods.some((period) => period.tracks.some((track) => track.renditions.length > 0 && track.renditions.every((r) => excluded.has(r.id)) && (track.contentType === "video" && !isTrick(track) || track.id === activeAudio && !grouped)))) return [{
33
+ type: "MANIFEST_FAILED",
34
+ error: _objectSpread2(_objectSpread2({}, error), {}, { fatal: true })
35
+ }];
36
+ return [{
37
+ type: "CONSTRAIN",
38
+ source,
39
+ constraint: { excludeIds: [...excluded] }
40
+ }];
41
+ }
42
+ //#endregion
43
+ export { LOAD_FAILED, RELOAD_FAILED, unavailableMessages };