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,82 @@
1
+ import { adoptTextTrack, emptyTextTrack } from "./text-track-sink.js";
2
+ import { syncNativeTracks } from "./native-sync.js";
3
+ //#region src/kernel/sinks/caption-tracks.ts
4
+ /** A VTTCue, or null where the browser has none. */
5
+ function vttCue(start, end, text) {
6
+ const Ctor = globalThis.VTTCue;
7
+ return Ctor === void 0 ? null : new Ctor(start, end, text);
8
+ }
9
+ /** Wires a caption format's channels to tracks. `prefix` names added tracks, as `cea608:CC1`. */
10
+ function inbandCaptions(ctx, mime, prefix) {
11
+ const element = ctx.element;
12
+ const natives = /* @__PURE__ */ new Map();
13
+ const adding = /* @__PURE__ */ new Set();
14
+ function declared() {
15
+ var _ctx$getState$present, _ctx$getState$present2;
16
+ const out = [];
17
+ for (const period of (_ctx$getState$present = (_ctx$getState$present2 = ctx.getState().presentation) === null || _ctx$getState$present2 === void 0 ? void 0 : _ctx$getState$present2.periods) !== null && _ctx$getState$present !== void 0 ? _ctx$getState$present : []) for (const track of period.tracks) if (track.mimeType === mime) out.push(track);
18
+ return out;
19
+ }
20
+ /** The channel's caption track in the presentation, declared or added. */
21
+ function captionTrack(channel) {
22
+ var _declared$find;
23
+ return (_declared$find = declared().find((track) => track.instreamId === channel)) !== null && _declared$find !== void 0 ? _declared$find : null;
24
+ }
25
+ /** The channel's native track, created on first need. Hidden keeps cues arriving and removable. */
26
+ function ensureNative(channel) {
27
+ let native = natives.get(channel);
28
+ if (native === void 0) {
29
+ var _captionTrack;
30
+ native = adoptTextTrack(element, "captions", channel, (_captionTrack = captionTrack(channel)) === null || _captionTrack === void 0 ? void 0 : _captionTrack.lang);
31
+ native.mode = "hidden";
32
+ natives.set(channel, native);
33
+ }
34
+ return native;
35
+ }
36
+ const stopSync = syncNativeTracks(ctx, {
37
+ tracks: () => declared().filter((track) => track.instreamId !== void 0),
38
+ native: (track, create) => {
39
+ var _natives$get;
40
+ const channel = track.instreamId;
41
+ return (_natives$get = natives.get(channel)) !== null && _natives$get !== void 0 ? _natives$get : create ? ensureNative(channel) : null;
42
+ },
43
+ idle: "hidden",
44
+ before() {
45
+ for (const channel of [...adding]) if (captionTrack(channel) === null) adding.delete(channel);
46
+ }
47
+ });
48
+ return {
49
+ show(channel, cues) {
50
+ if (cues.length === 0) return;
51
+ if (captionTrack(channel) === null && !adding.has(channel)) {
52
+ if (ctx.getState().presentation !== null) {
53
+ adding.add(channel);
54
+ ctx.dispatch({
55
+ type: "ADD_TRACK",
56
+ track: {
57
+ id: `${prefix}:${channel}`,
58
+ contentType: "text",
59
+ mimeType: mime,
60
+ protection: null,
61
+ role: "caption",
62
+ instreamId: channel,
63
+ renditions: []
64
+ }
65
+ });
66
+ }
67
+ }
68
+ const target = ensureNative(channel);
69
+ for (const cue of cues) target.addCue(cue);
70
+ },
71
+ dispose() {
72
+ stopSync();
73
+ for (const native of natives.values()) {
74
+ emptyTextTrack(native);
75
+ native.mode = "disabled";
76
+ }
77
+ natives.clear();
78
+ }
79
+ };
80
+ }
81
+ //#endregion
82
+ export { inbandCaptions, vttCue };
@@ -0,0 +1,46 @@
1
+ //#region src/kernel/sinks/native-sync.ts
2
+ /** Starts the sync; returns its teardown. */
3
+ function syncNativeTracks(ctx, sync) {
4
+ const activeId = () => ctx.getState().tracks.active.get("text");
5
+ function mirror() {
6
+ var _sync$before;
7
+ (_sync$before = sync.before) === null || _sync$before === void 0 || _sync$before.call(sync);
8
+ const active = activeId();
9
+ for (const track of sync.tracks()) {
10
+ const showing = track.id === active;
11
+ const native = sync.native(track, showing);
12
+ if (native === null) continue;
13
+ const mode = showing ? "showing" : sync.idle;
14
+ if (native.mode !== mode) native.mode = mode;
15
+ }
16
+ }
17
+ function onNativeChange() {
18
+ const active = activeId();
19
+ const tracks = sync.tracks();
20
+ const showing = tracks.find((track) => {
21
+ var _sync$native;
22
+ return ((_sync$native = sync.native(track, false)) === null || _sync$native === void 0 ? void 0 : _sync$native.mode) === "showing";
23
+ });
24
+ if (showing !== void 0) {
25
+ if (showing.id !== active) ctx.dispatch({
26
+ type: "SELECT_TRACK",
27
+ trackId: showing.id
28
+ });
29
+ } else if (tracks.some((track) => track.id === active)) ctx.dispatch({
30
+ type: "DESELECT_TRACK",
31
+ contentType: "text"
32
+ });
33
+ }
34
+ const offChanged = ctx.on("tracks:changed", mirror);
35
+ const offSelected = ctx.on("tracks:selected", (payload) => {
36
+ if (payload.contentType === "text") mirror();
37
+ });
38
+ ctx.element.textTracks.addEventListener("change", onNativeChange);
39
+ return () => {
40
+ offChanged();
41
+ offSelected();
42
+ ctx.element.textTracks.removeEventListener("change", onNativeChange);
43
+ };
44
+ }
45
+ //#endregion
46
+ export { syncNativeTracks };
@@ -0,0 +1,64 @@
1
+ import { cueFormat } from "../mime.js";
2
+ import { createTextTrackSink } from "./text-track-sink.js";
3
+ import { syncNativeTracks } from "./native-sync.js";
4
+ //#region src/kernel/sinks/text-formats.ts
5
+ const shared = /* @__PURE__ */ new WeakMap();
6
+ /** The cue format of a text track: its MIME type, with the codec family in fMP4. */
7
+ function trackFormat(track) {
8
+ var _track$renditions$;
9
+ return cueFormat(track.mimeType, (_track$renditions$ = track.renditions[0]) === null || _track$renditions$ === void 0 ? void 0 : _track$renditions$.codecs);
10
+ }
11
+ /** Joins the stage to the element's text sink with its parsers. Returns the stage's teardown. */
12
+ function joinTextSink(ctx, parsers) {
13
+ const { element } = ctx;
14
+ let entry = shared.get(element);
15
+ const owner = entry === void 0;
16
+ if (entry === void 0) {
17
+ const map = /* @__PURE__ */ new Map();
18
+ const sink = createTextTrackSink({
19
+ element,
20
+ parse(data, meta) {
21
+ var _meta$format;
22
+ const parse = map.get((_meta$format = meta.format) !== null && _meta$format !== void 0 ? _meta$format : "text/vtt");
23
+ if (parse === void 0) throw new RangeError(`no parser for '${meta.format}'`);
24
+ return parse(data, meta);
25
+ }
26
+ });
27
+ entry = {
28
+ sink,
29
+ parsers: map
30
+ };
31
+ shared.set(element, entry);
32
+ ctx.registerSink("text", () => sink);
33
+ }
34
+ const { sink } = entry;
35
+ const formats = new Set(Object.keys(parsers));
36
+ for (const [format, parse] of Object.entries(parsers)) {
37
+ entry.parsers.set(format, parse);
38
+ ctx.registerParser(format, parse);
39
+ }
40
+ function texts() {
41
+ const presentation = ctx.getState().presentation;
42
+ if (presentation === null) return [];
43
+ return presentation.periods.flatMap((period) => period.tracks.filter((track) => track.contentType === "text"));
44
+ }
45
+ const stopSync = syncNativeTracks(ctx, {
46
+ tracks: () => texts().filter((track) => formats.has(trackFormat(track))),
47
+ native: (track) => sink.declare(track.id),
48
+ idle: "disabled",
49
+ before() {
50
+ const current = new Set(texts().map((track) => track.id));
51
+ for (const id of sink.trackIds()) if (!current.has(id)) sink.retire(id);
52
+ }
53
+ });
54
+ return () => {
55
+ stopSync();
56
+ for (const format of formats) entry.parsers.delete(format);
57
+ if (owner) {
58
+ sink.dispose();
59
+ shared.delete(element);
60
+ }
61
+ };
62
+ }
63
+ //#endregion
64
+ export { joinTextSink, trackFormat };
@@ -1,18 +1,26 @@
1
1
  //#region src/kernel/sinks/text-track-sink.ts
2
- /** Applies the WebVTT settings string's known keys onto a native cue. */
2
+ /**
3
+ * Applies the WebVTT settings string's known keys onto a native cue
4
+ * (WebVTT §4.3). `line` and `position` may carry an alignment after a comma;
5
+ * a browser without `lineAlign` or `positionAlign` ignores it.
6
+ */
3
7
  function applySettings(cue, settings) {
4
8
  if (settings === void 0) return;
9
+ const loose = cue;
5
10
  for (const part of settings.split(/\s+/)) {
6
- const [key, value] = part.split(":");
7
- if (value === void 0) continue;
11
+ const [key, setting] = part.split(":");
12
+ if (setting === void 0) continue;
13
+ const [value, alignment] = setting.split(",");
8
14
  const percent = value.endsWith("%") ? Number(value.slice(0, -1)) : null;
9
15
  switch (key) {
10
16
  case "line":
11
17
  cue.line = percent !== null && percent !== void 0 ? percent : Number(value);
12
18
  if (percent !== null) cue.snapToLines = false;
19
+ if (alignment !== void 0) loose.lineAlign = alignment;
13
20
  break;
14
21
  case "position":
15
22
  if (percent !== null) cue.position = percent;
23
+ if (alignment !== void 0) loose.positionAlign = alignment;
16
24
  break;
17
25
  case "size":
18
26
  if (percent !== null) cue.size = percent;
@@ -140,7 +148,10 @@ function createCueSink(contentType, kind, deps) {
140
148
  vtt.id = cue.id;
141
149
  entry.ids.add(cue.id);
142
150
  }
143
- applySettings(vtt, cue.settings);
151
+ try {
152
+ applySettings(vtt, cue.settings);
153
+ } catch (_unused) {}
154
+ if (cue.payload !== void 0) vtt.payload = cue.payload;
144
155
  entry.textTrack.addCue(vtt);
145
156
  }
146
157
  },
@@ -1,3 +1,4 @@
1
+ import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/objectSpread2.js";
1
2
  //#region src/kernel/timeline.ts
2
3
  function isIndexed(addressing) {
3
4
  return !Array.isArray(addressing) && addressing.kind === "indexed";
@@ -34,12 +35,12 @@ function buildEpochs(parts) {
34
35
  let open = false;
35
36
  for (const segment of addressing) if (!open || segment.discontinuity === true) {
36
37
  const mediaStart = open ? 0 : segment.start - period.start;
37
- epochs.push({
38
+ epochs.push(_objectSpread2({
38
39
  periodId: period.id,
39
40
  firstSeq: segment.seq,
40
41
  presentationStart: segment.start,
41
42
  mediaStart
42
- });
43
+ }, segment.discontinuitySequence !== void 0 ? { discontinuitySequence: segment.discontinuitySequence } : {}));
43
44
  open = true;
44
45
  }
45
46
  }
@@ -56,14 +57,17 @@ function timestampOffsetFor(epoch) {
56
57
  return epoch.presentationStart - epoch.mediaStart;
57
58
  }
58
59
  /**
59
- * The name every track of a period shares for one epoch: the period alone
60
- * for the epoch that opens it, the period and the discontinuity's
61
- * presentation start after that. Sequence numbers are no part of it,
62
- * because each rendition numbers its own playlist (RFC 8216 §6.2.2 aligns
63
- * discontinuities across renditions in time, not in sequence). The start
64
- * is rounded to the second, since each playlist sums its own durations.
60
+ * The name every track of a period shares for one epoch. The manifest's
61
+ * discontinuity sequence number names it exactly, the same in every
62
+ * rendition (RFC 8216 §4.3.3.3). Without one: the period alone for the
63
+ * epoch that opens it, the period and the discontinuity's presentation
64
+ * start after that. Media sequence numbers are no part of it, because each
65
+ * rendition numbers its own playlist. The start is rounded to the second,
66
+ * since each playlist sums its own durations, so two starts that round
67
+ * apart are two names.
65
68
  */
66
69
  function epochKey(epochs, epoch) {
70
+ if (epoch.discontinuitySequence !== void 0) return `${epoch.periodId}:d${epoch.discontinuitySequence}`;
67
71
  return epochs[0] === epoch ? epoch.periodId : `${epoch.periodId}:${Math.round(epoch.presentationStart)}`;
68
72
  }
69
73
  /**
@@ -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
  function isBytes(value) {
3
3
  return value instanceof ArrayBuffer || ArrayBuffer.isView(value);
4
4
  }
@@ -1,14 +1,17 @@
1
+ import { cueFormat } from "./mime.js";
1
2
  import { findTrackSite, isTrick } from "./presentation.js";
2
3
  import { isUndecodable } from "./reducer.js";
3
4
  //#region src/kernel/track-registry.ts
4
5
  /**
5
6
  * Cue tracks need a stage for their format, not only a sink: one text sink
6
- * serves every subtitle format, and a WebVTT stage cannot read TTML. Media
7
- * formats are the browser's to decode, which the codec filter answers.
7
+ * serves every subtitle format, and a WebVTT stage cannot read TTML. In fMP4
8
+ * the codec family tells the formats apart (stpp, wvtt). Media formats are
9
+ * the browser's to decode, which the codec filter answers.
8
10
  */
9
11
  function formatPlays(deps, track) {
12
+ var _track$renditions$;
10
13
  if (track.contentType !== "text" && track.contentType !== "metadata") return true;
11
- return deps.plays(track.contentType, track.mimeType);
14
+ return deps.plays(track.contentType, cueFormat(track.mimeType, (_track$renditions$ = track.renditions[0]) === null || _track$renditions$ === void 0 ? void 0 : _track$renditions$.codecs));
12
15
  }
13
16
  function allTracks(state) {
14
17
  if (state.presentation === null) return [];
@@ -1,5 +1,5 @@
1
- import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/objectSpread2.js";
2
- import _asyncToGenerator from "../_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/asyncToGenerator.js";
1
+ import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/objectSpread2.js";
2
+ import _asyncToGenerator from "../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/asyncToGenerator.js";
3
3
  //#region src/kernel/transport.ts
4
4
  const DEFAULT_RETRY_POLICY = {
5
5
  maxAttempts: 3,
@@ -19,6 +19,8 @@ const DEFAULT_RETRY_POLICY = {
19
19
  function backoffDelayMs(policy, attempt) {
20
20
  return Math.min(policy.maxDelayMs, policy.baseDelayMs * Math.pow(policy.factor, attempt - 1));
21
21
  }
22
+ const PRIMED_LIMIT = 3;
23
+ const PRIMED_TTL_MS = 3e4;
22
24
  function createTransport(options) {
23
25
  var _options$fetchImpl, _options$now;
24
26
  const policy = _objectSpread2(_objectSpread2({}, DEFAULT_RETRY_POLICY), options.retry);
@@ -28,6 +30,18 @@ function createTransport(options) {
28
30
  const requestHooks = /* @__PURE__ */ new Set();
29
31
  const responseHooks = /* @__PURE__ */ new Set();
30
32
  const live = /* @__PURE__ */ new Map();
33
+ const primed = /* @__PURE__ */ new Map();
34
+ /** The primed response for a URL, once; null when none or expired. */
35
+ function takePrimed(url) {
36
+ const entry = primed.get(url);
37
+ if (entry === void 0) return null;
38
+ primed.delete(url);
39
+ if (now() - entry.at > PRIMED_TTL_MS) return null;
40
+ return new Response(entry.bytes, {
41
+ status: 200,
42
+ headers: entry.headers
43
+ });
44
+ }
31
45
  function fail(token, request, code, status) {
32
46
  live.delete(token);
33
47
  options.absorb(_objectSpread2(_objectSpread2(_objectSpread2({
@@ -88,10 +102,11 @@ function createTransport(options) {
88
102
  attempt(token, request, effectUrl, range, timeoutFromEffect, attemptNo + 1);
89
103
  }, backoffDelayMs(policy, attemptNo));
90
104
  };
91
- fetchImpl(draft.url, {
105
+ const answer = takePrimed(effectUrl);
106
+ (answer !== null ? Promise.resolve(answer) : fetchImpl(draft.url, {
92
107
  headers: draft.headers,
93
108
  signal: state.controller.signal
94
- }).then(function() {
109
+ })).then(function() {
95
110
  var _ref = _asyncToGenerator(function* (response) {
96
111
  var _options$acceptManife, _response$body;
97
112
  if (state.timeoutId !== null) clearTimeout(state.timeoutId);
@@ -103,7 +118,8 @@ function createTransport(options) {
103
118
  rtt: now() - startedAt,
104
119
  size: 0,
105
120
  outcome: "failure",
106
- attempt: attemptNo
121
+ attempt: attemptNo,
122
+ headers: response.headers
107
123
  });
108
124
  retryOrFail("NETWORK_HTTP_STATUS", response.status);
109
125
  return;
@@ -124,7 +140,8 @@ function createTransport(options) {
124
140
  rtt,
125
141
  size: bytes.byteLength,
126
142
  outcome: refused ? "failure" : "success",
127
- attempt: attemptNo
143
+ attempt: attemptNo,
144
+ headers: response.headers
128
145
  });
129
146
  live.delete(token);
130
147
  if (refused) {
@@ -175,7 +192,8 @@ function createTransport(options) {
175
192
  rtt: now() - startedAt,
176
193
  size: 0,
177
194
  outcome,
178
- attempt: attemptNo
195
+ attempt: attemptNo,
196
+ headers: null
179
197
  });
180
198
  retryOrFail(state.timedOut ? "NETWORK_TIMEOUT" : "NETWORK_FAILED");
181
199
  });
@@ -235,6 +253,15 @@ function createTransport(options) {
235
253
  },
236
254
  pending() {
237
255
  return [...live.keys()];
256
+ },
257
+ prime(url, bytes, headers) {
258
+ primed.delete(url);
259
+ primed.set(url, {
260
+ bytes,
261
+ headers,
262
+ at: now()
263
+ });
264
+ while (primed.size > PRIMED_LIMIT) primed.delete(primed.keys().next().value);
238
265
  }
239
266
  };
240
267
  }
@@ -1,5 +1,5 @@
1
- import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/objectSpread2.js";
2
- import _objectWithoutProperties from "../_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/objectWithoutProperties.js";
1
+ import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/objectSpread2.js";
2
+ import _objectWithoutProperties from "../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/objectWithoutProperties.js";
3
3
  import { mattebox } from "../index.js";
4
4
  //#region src/presets/define.ts
5
5
  const _excluded = ["stages", "without"];
@@ -1,5 +1,12 @@
1
1
  import trickPlay from "../../stages/trick-play/index.js";
2
+ import timedMetadata from "../../stages/timed-metadata/index.js";
2
3
  import thumbnails from "../../stages/thumbnails/index.js";
4
+ import textTtml from "../../stages/text-ttml/index.js";
5
+ import textCea708 from "../../stages/text-cea708/index.js";
6
+ import renditionNames from "../../stages/rendition-names/index.js";
7
+ import qoe from "../../stages/qoe/index.js";
8
+ import hdr from "../../stages/hdr/index.js";
9
+ import cmsd from "../../stages/cmsd/index.js";
3
10
  import cmcd from "../../stages/cmcd/index.js";
4
11
  import chapters from "../../stages/chapters/index.js";
5
12
  import { definePreset } from "../define.js";
@@ -9,7 +16,13 @@ import { base, dashLine, drmTier, hlsLine, tsTier } from "../tiers.js";
9
16
  * The `full` preset: every stage the catalogue ships. `dual-ts-drm` plus
10
17
  * the accessories: CMCD (changes every request, so opt-in elsewhere),
11
18
  * thumbnails (fetches image playlists, so opt-in elsewhere), chapters
12
- * (loads a file the app names), and trick play (a UI control drives it).
19
+ * (loads a file the app names), trick play (a UI control drives it),
20
+ * timed metadata (a page reads it), CEA-708 captions (US broadcast
21
+ * streams carry 608 beside them, which the base reads), TTML subtitles
22
+ * (opt-in by the owner's decision), HDR by capability (it excludes HDR
23
+ * where nothing is known, which a page may not want by default), local
24
+ * QoE metrics, CMSD (it acts on response headers a CDN must expose), and
25
+ * localized rendition names (a menu reads them).
13
26
  * Feature parity with
14
27
  * videojs-http-streaming; the modularity claim is measured against it, and
15
28
  * the main CDN bundle exposes it.
@@ -23,7 +36,14 @@ const preset = definePreset("full", () => [
23
36
  cmcd(),
24
37
  thumbnails(),
25
38
  chapters(),
26
- trickPlay()
39
+ trickPlay(),
40
+ timedMetadata(),
41
+ textCea708(),
42
+ textTtml(),
43
+ hdr(),
44
+ qoe(),
45
+ cmsd(),
46
+ renditionNames()
27
47
  ]);
28
48
  //#endregion
29
49
  export { preset as default };
@@ -1,11 +1,12 @@
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 { findRendition } from "../../kernel/presentation.js";
5
5
  import { isUnresolved } from "../../kernel/timeline.js";
6
6
  import { activeRenditions } from "../../kernel/rendition-select.js";
7
7
  import { manifestFact } from "../adapter-shared.js";
8
8
  import { parse, sidxToSegments } from "./parse.js";
9
+ import { installPeriods } from "./periods-runtime.js";
9
10
  //#region src/protocols/dash-cmaf/index.ts
10
11
  /**
11
12
  * The dash-cmaf protocol adapter as a stage. Inert module: exports a
@@ -21,6 +22,8 @@ import { parse, sidxToSegments } from "./parse.js";
21
22
  * resolved segments back as a PLAYLIST_REFRESHED the kernel merges.
22
23
  */
23
24
  const INDEX_TOKEN = "dash:idx:";
25
+ /** A failed index's retry, by rendition: `dash:retry:<renditionId>`. */
26
+ const RETRY_TOKEN = "dash:retry:";
24
27
  /** The MPD MIME type, ISO 23009-1 §C.2. */
25
28
  const MANIFEST_TYPES = ["application/dash+xml"];
26
29
  /** Unresolved on-demand addressing, or null for an explicit list or template. */
@@ -32,7 +35,8 @@ const INITIAL = {
32
35
  mimeType: null,
33
36
  pending: {},
34
37
  failed: {},
35
- seen: ""
38
+ seen: "",
39
+ skips: []
36
40
  };
37
41
  /** The constraint source that excludes renditions whose index failed. */
38
42
  const UNAVAILABLE = "dash:unavailable";
@@ -76,10 +80,11 @@ function feed(message) {
76
80
  /**
77
81
  * An index that failed to load or held no segment. The rendition is
78
82
  * excluded, so arbitration moves off it and nothing asks for the index
79
- * again. When that leaves a media track with no rendition at all, the load
80
- * fails: the stream cannot play, and waiting would only stall.
83
+ * again until its retry. When that leaves a media track with no rendition
84
+ * at all, the load fails: the stream cannot play, and waiting would only
85
+ * stall.
81
86
  */
82
- function unavailable(state, kernel, renditionId, error) {
87
+ function unavailable(state, kernel, renditionId, error, retryMs) {
83
88
  var _findRendition$track, _findRendition;
84
89
  const failed = _objectSpread2(_objectSpread2({}, state.failed), {}, { [renditionId]: true });
85
90
  const next = _objectSpread2(_objectSpread2({}, state), {}, { failed });
@@ -91,22 +96,58 @@ function unavailable(state, kernel, renditionId, error) {
91
96
  type: "MANIFEST_FAILED",
92
97
  error: _objectSpread2(_objectSpread2({}, error), {}, { fatal: true })
93
98
  })]];
94
- return [next, [feed({
99
+ const effects = [feed({
100
+ type: "CONSTRAIN",
101
+ source: UNAVAILABLE,
102
+ constraint: { excludeIds: Object.keys(failed) }
103
+ })];
104
+ if (Number.isFinite(retryMs)) effects.push(tickAfter(`${RETRY_TOKEN}${renditionId}`, retryMs));
105
+ return [next, effects];
106
+ }
107
+ /**
108
+ * The retry of a failed index: forget the failure, so the rendition returns
109
+ * to arbitration and the selection fetches the index again when it needs
110
+ * it. Another failure excludes it again for another wait.
111
+ */
112
+ function retry(state, renditionId) {
113
+ if (!(renditionId in state.failed)) return [state, []];
114
+ const failed = _objectSpread2({}, state.failed);
115
+ delete failed[renditionId];
116
+ return [_objectSpread2(_objectSpread2({}, state), {}, { failed }), [feed({
95
117
  type: "CONSTRAIN",
96
118
  source: UNAVAILABLE,
97
119
  constraint: { excludeIds: Object.keys(failed) }
98
120
  })]];
99
121
  }
100
- const reduceDash = (slice, msg, kernel) => {
122
+ const createReduceDash = (retryMs) => (slice, msg, kernel) => {
101
123
  const state = slice !== null && slice !== void 0 ? slice : INITIAL;
102
124
  if (msg.type === "LOAD") return [_objectSpread2(_objectSpread2({}, INITIAL), {}, {
103
125
  manifestUrl: msg.url,
104
126
  mimeType: msg.mimeType === void 0 ? null : normalizeMimeType(msg.mimeType)
105
127
  }), []];
106
128
  if (msg.type === "UNLOAD" || msg.type === "DETACH") return [INITIAL, []];
129
+ if (msg.type === "TICK" && msg.token.startsWith(RETRY_TOKEN)) return retry(state, msg.token.slice(11));
107
130
  if (msg.type === "SEGMENT_LOADED" && msg.trackId === "manifest" && state.manifestUrl !== null) {
108
- const fact = manifestFact(msg.bytes, state.manifestUrl, (text) => claims(state, text), parse);
109
- return [state, fact === null ? [] : [feed(fact)]];
131
+ let warnings = [];
132
+ const fact = manifestFact(msg.bytes, state.manifestUrl, (text) => claims(state, text), (text, url) => {
133
+ var _result$warnings;
134
+ const result = parse(text, url);
135
+ if (result.presentation !== null) warnings = (_result$warnings = result.warnings) !== null && _result$warnings !== void 0 ? _result$warnings : [];
136
+ return result;
137
+ });
138
+ if (fact === null) return [state, []];
139
+ const skips = warnings.filter((warning) => warning.code === "MEDIA_CODEC_MISMATCH").map((warning) => {
140
+ var _warning$context, _warning$context2;
141
+ return {
142
+ start: Number((_warning$context = warning.context) === null || _warning$context === void 0 ? void 0 : _warning$context.start),
143
+ end: Number((_warning$context2 = warning.context) === null || _warning$context2 === void 0 ? void 0 : _warning$context2.end)
144
+ };
145
+ });
146
+ return [_objectSpread2(_objectSpread2({}, state), {}, { skips }), [feed(fact), ...warnings.map((warning) => ({
147
+ kind: "emit",
148
+ event: "error",
149
+ payload: warning
150
+ }))]];
110
151
  }
111
152
  let next = state;
112
153
  if (msg.type === "PLAYLIST_REFRESHED" && msg.renditionId !== void 0) {
@@ -146,7 +187,7 @@ const reduceDash = (slice, msg, kernel) => {
146
187
  reason: "sidx holds no segment"
147
188
  }
148
189
  };
149
- const [failed, failEffects] = unavailable(_objectSpread2(_objectSpread2({}, state), {}, { pending }), kernel, renditionId, error);
190
+ const [failed, failEffects] = unavailable(_objectSpread2(_objectSpread2({}, state), {}, { pending }), kernel, renditionId, error, retryMs);
150
191
  return [failed, [{
151
192
  kind: "emit",
152
193
  event: "error",
@@ -163,7 +204,7 @@ const reduceDash = (slice, msg, kernel) => {
163
204
  const renditionId = state.pending[msg.trackId];
164
205
  const pending = _objectSpread2({}, state.pending);
165
206
  delete pending[msg.trackId];
166
- return unavailable(_objectSpread2(_objectSpread2({}, state), {}, { pending }), kernel, renditionId, msg.error);
207
+ return unavailable(_objectSpread2(_objectSpread2({}, state), {}, { pending }), kernel, renditionId, msg.error, retryMs);
167
208
  }
168
209
  if (kernel.lifecycle.phase !== "ready" || kernel.presentation === null) return [next, []];
169
210
  const key = `${kernel.quality.version}:${kernel.quality.active}`;
@@ -192,12 +233,18 @@ const reduceDash = (slice, msg, kernel) => {
192
233
  * The stage factory. `mattebox({ stages: [dashCmaf()] })` is all a consumer
193
234
  * needs for DASH-CMAF VOD, templated or on-demand.
194
235
  */
195
- function dashCmaf() {
236
+ function dashCmaf(options = {}) {
237
+ var _options$unavailableR;
238
+ const retryMs = ((_options$unavailableR = options.unavailableRetrySeconds) !== null && _options$unavailableR !== void 0 ? _options$unavailableR : 15) * 1e3;
196
239
  return {
197
240
  name: "dash-cmaf",
198
241
  provides: ["dash-cmaf", ...MANIFEST_TYPES],
199
242
  install(ctx) {
200
- ctx.reduce("dash", reduceDash);
243
+ ctx.reduce("dash", createReduceDash(retryMs));
244
+ return installPeriods(ctx, () => {
245
+ var _skips, _ctx$getState$dash;
246
+ return (_skips = (_ctx$getState$dash = ctx.getState().dash) === null || _ctx$getState$dash === void 0 ? void 0 : _ctx$getState$dash.skips) !== null && _skips !== void 0 ? _skips : [];
247
+ });
201
248
  }
202
249
  };
203
250
  }