mattebox 0.10.0 → 0.11.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 (362) hide show
  1. package/README.md +1 -1
  2. package/dist/cdn/mattebox.dash-drm.min.js +3 -3
  3. package/dist/cdn/mattebox.dash.min.js +3 -3
  4. package/dist/cdn/mattebox.dual-drm.min.js +3 -3
  5. package/dist/cdn/mattebox.dual-ts-drm.min.js +3 -3
  6. package/dist/cdn/mattebox.dual-ts.min.js +3 -3
  7. package/dist/cdn/mattebox.dual.min.js +3 -3
  8. package/dist/cdn/mattebox.hls-drm.min.js +3 -3
  9. package/dist/cdn/mattebox.hls-ts-drm.min.js +3 -3
  10. package/dist/cdn/mattebox.hls-ts.min.js +3 -3
  11. package/dist/cdn/mattebox.hls.min.js +3 -3
  12. package/dist/cdn/mattebox.kernel.min.js +1 -1
  13. package/dist/cdn/mattebox.min.js +6 -2
  14. package/dist/containers/captions.d.ts +6 -5
  15. package/dist/containers/captions.d.ts.map +1 -1
  16. package/dist/containers/captions.js +9 -9
  17. package/dist/containers/captions.js.map +1 -1
  18. package/dist/containers/codec-probe/index.d.ts +15 -0
  19. package/dist/containers/codec-probe/index.d.ts.map +1 -1
  20. package/dist/containers/codec-probe/index.js +72 -5
  21. package/dist/containers/codec-probe/index.js.map +1 -1
  22. package/dist/containers/emsg.d.ts +15 -0
  23. package/dist/containers/emsg.d.ts.map +1 -0
  24. package/dist/containers/emsg.js +91 -0
  25. package/dist/containers/emsg.js.map +1 -0
  26. package/dist/containers/id3.d.ts +12 -0
  27. package/dist/containers/id3.d.ts.map +1 -1
  28. package/dist/containers/id3.js +53 -4
  29. package/dist/containers/id3.js.map +1 -1
  30. package/dist/containers/metadata.d.ts +18 -0
  31. package/dist/containers/metadata.d.ts.map +1 -0
  32. package/dist/containers/metadata.js +20 -0
  33. package/dist/containers/metadata.js.map +1 -0
  34. package/dist/containers/mp4-box/index.d.ts +16 -0
  35. package/dist/containers/mp4-box/index.d.ts.map +1 -1
  36. package/dist/containers/mp4-box/index.js +28 -0
  37. package/dist/containers/mp4-box/index.js.map +1 -1
  38. package/dist/containers/scte35.d.ts +12 -0
  39. package/dist/containers/scte35.d.ts.map +1 -0
  40. package/dist/containers/scte35.js +116 -0
  41. package/dist/containers/scte35.js.map +1 -0
  42. package/dist/containers/ts-transmux/demux.d.ts +2 -2
  43. package/dist/containers/ts-transmux/demux.d.ts.map +1 -1
  44. package/dist/containers/ts-transmux/demux.js +2 -18
  45. package/dist/containers/ts-transmux/demux.js.map +1 -1
  46. package/dist/containers/ts-transmux/index.d.ts.map +1 -1
  47. package/dist/containers/ts-transmux/index.js +14 -3
  48. package/dist/containers/ts-transmux/index.js.map +1 -1
  49. package/dist/containers/ts-transmux/module.d.ts +8 -0
  50. package/dist/containers/ts-transmux/module.d.ts.map +1 -0
  51. package/dist/containers/ts-transmux/module.js +8 -0
  52. package/dist/containers/ts-transmux/module.js.map +1 -0
  53. package/dist/containers/ts-transmux/runner.d.ts +20 -8
  54. package/dist/containers/ts-transmux/runner.d.ts.map +1 -1
  55. package/dist/containers/ts-transmux/runner.js +19 -22
  56. package/dist/containers/ts-transmux/runner.js.map +1 -1
  57. package/dist/containers/ts-transmux/serve.d.ts +35 -0
  58. package/dist/containers/ts-transmux/serve.d.ts.map +1 -0
  59. package/dist/containers/ts-transmux/serve.js +33 -0
  60. package/dist/containers/ts-transmux/serve.js.map +1 -0
  61. package/dist/containers/ts-transmux/sniff.d.ts +11 -0
  62. package/dist/containers/ts-transmux/sniff.d.ts.map +1 -0
  63. package/dist/containers/ts-transmux/sniff.js +25 -0
  64. package/dist/containers/ts-transmux/sniff.js.map +1 -0
  65. package/dist/containers/ts-transmux/source.d.ts +10 -0
  66. package/dist/containers/ts-transmux/source.d.ts.map +1 -0
  67. package/dist/containers/ts-transmux/source.js +5 -0
  68. package/dist/containers/ts-transmux/source.js.map +1 -0
  69. package/dist/containers/ts-transmux/transmux.d.ts +19 -1
  70. package/dist/containers/ts-transmux/transmux.d.ts.map +1 -1
  71. package/dist/containers/ts-transmux/transmux.js +46 -7
  72. package/dist/containers/ts-transmux/transmux.js.map +1 -1
  73. package/dist/containers/ts-transmux/transmux.worker.js +7 -28
  74. package/dist/containers/ts-transmux/transmux.worker.js.map +1 -1
  75. package/dist/containers/webvtt.d.ts +2 -0
  76. package/dist/containers/webvtt.d.ts.map +1 -1
  77. package/dist/containers/webvtt.js +4 -0
  78. package/dist/containers/webvtt.js.map +1 -1
  79. package/dist/containers/wvtt.d.ts +12 -0
  80. package/dist/containers/wvtt.d.ts.map +1 -0
  81. package/dist/containers/wvtt.js +46 -0
  82. package/dist/containers/wvtt.js.map +1 -0
  83. package/dist/eme/index.d.ts +34 -0
  84. package/dist/eme/index.d.ts.map +1 -0
  85. package/dist/eme/index.js +75 -0
  86. package/dist/eme/index.js.map +1 -0
  87. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/asyncToGenerator.js +1 -1
  88. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/defineProperty.js +1 -1
  89. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/objectSpread2.js +1 -1
  90. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/objectWithoutProperties.js +1 -1
  91. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/objectWithoutPropertiesLoose.js +1 -1
  92. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/toPrimitive.js +1 -1
  93. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/toPropertyKey.js +1 -1
  94. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/typeof.js +1 -1
  95. package/dist/es2015/containers/captions.js +8 -8
  96. package/dist/es2015/containers/codec-probe/index.js +105 -6
  97. package/dist/es2015/containers/emsg.js +81 -0
  98. package/dist/es2015/containers/id3.js +54 -4
  99. package/dist/es2015/containers/metadata.js +20 -0
  100. package/dist/es2015/containers/mp4-box/index.js +27 -1
  101. package/dist/es2015/containers/scte35.js +114 -0
  102. package/dist/es2015/containers/ts-transmux/demux.js +12 -24
  103. package/dist/es2015/containers/ts-transmux/h264.js +1 -1
  104. package/dist/es2015/containers/ts-transmux/index.js +12 -4
  105. package/dist/es2015/containers/ts-transmux/runner.js +34 -27
  106. package/dist/es2015/containers/ts-transmux/serve.js +36 -0
  107. package/dist/es2015/containers/ts-transmux/sniff.js +13 -0
  108. package/dist/es2015/containers/ts-transmux/source.js +7 -0
  109. package/dist/es2015/containers/ts-transmux/transmux.js +42 -8
  110. package/dist/es2015/containers/ts-transmux/transmux.worker.js +7 -26
  111. package/dist/es2015/containers/webvtt.js +6 -2
  112. package/dist/es2015/containers/wvtt.js +40 -0
  113. package/dist/es2015/eme/index.js +79 -0
  114. package/dist/es2015/index.js +39 -14
  115. package/dist/es2015/kernel/append-queue.js +1 -1
  116. package/dist/es2015/kernel/base64.js +14 -3
  117. package/dist/es2015/kernel/bus.js +11 -8
  118. package/dist/es2015/kernel/context.js +5 -0
  119. package/dist/es2015/kernel/lifecycle.js +1 -0
  120. package/dist/es2015/kernel/loader.js +2 -2
  121. package/dist/es2015/kernel/mime.js +12 -1
  122. package/dist/es2015/kernel/mse.js +39 -5
  123. package/dist/es2015/kernel/prepare.js +2 -2
  124. package/dist/es2015/kernel/reducer.js +74 -20
  125. package/dist/es2015/kernel/refresh.js +2 -2
  126. package/dist/es2015/kernel/rendition-select.js +2 -1
  127. package/dist/es2015/kernel/scheduler.js +1 -1
  128. package/dist/es2015/kernel/sinks/caption-tracks.js +82 -0
  129. package/dist/es2015/kernel/sinks/native-sync.js +46 -0
  130. package/dist/es2015/kernel/sinks/text-formats.js +64 -0
  131. package/dist/es2015/kernel/sinks/text-track-sink.js +15 -4
  132. package/dist/es2015/kernel/timeline.js +12 -8
  133. package/dist/es2015/kernel/trace.js +1 -1
  134. package/dist/es2015/kernel/track-registry.js +6 -3
  135. package/dist/es2015/kernel/transport.js +34 -7
  136. package/dist/es2015/presets/define.js +2 -2
  137. package/dist/es2015/presets/full/index.js +22 -2
  138. package/dist/es2015/protocols/dash-cmaf/index.js +61 -14
  139. package/dist/es2015/protocols/dash-cmaf/parse.js +356 -121
  140. package/dist/es2015/protocols/dash-cmaf/periods-runtime.js +134 -0
  141. package/dist/es2015/protocols/dash-cmaf/periods.js +178 -0
  142. package/dist/es2015/protocols/dash-live/index.js +1 -1
  143. package/dist/es2015/protocols/hls-cmaf/index.js +41 -17
  144. package/dist/es2015/protocols/hls-cmaf/lexer.js +2 -1
  145. package/dist/es2015/protocols/hls-cmaf/parse.js +109 -30
  146. package/dist/es2015/protocols/hls-cmaf/unavailable.js +37 -6
  147. package/dist/es2015/protocols/hls-live/index.js +36 -10
  148. package/dist/es2015/stages/abr/index.js +10 -5
  149. package/dist/es2015/stages/abr-persist/index.js +1 -1
  150. package/dist/es2015/stages/aes-128/index.js +1 -1
  151. package/dist/es2015/stages/chapters/index.js +2 -2
  152. package/dist/es2015/stages/chapters/parse.js +2 -2
  153. package/dist/es2015/stages/cmcd/index.js +30 -3
  154. package/dist/es2015/stages/cmsd/index.js +72 -0
  155. package/dist/es2015/stages/codec-probe/index.js +28 -3
  156. package/dist/es2015/stages/content-steering/index.js +1 -1
  157. package/dist/es2015/stages/eme-core/index.js +22 -2
  158. package/dist/es2015/stages/eme-fairplay/index.js +1 -1
  159. package/dist/es2015/stages/hdr/index.js +214 -0
  160. package/dist/es2015/stages/meta-id3/index.js +6 -1
  161. package/dist/es2015/stages/qoe/index.js +111 -0
  162. package/dist/es2015/stages/recovery/index.js +1 -1
  163. package/dist/es2015/stages/rendition-names/index.js +101 -0
  164. package/dist/es2015/stages/text-cea608/decode.js +56 -5
  165. package/dist/es2015/stages/text-cea608/index.js +26 -93
  166. package/dist/es2015/stages/text-cea708/decode.js +377 -0
  167. package/dist/es2015/stages/text-cea708/index.js +98 -0
  168. package/dist/es2015/stages/text-ttml/index.js +88 -0
  169. package/dist/es2015/stages/text-ttml/parse.js +255 -0
  170. package/dist/es2015/stages/text-webvtt/index.js +30 -65
  171. package/dist/es2015/stages/thumbnails/index.js +1 -1
  172. package/dist/es2015/stages/timed-metadata/index.js +331 -0
  173. package/dist/es2015/stages/trick-play/index.js +3 -2
  174. package/dist/index.d.ts +1 -1
  175. package/dist/index.d.ts.map +1 -1
  176. package/dist/index.js +40 -13
  177. package/dist/index.js.map +1 -1
  178. package/dist/kernel/base64.d.ts +7 -2
  179. package/dist/kernel/base64.d.ts.map +1 -1
  180. package/dist/kernel/base64.js +14 -2
  181. package/dist/kernel/base64.js.map +1 -1
  182. package/dist/kernel/bus.d.ts.map +1 -1
  183. package/dist/kernel/bus.js +12 -9
  184. package/dist/kernel/bus.js.map +1 -1
  185. package/dist/kernel/context.d.ts +3 -1
  186. package/dist/kernel/context.d.ts.map +1 -1
  187. package/dist/kernel/context.js +5 -0
  188. package/dist/kernel/context.js.map +1 -1
  189. package/dist/kernel/lifecycle.d.ts +3 -1
  190. package/dist/kernel/lifecycle.d.ts.map +1 -1
  191. package/dist/kernel/lifecycle.js +1 -0
  192. package/dist/kernel/lifecycle.js.map +1 -1
  193. package/dist/kernel/loader.d.ts.map +1 -1
  194. package/dist/kernel/loader.js +3 -2
  195. package/dist/kernel/loader.js.map +1 -1
  196. package/dist/kernel/mime.d.ts +7 -0
  197. package/dist/kernel/mime.d.ts.map +1 -1
  198. package/dist/kernel/mime.js +12 -0
  199. package/dist/kernel/mime.js.map +1 -1
  200. package/dist/kernel/mse.d.ts.map +1 -1
  201. package/dist/kernel/mse.js +37 -2
  202. package/dist/kernel/mse.js.map +1 -1
  203. package/dist/kernel/reducer.d.ts.map +1 -1
  204. package/dist/kernel/reducer.js +77 -8
  205. package/dist/kernel/reducer.js.map +1 -1
  206. package/dist/kernel/refresh.d.ts.map +1 -1
  207. package/dist/kernel/refresh.js +1 -0
  208. package/dist/kernel/refresh.js.map +1 -1
  209. package/dist/kernel/rendition-select.d.ts.map +1 -1
  210. package/dist/kernel/rendition-select.js +4 -2
  211. package/dist/kernel/rendition-select.js.map +1 -1
  212. package/dist/kernel/sinks/caption-tracks.d.ts +11 -0
  213. package/dist/kernel/sinks/caption-tracks.d.ts.map +1 -0
  214. package/dist/kernel/sinks/caption-tracks.js +87 -0
  215. package/dist/kernel/sinks/caption-tracks.js.map +1 -0
  216. package/dist/kernel/sinks/native-sync.d.ts +24 -0
  217. package/dist/kernel/sinks/native-sync.d.ts.map +1 -0
  218. package/dist/kernel/sinks/native-sync.js +42 -0
  219. package/dist/kernel/sinks/native-sync.js.map +1 -0
  220. package/dist/kernel/sinks/text-formats.d.ts +25 -0
  221. package/dist/kernel/sinks/text-formats.d.ts.map +1 -0
  222. package/dist/kernel/sinks/text-formats.js +69 -0
  223. package/dist/kernel/sinks/text-formats.js.map +1 -0
  224. package/dist/kernel/sinks/text-track-sink.d.ts.map +1 -1
  225. package/dist/kernel/sinks/text-track-sink.js +22 -4
  226. package/dist/kernel/sinks/text-track-sink.js.map +1 -1
  227. package/dist/kernel/timeline.d.ts +10 -6
  228. package/dist/kernel/timeline.d.ts.map +1 -1
  229. package/dist/kernel/timeline.js +14 -6
  230. package/dist/kernel/timeline.js.map +1 -1
  231. package/dist/kernel/track-registry.d.ts +2 -2
  232. package/dist/kernel/track-registry.d.ts.map +1 -1
  233. package/dist/kernel/track-registry.js +5 -3
  234. package/dist/kernel/track-registry.js.map +1 -1
  235. package/dist/kernel/transport.d.ts +8 -0
  236. package/dist/kernel/transport.d.ts.map +1 -1
  237. package/dist/kernel/transport.js +28 -1
  238. package/dist/kernel/transport.js.map +1 -1
  239. package/dist/presets/full/index.d.ts.map +1 -1
  240. package/dist/presets/full/index.js +21 -1
  241. package/dist/presets/full/index.js.map +1 -1
  242. package/dist/protocols/adapter-shared.d.ts +8 -0
  243. package/dist/protocols/adapter-shared.d.ts.map +1 -1
  244. package/dist/protocols/adapter-shared.js +6 -0
  245. package/dist/protocols/adapter-shared.js.map +1 -1
  246. package/dist/protocols/dash-cmaf/index.d.ts +9 -1
  247. package/dist/protocols/dash-cmaf/index.d.ts.map +1 -1
  248. package/dist/protocols/dash-cmaf/index.js +78 -14
  249. package/dist/protocols/dash-cmaf/index.js.map +1 -1
  250. package/dist/protocols/dash-cmaf/parse.d.ts.map +1 -1
  251. package/dist/protocols/dash-cmaf/parse.js +368 -94
  252. package/dist/protocols/dash-cmaf/parse.js.map +1 -1
  253. package/dist/protocols/dash-cmaf/periods-runtime.d.ts +6 -0
  254. package/dist/protocols/dash-cmaf/periods-runtime.d.ts.map +1 -0
  255. package/dist/protocols/dash-cmaf/periods-runtime.js +121 -0
  256. package/dist/protocols/dash-cmaf/periods-runtime.js.map +1 -0
  257. package/dist/protocols/dash-cmaf/periods.d.ts +24 -0
  258. package/dist/protocols/dash-cmaf/periods.d.ts.map +1 -0
  259. package/dist/protocols/dash-cmaf/periods.js +210 -0
  260. package/dist/protocols/dash-cmaf/periods.js.map +1 -0
  261. package/dist/protocols/hls-cmaf/index.d.ts +9 -1
  262. package/dist/protocols/hls-cmaf/index.d.ts.map +1 -1
  263. package/dist/protocols/hls-cmaf/index.js +49 -20
  264. package/dist/protocols/hls-cmaf/index.js.map +1 -1
  265. package/dist/protocols/hls-cmaf/lexer.d.ts.map +1 -1
  266. package/dist/protocols/hls-cmaf/lexer.js +1 -0
  267. package/dist/protocols/hls-cmaf/lexer.js.map +1 -1
  268. package/dist/protocols/hls-cmaf/parse.d.ts +3 -1
  269. package/dist/protocols/hls-cmaf/parse.d.ts.map +1 -1
  270. package/dist/protocols/hls-cmaf/parse.js +137 -12
  271. package/dist/protocols/hls-cmaf/parse.js.map +1 -1
  272. package/dist/protocols/hls-cmaf/unavailable.d.ts +9 -1
  273. package/dist/protocols/hls-cmaf/unavailable.d.ts.map +1 -1
  274. package/dist/protocols/hls-cmaf/unavailable.js +29 -3
  275. package/dist/protocols/hls-cmaf/unavailable.js.map +1 -1
  276. package/dist/protocols/hls-live/index.d.ts +9 -1
  277. package/dist/protocols/hls-live/index.d.ts.map +1 -1
  278. package/dist/protocols/hls-live/index.js +36 -7
  279. package/dist/protocols/hls-live/index.js.map +1 -1
  280. package/dist/stages/abr/index.d.ts.map +1 -1
  281. package/dist/stages/abr/index.js +10 -6
  282. package/dist/stages/abr/index.js.map +1 -1
  283. package/dist/stages/cmcd/index.d.ts.map +1 -1
  284. package/dist/stages/cmcd/index.js +39 -3
  285. package/dist/stages/cmcd/index.js.map +1 -1
  286. package/dist/stages/cmsd/index.d.ts +22 -0
  287. package/dist/stages/cmsd/index.d.ts.map +1 -0
  288. package/dist/stages/cmsd/index.js +65 -0
  289. package/dist/stages/cmsd/index.js.map +1 -0
  290. package/dist/stages/codec-probe/index.d.ts.map +1 -1
  291. package/dist/stages/codec-probe/index.js +30 -3
  292. package/dist/stages/codec-probe/index.js.map +1 -1
  293. package/dist/stages/eme-core/index.d.ts +7 -0
  294. package/dist/stages/eme-core/index.d.ts.map +1 -1
  295. package/dist/stages/eme-core/index.js +26 -0
  296. package/dist/stages/eme-core/index.js.map +1 -1
  297. package/dist/stages/hdr/index.d.ts +22 -0
  298. package/dist/stages/hdr/index.d.ts.map +1 -0
  299. package/dist/stages/hdr/index.js +191 -0
  300. package/dist/stages/hdr/index.js.map +1 -0
  301. package/dist/stages/meta-id3/index.d.ts.map +1 -1
  302. package/dist/stages/meta-id3/index.js +6 -2
  303. package/dist/stages/meta-id3/index.js.map +1 -1
  304. package/dist/stages/qoe/index.d.ts +32 -0
  305. package/dist/stages/qoe/index.d.ts.map +1 -0
  306. package/dist/stages/qoe/index.js +116 -0
  307. package/dist/stages/qoe/index.js.map +1 -0
  308. package/dist/stages/rendition-names/index.d.ts +41 -0
  309. package/dist/stages/rendition-names/index.d.ts.map +1 -0
  310. package/dist/stages/rendition-names/index.js +101 -0
  311. package/dist/stages/rendition-names/index.js.map +1 -0
  312. package/dist/stages/text-cea608/decode.d.ts +23 -2
  313. package/dist/stages/text-cea608/decode.d.ts.map +1 -1
  314. package/dist/stages/text-cea608/decode.js +55 -5
  315. package/dist/stages/text-cea608/decode.js.map +1 -1
  316. package/dist/stages/text-cea608/index.d.ts +9 -9
  317. package/dist/stages/text-cea608/index.d.ts.map +1 -1
  318. package/dist/stages/text-cea608/index.js +31 -105
  319. package/dist/stages/text-cea608/index.js.map +1 -1
  320. package/dist/stages/text-cea708/decode.d.ts +79 -0
  321. package/dist/stages/text-cea708/decode.d.ts.map +1 -0
  322. package/dist/stages/text-cea708/decode.js +404 -0
  323. package/dist/stages/text-cea708/decode.js.map +1 -0
  324. package/dist/stages/text-cea708/index.d.ts +3 -0
  325. package/dist/stages/text-cea708/index.d.ts.map +1 -0
  326. package/dist/stages/text-cea708/index.js +93 -0
  327. package/dist/stages/text-cea708/index.js.map +1 -0
  328. package/dist/stages/text-ttml/index.d.ts +3 -0
  329. package/dist/stages/text-ttml/index.d.ts.map +1 -0
  330. package/dist/stages/text-ttml/index.js +74 -0
  331. package/dist/stages/text-ttml/index.js.map +1 -0
  332. package/dist/stages/text-ttml/parse.d.ts +16 -0
  333. package/dist/stages/text-ttml/parse.d.ts.map +1 -0
  334. package/dist/stages/text-ttml/parse.js +277 -0
  335. package/dist/stages/text-ttml/parse.js.map +1 -0
  336. package/dist/stages/text-webvtt/index.d.ts +6 -13
  337. package/dist/stages/text-webvtt/index.d.ts.map +1 -1
  338. package/dist/stages/text-webvtt/index.js +21 -68
  339. package/dist/stages/text-webvtt/index.js.map +1 -1
  340. package/dist/stages/timed-metadata/index.d.ts +15 -0
  341. package/dist/stages/timed-metadata/index.d.ts.map +1 -0
  342. package/dist/stages/timed-metadata/index.js +370 -0
  343. package/dist/stages/timed-metadata/index.js.map +1 -0
  344. package/dist/types/error.d.ts +1 -1
  345. package/dist/types/error.d.ts.map +1 -1
  346. package/dist/types/facade.d.ts +8 -10
  347. package/dist/types/facade.d.ts.map +1 -1
  348. package/dist/types/ir.d.ts +65 -0
  349. package/dist/types/ir.d.ts.map +1 -1
  350. package/dist/types/kernel.d.ts +8 -0
  351. package/dist/types/kernel.d.ts.map +1 -1
  352. package/dist/types/messages.d.ts +10 -1
  353. package/dist/types/messages.d.ts.map +1 -1
  354. package/dist/types/metadata.d.ts +59 -0
  355. package/dist/types/metadata.d.ts.map +1 -0
  356. package/dist/types/metadata.js +7 -0
  357. package/dist/types/metadata.js.map +1 -0
  358. package/dist/types/quality.d.ts +3 -0
  359. package/dist/types/quality.d.ts.map +1 -1
  360. package/dist/types/stage.d.ts +17 -0
  361. package/dist/types/stage.d.ts.map +1 -1
  362. package/package.json +10 -2
@@ -0,0 +1,134 @@
1
+ import { findRendition } from "../../kernel/presentation.js";
2
+ import { segmentAt } from "../../kernel/timeline.js";
3
+ import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/asyncToGenerator.js";
4
+ //#region src/protocols/dash-cmaf/periods-runtime.ts
5
+ /**
6
+ * What a flattened multi-period presentation needs at playback time, kept
7
+ * in the dash-cmaf stage so the kernel stays unaware of periods:
8
+ *
9
+ * - A segment whose period has another init than its rendition's gets that
10
+ * init in front of it before the append. MSE takes an init and a media
11
+ * segment in one append, and the time probe reads the timescale from the
12
+ * same bytes. The kernel only ever appends the rendition's own init, which
13
+ * this transform sees go by, so it knows which init each buffer holds.
14
+ * - A WebVTT document whose cues count from its period's start gets an
15
+ * `X-TIMESTAMP-MAP` header with that start, which text-webvtt-segmented
16
+ * applies, as for HLS.
17
+ * - A period left out for its codec family is seeked past when playback
18
+ * reaches it.
19
+ *
20
+ * Single-period content takes none of these paths.
21
+ */
22
+ /** Before ts-transmux and caption extraction; decrypt-class steps run first. */
23
+ const PERIODS_ORDER = 10;
24
+ const MPEGTS_CLOCK = 9e4;
25
+ const keyOf = (ref) => {
26
+ var _ref$byteRange$start, _ref$byteRange, _ref$byteRange$end, _ref$byteRange2;
27
+ return `${ref.url}|${(_ref$byteRange$start = (_ref$byteRange = ref.byteRange) === null || _ref$byteRange === void 0 ? void 0 : _ref$byteRange.start) !== null && _ref$byteRange$start !== void 0 ? _ref$byteRange$start : ""}-${(_ref$byteRange$end = (_ref$byteRange2 = ref.byteRange) === null || _ref$byteRange2 === void 0 ? void 0 : _ref$byteRange2.end) !== null && _ref$byteRange$end !== void 0 ? _ref$byteRange$end : ""}`;
28
+ };
29
+ /** Whether any segment of the presentation carries its own init. */
30
+ function hasPeriodInits(presentation) {
31
+ return presentation.periods.some((period) => period.tracks.some((track) => track.renditions.some((rendition) => Array.isArray(rendition.segments) && rendition.segments.some((segment) => segment.init !== void 0))));
32
+ }
33
+ function installPeriods(ctx, skips) {
34
+ const element = ctx.element;
35
+ /** By buffer (content type): the init it last received. Null after a seek: unknown. */
36
+ const holds = /* @__PURE__ */ new Map();
37
+ const inits = /* @__PURE__ */ new Map();
38
+ let seen = null;
39
+ let periodInits = false;
40
+ function initBytes(ref) {
41
+ const key = keyOf(ref);
42
+ let bytes = inits.get(key);
43
+ if (bytes === void 0) {
44
+ const headers = ref.byteRange === void 0 ? {} : { Range: `bytes=${ref.byteRange.start}-${ref.byteRange.end}` };
45
+ bytes = ctx.request(ref.url, { headers }).then(function() {
46
+ var _ref = _asyncToGenerator(function* (response) {
47
+ if (!response.ok) throw new Error(`period init ${ref.url}: HTTP ${response.status}`);
48
+ return new Uint8Array(yield response.arrayBuffer());
49
+ });
50
+ return function(_x) {
51
+ return _ref.apply(this, arguments);
52
+ };
53
+ }());
54
+ bytes.catch(() => inits.delete(key));
55
+ inits.set(key, bytes);
56
+ }
57
+ return bytes;
58
+ }
59
+ function transform(_x2, _x3) {
60
+ return _transform.apply(this, arguments);
61
+ }
62
+ function _transform() {
63
+ _transform = _asyncToGenerator(function* (data, meta) {
64
+ var _segmentAt$init, _segmentAt2;
65
+ const presentation = ctx.getState().presentation;
66
+ if (presentation !== seen) {
67
+ seen = presentation;
68
+ periodInits = presentation !== null && hasPeriodInits(presentation);
69
+ holds.clear();
70
+ inits.clear();
71
+ }
72
+ const site = findRendition(presentation, meta.renditionId);
73
+ if (site === null) return data;
74
+ const { rendition, period } = site;
75
+ if (meta.contentType === "text") {
76
+ var _segmentAt;
77
+ if (meta.isInit || site.track.mimeType !== "text/vtt") return data;
78
+ const offset = (_segmentAt = segmentAt(rendition.segments, meta.seq, period.start)) === null || _segmentAt === void 0 ? void 0 : _segmentAt.timeOffset;
79
+ if (offset === void 0) return data;
80
+ const text = new TextDecoder().decode(data);
81
+ if (text.includes("X-TIMESTAMP-MAP")) return data;
82
+ const map = `X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:${Math.round(offset * MPEGTS_CLOCK)}`;
83
+ return new TextEncoder().encode(text.replace(/^([^\r\n]*)(\r?\n)/, `$1$2${map}$2`));
84
+ }
85
+ if (!periodInits || meta.contentType !== "video" && meta.contentType !== "audio") return data;
86
+ if (meta.isInit) {
87
+ if (rendition.init !== void 0) holds.set(meta.contentType, keyOf(rendition.init));
88
+ return data;
89
+ }
90
+ const need = (_segmentAt$init = (_segmentAt2 = segmentAt(rendition.segments, meta.seq, period.start)) === null || _segmentAt2 === void 0 ? void 0 : _segmentAt2.init) !== null && _segmentAt$init !== void 0 ? _segmentAt$init : rendition.init;
91
+ if (need === void 0 || holds.get(meta.contentType) === keyOf(need)) return data;
92
+ const init = yield initBytes(need);
93
+ holds.set(meta.contentType, keyOf(need));
94
+ const joined = new Uint8Array(init.byteLength + data.byteLength);
95
+ joined.set(init, 0);
96
+ joined.set(data, init.byteLength);
97
+ return joined;
98
+ });
99
+ return _transform.apply(this, arguments);
100
+ }
101
+ ctx.registerTransform({
102
+ name: "dash-periods",
103
+ order: PERIODS_ORDER,
104
+ transform
105
+ });
106
+ const onSeeking = () => {
107
+ for (const type of holds.keys()) holds.set(type, null);
108
+ };
109
+ const skipPast = () => {
110
+ if (element.seeking) return;
111
+ const time = element.currentTime;
112
+ const skip = skips().find((span) => time >= span.start - .5 && time < span.end);
113
+ if (skip !== void 0) ctx.dispatch({
114
+ type: "SEEK",
115
+ to: skip.end + .05
116
+ });
117
+ };
118
+ element.addEventListener("seeking", onSeeking);
119
+ for (const name of [
120
+ "timeupdate",
121
+ "waiting",
122
+ "seeked"
123
+ ]) element.addEventListener(name, skipPast);
124
+ return () => {
125
+ element.removeEventListener("seeking", onSeeking);
126
+ for (const name of [
127
+ "timeupdate",
128
+ "waiting",
129
+ "seeked"
130
+ ]) element.removeEventListener(name, skipPast);
131
+ };
132
+ }
133
+ //#endregion
134
+ export { installPeriods };
@@ -0,0 +1,178 @@
1
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/objectSpread2.js";
2
+ import { isIndexed, isUnresolved, segmentAt } from "../../kernel/timeline.js";
3
+ //#region src/protocols/dash-cmaf/periods.ts
4
+ /**
5
+ * Several DASH Periods as one continuous presentation, the way Shaka
6
+ * Player combines periods. Each logical track keeps one id for the whole
7
+ * presentation, and its renditions list every period's segments in order.
8
+ * A period boundary is a discontinuity, so the kernel's epoch model, the
9
+ * same one HLS discontinuities use, settles each period's timestamp offset
10
+ * from the media's own decode times. Nothing about periods reaches the
11
+ * kernel.
12
+ *
13
+ * Tracks match across periods by, in order: the period continuity or
14
+ * connectivity descriptor (ISO/IEC 23009-1 §5.3.2.4), the AdaptationSet id,
15
+ * then content type, language, role, and codec family. A period without a
16
+ * match fills an audio or video track with its closest track (same
17
+ * language, then same codec family, then the first), so playback never
18
+ * meets a hole; a text track simply has nothing there. Renditions pair by
19
+ * the nearest bitrate.
20
+ *
21
+ * A segment whose period has another init than its rendition's carries it
22
+ * (`Segment.init`): the dash-cmaf stage puts it in front of the segment
23
+ * before the append. A period whose codec family differs from the first
24
+ * period's is left out, with a warning: switching families needs a
25
+ * `changeType()`, which only the kernel can call. Text whose times count
26
+ * from its period's start carries that start (`Segment.timeOffset`).
27
+ */
28
+ /** The codec family, as `changeType()` cares: avc1 and avc3 are one, hvc1 and hev1 are one. */
29
+ function family(codecs) {
30
+ var _split$0$trim$split$, _split$;
31
+ const first = (_split$0$trim$split$ = (_split$ = (codecs !== null && codecs !== void 0 ? codecs : "").split(",")[0]) === null || _split$ === void 0 || (_split$ = _split$.trim().split(".")[0]) === null || _split$ === void 0 ? void 0 : _split$.toLowerCase()) !== null && _split$0$trim$split$ !== void 0 ? _split$0$trim$split$ : "";
32
+ if (first === "avc3") return "avc1";
33
+ if (first === "hev1") return "hvc1";
34
+ if (first === "dvhe") return "dvh1";
35
+ return first;
36
+ }
37
+ /** Text whose cue times count from its period's start: whole documents, not fMP4 samples. */
38
+ function periodRelative(track) {
39
+ return track.mimeType === "text/vtt" || track.mimeType === "application/ttml+xml";
40
+ }
41
+ /** A rendition's segments as a list, or null when only an index would tell (SegmentBase). */
42
+ function listed(rendition, periodStart) {
43
+ const addressing = rendition.segments;
44
+ if (isUnresolved(addressing)) return null;
45
+ if (!isIndexed(addressing)) return [...addressing];
46
+ if (addressing.endSeq === null) return null;
47
+ const out = [];
48
+ for (let seq = addressing.startSeq; seq <= addressing.endSeq; seq += 1) {
49
+ const segment = segmentAt(addressing, seq, periodStart);
50
+ if (segment !== null) out.push(segment);
51
+ }
52
+ return out;
53
+ }
54
+ function sameRef(a, b) {
55
+ var _a$byteRange, _b$byteRange, _a$byteRange2, _b$byteRange2;
56
+ return (a === null || a === void 0 ? void 0 : a.url) === (b === null || b === void 0 ? void 0 : b.url) && (a === null || a === void 0 || (_a$byteRange = a.byteRange) === null || _a$byteRange === void 0 ? void 0 : _a$byteRange.start) === (b === null || b === void 0 || (_b$byteRange = b.byteRange) === null || _b$byteRange === void 0 ? void 0 : _b$byteRange.start) && (a === null || a === void 0 || (_a$byteRange2 = a.byteRange) === null || _a$byteRange2 === void 0 ? void 0 : _a$byteRange2.end) === (b === null || b === void 0 || (_b$byteRange2 = b.byteRange) === null || _b$byteRange2 === void 0 ? void 0 : _b$byteRange2.end);
57
+ }
58
+ function nearest(renditions, bitrate) {
59
+ let best;
60
+ for (const rendition of renditions) if (best === void 0 || Math.abs(rendition.bitrate - bitrate) < Math.abs(best.bitrate - bitrate)) best = rendition;
61
+ return best;
62
+ }
63
+ /** Combines the periods, or null when one of them lists no segments (SegmentBase). */
64
+ function flattenPeriods(periods) {
65
+ const logical = [];
66
+ const captions = /* @__PURE__ */ new Map();
67
+ periods.forEach((period, index) => {
68
+ for (const track of period.tracks) {
69
+ var _ref, _open$find, _meta$asId;
70
+ if (track.renditions.length === 0) {
71
+ if (!captions.has(track.id)) captions.set(track.id, track);
72
+ continue;
73
+ }
74
+ const meta = period.matching.get(track.id);
75
+ const open = logical.filter((l) => !l.byPeriod.has(index) && l.base.contentType === track.contentType);
76
+ const earlier = new Set(periods.slice(0, index).map((p) => p.id));
77
+ const match = (_ref = (_open$find = open.find((l) => meta !== void 0 && l.asId === meta.asId && meta.follows.some((id) => earlier.has(id)))) !== null && _open$find !== void 0 ? _open$find : open.find((l) => (meta === null || meta === void 0 ? void 0 : meta.asId) != null && l.asId === meta.asId)) !== null && _ref !== void 0 ? _ref : open.find((l) => {
78
+ var _l$base$renditions$0$, _l$base$renditions$, _track$renditions$0$c, _track$renditions$;
79
+ return l.base.lang === track.lang && l.base.role === track.role && family((_l$base$renditions$0$ = (_l$base$renditions$ = l.base.renditions[0]) === null || _l$base$renditions$ === void 0 ? void 0 : _l$base$renditions$.codecs) !== null && _l$base$renditions$0$ !== void 0 ? _l$base$renditions$0$ : null) === family((_track$renditions$0$c = (_track$renditions$ = track.renditions[0]) === null || _track$renditions$ === void 0 ? void 0 : _track$renditions$.codecs) !== null && _track$renditions$0$c !== void 0 ? _track$renditions$0$c : null);
80
+ });
81
+ if (match !== void 0) {
82
+ match.byPeriod.set(index, track);
83
+ continue;
84
+ }
85
+ if (track.contentType === "video" && logical.some((l) => l.base.contentType === "video")) continue;
86
+ const taken = logical.some((l) => l.id === track.id);
87
+ logical.push({
88
+ id: taken ? `${period.id}/${track.id}` : track.id,
89
+ base: track,
90
+ baseIndex: index,
91
+ asId: (_meta$asId = meta === null || meta === void 0 ? void 0 : meta.asId) !== null && _meta$asId !== void 0 ? _meta$asId : null,
92
+ byPeriod: /* @__PURE__ */ new Map([[index, track]])
93
+ });
94
+ }
95
+ });
96
+ for (const l of logical) {
97
+ if (l.base.contentType !== "audio" && l.base.contentType !== "video") continue;
98
+ periods.forEach((period, index) => {
99
+ var _ref2, _ref3, _candidates$find;
100
+ if (l.byPeriod.has(index)) return;
101
+ const candidates = period.tracks.filter((t) => t.contentType === l.base.contentType && t.renditions.length > 0 && t.role !== "trick");
102
+ const sameFamily = (t) => {
103
+ var _t$renditions$0$codec, _t$renditions$, _l$base$renditions$0$2, _l$base$renditions$2;
104
+ return family((_t$renditions$0$codec = (_t$renditions$ = t.renditions[0]) === null || _t$renditions$ === void 0 ? void 0 : _t$renditions$.codecs) !== null && _t$renditions$0$codec !== void 0 ? _t$renditions$0$codec : null) === family((_l$base$renditions$0$2 = (_l$base$renditions$2 = l.base.renditions[0]) === null || _l$base$renditions$2 === void 0 ? void 0 : _l$base$renditions$2.codecs) !== null && _l$base$renditions$0$2 !== void 0 ? _l$base$renditions$0$2 : null);
105
+ };
106
+ const sameLanguage = (t) => t.lang !== void 0 && t.lang === l.base.lang;
107
+ const closest = (_ref2 = (_ref3 = (_candidates$find = candidates.find((t) => sameLanguage(t) && sameFamily(t))) !== null && _candidates$find !== void 0 ? _candidates$find : candidates.find(sameFamily)) !== null && _ref3 !== void 0 ? _ref3 : candidates.find(sameLanguage)) !== null && _ref2 !== void 0 ? _ref2 : candidates[0];
108
+ if (closest !== void 0) l.byPeriod.set(index, closest);
109
+ });
110
+ }
111
+ const warnings = [];
112
+ const skipped = /* @__PURE__ */ new Set();
113
+ periods.forEach((period, index) => {
114
+ for (const l of logical) {
115
+ var _l$base$renditions$0$3, _l$base$renditions$3, _track$renditions$0$c2, _track$renditions$2;
116
+ if (l.baseIndex !== 0) continue;
117
+ if (l.base.contentType !== "audio" && l.base.contentType !== "video") continue;
118
+ const track = l.byPeriod.get(index);
119
+ const declared = (_l$base$renditions$0$3 = (_l$base$renditions$3 = l.base.renditions[0]) === null || _l$base$renditions$3 === void 0 ? void 0 : _l$base$renditions$3.codecs) !== null && _l$base$renditions$0$3 !== void 0 ? _l$base$renditions$0$3 : null;
120
+ const actual = (_track$renditions$0$c2 = track === null || track === void 0 || (_track$renditions$2 = track.renditions[0]) === null || _track$renditions$2 === void 0 ? void 0 : _track$renditions$2.codecs) !== null && _track$renditions$0$c2 !== void 0 ? _track$renditions$0$c2 : null;
121
+ if (track === void 0 || family(declared) === family(actual) || skipped.has(index)) continue;
122
+ skipped.add(index);
123
+ warnings.push({
124
+ category: "media",
125
+ code: "MEDIA_CODEC_MISMATCH",
126
+ fatal: false,
127
+ recoverable: true,
128
+ context: {
129
+ kind: "family",
130
+ declared: declared !== null && declared !== void 0 ? declared : "",
131
+ probed: actual !== null && actual !== void 0 ? actual : "",
132
+ period: period.id,
133
+ start: period.start,
134
+ end: period.duration === null ? period.start : period.start + period.duration
135
+ }
136
+ });
137
+ }
138
+ });
139
+ const tracks = [];
140
+ for (const l of logical) {
141
+ const renditions = [];
142
+ for (const base of l.base.renditions) {
143
+ const segments = [];
144
+ for (let index = 0; index < periods.length; index += 1) {
145
+ var _track$renditions$0$c3, _track$renditions$3;
146
+ const period = periods[index];
147
+ const track = l.byPeriod.get(index);
148
+ if (track === void 0 || skipped.has(index)) continue;
149
+ if ((track.contentType === "audio" || track.contentType === "video") && family((_track$renditions$0$c3 = (_track$renditions$3 = track.renditions[0]) === null || _track$renditions$3 === void 0 ? void 0 : _track$renditions$3.codecs) !== null && _track$renditions$0$c3 !== void 0 ? _track$renditions$0$c3 : null) !== family(base.codecs)) continue;
150
+ const rendition = track === l.base ? base : nearest(track.renditions, base.bitrate);
151
+ if (rendition === void 0) continue;
152
+ const list = listed(rendition, period.start);
153
+ if (list === null) return null;
154
+ const init = sameRef(rendition.init, base.init) ? void 0 : rendition.init;
155
+ const offset = periodRelative(track) && period.start !== 0 ? period.start : 0;
156
+ list.forEach((segment, i) => {
157
+ segments.push(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, segment), {}, { seq: segments.length }, i === 0 ? {
158
+ discontinuity: index > 0,
159
+ discontinuitySequence: index
160
+ } : {}), init !== void 0 ? { init } : {}), offset !== 0 ? { timeOffset: offset } : {}));
161
+ });
162
+ }
163
+ renditions.push(_objectSpread2(_objectSpread2({}, base), {}, { segments }));
164
+ }
165
+ tracks.push(_objectSpread2(_objectSpread2({}, l.base), {}, {
166
+ id: l.id,
167
+ renditions
168
+ }));
169
+ }
170
+ for (const caption of captions.values()) tracks.push(caption);
171
+ return {
172
+ tracks,
173
+ events: periods.flatMap((period) => period.events),
174
+ warnings
175
+ };
176
+ }
177
+ //#endregion
178
+ export { flattenPeriods };
@@ -1,4 +1,4 @@
1
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/objectSpread2.js";
1
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/objectSpread2.js";
2
2
  import { scheduled, tickAfter } from "../../kernel/effects.js";
3
3
  import { registerLiveNamespace } from "../live-shared.js";
4
4
  import { parse } from "../dash-cmaf/parse.js";
@@ -1,10 +1,10 @@
1
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/objectSpread2.js";
2
- import { scheduled } from "../../kernel/effects.js";
1
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/objectSpread2.js";
2
+ import { scheduled, tickAfter } from "../../kernel/effects.js";
3
3
  import { normalizeMimeType } from "../../kernel/mime.js";
4
4
  import { activeRenditions } from "../../kernel/rendition-select.js";
5
5
  import { manifestFact } from "../adapter-shared.js";
6
6
  import { parse, parseMediaPlaylist, refreshFor } from "./parse.js";
7
- import { LOAD_FAILED, unavailableMessages } from "./unavailable.js";
7
+ import { LOAD_FAILED, readmitMessage, unavailableMessages } from "./unavailable.js";
8
8
  //#region src/protocols/hls-cmaf/index.ts
9
9
  /**
10
10
  * The hls-cmaf protocol adapter as a stage. Inert module: exports a
@@ -18,6 +18,8 @@ import { LOAD_FAILED, unavailableMessages } from "./unavailable.js";
18
18
  * fetch under `hls:pl:` tokens the transport correlates back by token.
19
19
  */
20
20
  const PLAYLIST_TOKEN = "hls:pl:";
21
+ /** A failed playlist's retry, by URL: `hls:retry:<url>`. */
22
+ const RETRY_TOKEN = "hls:retry:";
21
23
  /** The playlist MIME types, RFC 8216 §4: the registered type and the three in common use. */
22
24
  const MANIFEST_TYPES = [
23
25
  "application/vnd.apple.mpegurl",
@@ -76,22 +78,41 @@ function renditionsAt(presentation, url) {
76
78
  function feed(message) {
77
79
  return scheduled("hls:loopback", message);
78
80
  }
81
+ /** The renditions of every playlist that failed and is not being retried yet. */
82
+ function failedRenditions(state, presentation) {
83
+ const failed = [];
84
+ for (const [url, ok] of Object.entries(state.answered)) if (!ok) for (const rendition of renditionsAt(presentation, url)) failed.push(rendition.id);
85
+ return failed;
86
+ }
79
87
  /**
80
88
  * A playlist that failed to load or parse. Its renditions are excluded,
81
- * so arbitration moves off them and nothing asks for the playlist again.
82
- * When that leaves a media track with no rendition at all, the load
83
- * fails: the stream cannot play, and waiting would only stall.
89
+ * so arbitration moves off them and nothing asks for the playlist again
90
+ * until its retry. When that leaves a media track with no rendition at
91
+ * all, the load fails: the stream cannot play, and waiting would only stall.
84
92
  */
85
- function unavailable(state, kernel, url, error) {
86
- const answered = _objectSpread2(_objectSpread2({}, state.answered), {}, { [url]: false });
87
- const next = _objectSpread2(_objectSpread2({}, state), {}, { answered });
93
+ function unavailable(state, kernel, url, error, retryMs) {
94
+ const next = _objectSpread2(_objectSpread2({}, state), {}, { answered: _objectSpread2(_objectSpread2({}, state.answered), {}, { [url]: false }) });
88
95
  const presentation = kernel.presentation;
89
96
  if (presentation === null) return [next, []];
90
- const failed = [];
91
- for (const [failedUrl, ok] of Object.entries(answered)) if (!ok) for (const rendition of renditionsAt(presentation, failedUrl)) failed.push(rendition.id);
92
- return [next, unavailableMessages(kernel, LOAD_FAILED, failed, error).map(feed)];
97
+ const messages = unavailableMessages(kernel, LOAD_FAILED, failedRenditions(next, presentation), error);
98
+ const effects = messages.map(feed);
99
+ if (Number.isFinite(retryMs) && !messages.some((m) => m.type === "MANIFEST_FAILED")) effects.push(tickAfter(`${RETRY_TOKEN}${url}`, retryMs));
100
+ return [next, effects];
101
+ }
102
+ /**
103
+ * The retry of a failed playlist: forget the failure, so its renditions
104
+ * return to arbitration and the selection fetches the playlist again when
105
+ * it needs it. Another failure excludes it again for another wait.
106
+ */
107
+ function retry(state, kernel, url) {
108
+ if (state.answered[url] !== false || kernel.presentation === null) return [state, []];
109
+ const answered = _objectSpread2({}, state.answered);
110
+ delete answered[url];
111
+ const next = _objectSpread2(_objectSpread2({}, state), {}, { answered });
112
+ const message = readmitMessage(kernel, LOAD_FAILED, failedRenditions(next, kernel.presentation));
113
+ return [next, message === null ? [] : [feed(message)]];
93
114
  }
94
- const reduceHls = (slice, msg, kernel) => {
115
+ const createReduceHls = (retryMs) => (slice, msg, kernel) => {
95
116
  const state = slice !== null && slice !== void 0 ? slice : INITIAL;
96
117
  if (msg.type === "LOAD") return [_objectSpread2(_objectSpread2({}, INITIAL), {}, {
97
118
  manifestUrl: msg.url,
@@ -102,6 +123,7 @@ const reduceHls = (slice, msg, kernel) => {
102
123
  const fact = manifestFact(msg.bytes, state.manifestUrl, (text) => claims(state, text), parse);
103
124
  return [state, fact === null ? [] : [feed(fact)]];
104
125
  }
126
+ if (msg.type === "TICK" && msg.token.startsWith(RETRY_TOKEN)) return retry(state, kernel, msg.token.slice(10));
105
127
  let next = state;
106
128
  const effects = [];
107
129
  if (msg.type === "SEGMENT_LOADED" && msg.trackId in state.pending) {
@@ -130,7 +152,7 @@ const reduceHls = (slice, msg, kernel) => {
130
152
  url
131
153
  }
132
154
  });
133
- const [failed, failEffects] = unavailable(next, kernel, url, error);
155
+ const [failed, failEffects] = unavailable(next, kernel, url, error, retryMs);
134
156
  return [failed, [...effects, ...failEffects]];
135
157
  }
136
158
  next = _objectSpread2(_objectSpread2({}, next), {}, { answered: _objectSpread2(_objectSpread2({}, next.answered), {}, { [url]: true }) });
@@ -144,7 +166,7 @@ const reduceHls = (slice, msg, kernel) => {
144
166
  const url = state.pending[msg.trackId];
145
167
  const pending = _objectSpread2({}, state.pending);
146
168
  delete pending[msg.trackId];
147
- return unavailable(_objectSpread2(_objectSpread2({}, next), {}, { pending }), kernel, url, msg.error);
169
+ return unavailable(_objectSpread2(_objectSpread2({}, next), {}, { pending }), kernel, url, msg.error, retryMs);
148
170
  }
149
171
  if (kernel.lifecycle.phase !== "ready" || kernel.presentation === null) return [next, effects];
150
172
  const key = `${kernel.quality.version}:${kernel.quality.active}`;
@@ -168,12 +190,14 @@ const reduceHls = (slice, msg, kernel) => {
168
190
  * The stage factory. `mattebox({ stages: [hlsCmaf()] })` is all a consumer
169
191
  * needs for HLS-CMAF VOD.
170
192
  */
171
- function hlsCmaf() {
193
+ function hlsCmaf(options = {}) {
194
+ var _options$unavailableR;
195
+ const retryMs = ((_options$unavailableR = options.unavailableRetrySeconds) !== null && _options$unavailableR !== void 0 ? _options$unavailableR : 15) * 1e3;
172
196
  return {
173
197
  name: "hls-cmaf",
174
198
  provides: ["hls-cmaf", ...MANIFEST_TYPES],
175
199
  install(ctx) {
176
- ctx.reduce("hls", reduceHls);
200
+ ctx.reduce("hls", createReduceHls(retryMs));
177
201
  }
178
202
  };
179
203
  }
@@ -10,7 +10,8 @@ const ATTRIBUTE_TAGS = /* @__PURE__ */ new Set([
10
10
  "EXT-X-I-FRAME-STREAM-INF",
11
11
  "EXT-X-IMAGE-STREAM-INF",
12
12
  "EXT-X-TILES",
13
- "EXT-X-CONTENT-STEERING"
13
+ "EXT-X-CONTENT-STEERING",
14
+ "EXT-X-DATERANGE"
14
15
  ]);
15
16
  /**
16
17
  * RFC 8216 §4.2: comma-separated KEY=VALUE pairs where a quoted-string