mattebox 0.10.0 → 0.12.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 (372) 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 +63 -27
  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 +47 -6
  123. package/dist/es2015/kernel/prepare.js +2 -2
  124. package/dist/es2015/kernel/reducer.js +83 -26
  125. package/dist/es2015/kernel/refresh.js +2 -2
  126. package/dist/es2015/kernel/rendition-select.js +91 -16
  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 +421 -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 +161 -39
  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 +18 -7
  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/alt-audio/index.js +7 -5
  152. package/dist/es2015/stages/chapters/index.js +2 -2
  153. package/dist/es2015/stages/chapters/parse.js +2 -2
  154. package/dist/es2015/stages/cmcd/index.js +30 -3
  155. package/dist/es2015/stages/cmsd/index.js +72 -0
  156. package/dist/es2015/stages/codec-probe/index.js +28 -3
  157. package/dist/es2015/stages/content-steering/index.js +1 -1
  158. package/dist/es2015/stages/eme-core/index.js +31 -7
  159. package/dist/es2015/stages/eme-fairplay/index.js +18 -9
  160. package/dist/es2015/stages/hdr/index.js +214 -0
  161. package/dist/es2015/stages/meta-id3/index.js +6 -1
  162. package/dist/es2015/stages/qoe/index.js +111 -0
  163. package/dist/es2015/stages/recovery/index.js +1 -1
  164. package/dist/es2015/stages/rendition-names/index.js +101 -0
  165. package/dist/es2015/stages/text-cea608/decode.js +57 -6
  166. package/dist/es2015/stages/text-cea608/index.js +26 -93
  167. package/dist/es2015/stages/text-cea708/decode.js +379 -0
  168. package/dist/es2015/stages/text-cea708/index.js +98 -0
  169. package/dist/es2015/stages/text-ttml/index.js +88 -0
  170. package/dist/es2015/stages/text-ttml/parse.js +255 -0
  171. package/dist/es2015/stages/text-webvtt/index.js +30 -65
  172. package/dist/es2015/stages/thumbnails/index.js +1 -1
  173. package/dist/es2015/stages/timed-metadata/index.js +331 -0
  174. package/dist/es2015/stages/trick-play/index.js +3 -2
  175. package/dist/index.d.ts +1 -1
  176. package/dist/index.d.ts.map +1 -1
  177. package/dist/index.js +62 -19
  178. package/dist/index.js.map +1 -1
  179. package/dist/kernel/base64.d.ts +7 -2
  180. package/dist/kernel/base64.d.ts.map +1 -1
  181. package/dist/kernel/base64.js +14 -2
  182. package/dist/kernel/base64.js.map +1 -1
  183. package/dist/kernel/bus.d.ts.map +1 -1
  184. package/dist/kernel/bus.js +12 -9
  185. package/dist/kernel/bus.js.map +1 -1
  186. package/dist/kernel/context.d.ts +3 -1
  187. package/dist/kernel/context.d.ts.map +1 -1
  188. package/dist/kernel/context.js +5 -0
  189. package/dist/kernel/context.js.map +1 -1
  190. package/dist/kernel/lifecycle.d.ts +3 -1
  191. package/dist/kernel/lifecycle.d.ts.map +1 -1
  192. package/dist/kernel/lifecycle.js +1 -0
  193. package/dist/kernel/lifecycle.js.map +1 -1
  194. package/dist/kernel/loader.d.ts.map +1 -1
  195. package/dist/kernel/loader.js +3 -2
  196. package/dist/kernel/loader.js.map +1 -1
  197. package/dist/kernel/mime.d.ts +7 -0
  198. package/dist/kernel/mime.d.ts.map +1 -1
  199. package/dist/kernel/mime.js +12 -0
  200. package/dist/kernel/mime.js.map +1 -1
  201. package/dist/kernel/mse.d.ts.map +1 -1
  202. package/dist/kernel/mse.js +47 -3
  203. package/dist/kernel/mse.js.map +1 -1
  204. package/dist/kernel/reducer.d.ts.map +1 -1
  205. package/dist/kernel/reducer.js +88 -12
  206. package/dist/kernel/reducer.js.map +1 -1
  207. package/dist/kernel/refresh.d.ts.map +1 -1
  208. package/dist/kernel/refresh.js +1 -0
  209. package/dist/kernel/refresh.js.map +1 -1
  210. package/dist/kernel/rendition-select.d.ts +29 -1
  211. package/dist/kernel/rendition-select.d.ts.map +1 -1
  212. package/dist/kernel/rendition-select.js +99 -21
  213. package/dist/kernel/rendition-select.js.map +1 -1
  214. package/dist/kernel/sinks/caption-tracks.d.ts +11 -0
  215. package/dist/kernel/sinks/caption-tracks.d.ts.map +1 -0
  216. package/dist/kernel/sinks/caption-tracks.js +87 -0
  217. package/dist/kernel/sinks/caption-tracks.js.map +1 -0
  218. package/dist/kernel/sinks/native-sync.d.ts +24 -0
  219. package/dist/kernel/sinks/native-sync.d.ts.map +1 -0
  220. package/dist/kernel/sinks/native-sync.js +42 -0
  221. package/dist/kernel/sinks/native-sync.js.map +1 -0
  222. package/dist/kernel/sinks/text-formats.d.ts +25 -0
  223. package/dist/kernel/sinks/text-formats.d.ts.map +1 -0
  224. package/dist/kernel/sinks/text-formats.js +69 -0
  225. package/dist/kernel/sinks/text-formats.js.map +1 -0
  226. package/dist/kernel/sinks/text-track-sink.d.ts.map +1 -1
  227. package/dist/kernel/sinks/text-track-sink.js +22 -4
  228. package/dist/kernel/sinks/text-track-sink.js.map +1 -1
  229. package/dist/kernel/timeline.d.ts +10 -6
  230. package/dist/kernel/timeline.d.ts.map +1 -1
  231. package/dist/kernel/timeline.js +14 -6
  232. package/dist/kernel/timeline.js.map +1 -1
  233. package/dist/kernel/track-registry.d.ts +2 -2
  234. package/dist/kernel/track-registry.d.ts.map +1 -1
  235. package/dist/kernel/track-registry.js +5 -3
  236. package/dist/kernel/track-registry.js.map +1 -1
  237. package/dist/kernel/transport.d.ts +8 -0
  238. package/dist/kernel/transport.d.ts.map +1 -1
  239. package/dist/kernel/transport.js +28 -1
  240. package/dist/kernel/transport.js.map +1 -1
  241. package/dist/presets/full/index.d.ts.map +1 -1
  242. package/dist/presets/full/index.js +21 -1
  243. package/dist/presets/full/index.js.map +1 -1
  244. package/dist/protocols/adapter-shared.d.ts +8 -0
  245. package/dist/protocols/adapter-shared.d.ts.map +1 -1
  246. package/dist/protocols/adapter-shared.js +6 -0
  247. package/dist/protocols/adapter-shared.js.map +1 -1
  248. package/dist/protocols/dash-cmaf/index.d.ts +9 -1
  249. package/dist/protocols/dash-cmaf/index.d.ts.map +1 -1
  250. package/dist/protocols/dash-cmaf/index.js +78 -14
  251. package/dist/protocols/dash-cmaf/index.js.map +1 -1
  252. package/dist/protocols/dash-cmaf/parse.d.ts.map +1 -1
  253. package/dist/protocols/dash-cmaf/parse.js +430 -94
  254. package/dist/protocols/dash-cmaf/parse.js.map +1 -1
  255. package/dist/protocols/dash-cmaf/periods-runtime.d.ts +6 -0
  256. package/dist/protocols/dash-cmaf/periods-runtime.d.ts.map +1 -0
  257. package/dist/protocols/dash-cmaf/periods-runtime.js +121 -0
  258. package/dist/protocols/dash-cmaf/periods-runtime.js.map +1 -0
  259. package/dist/protocols/dash-cmaf/periods.d.ts +24 -0
  260. package/dist/protocols/dash-cmaf/periods.d.ts.map +1 -0
  261. package/dist/protocols/dash-cmaf/periods.js +210 -0
  262. package/dist/protocols/dash-cmaf/periods.js.map +1 -0
  263. package/dist/protocols/hls-cmaf/index.d.ts +9 -1
  264. package/dist/protocols/hls-cmaf/index.d.ts.map +1 -1
  265. package/dist/protocols/hls-cmaf/index.js +49 -20
  266. package/dist/protocols/hls-cmaf/index.js.map +1 -1
  267. package/dist/protocols/hls-cmaf/lexer.d.ts.map +1 -1
  268. package/dist/protocols/hls-cmaf/lexer.js +1 -0
  269. package/dist/protocols/hls-cmaf/lexer.js.map +1 -1
  270. package/dist/protocols/hls-cmaf/parse.d.ts +3 -1
  271. package/dist/protocols/hls-cmaf/parse.d.ts.map +1 -1
  272. package/dist/protocols/hls-cmaf/parse.js +208 -24
  273. package/dist/protocols/hls-cmaf/parse.js.map +1 -1
  274. package/dist/protocols/hls-cmaf/unavailable.d.ts +9 -1
  275. package/dist/protocols/hls-cmaf/unavailable.d.ts.map +1 -1
  276. package/dist/protocols/hls-cmaf/unavailable.js +29 -3
  277. package/dist/protocols/hls-cmaf/unavailable.js.map +1 -1
  278. package/dist/protocols/hls-live/index.d.ts +9 -1
  279. package/dist/protocols/hls-live/index.d.ts.map +1 -1
  280. package/dist/protocols/hls-live/index.js +36 -7
  281. package/dist/protocols/hls-live/index.js.map +1 -1
  282. package/dist/stages/abr/index.d.ts.map +1 -1
  283. package/dist/stages/abr/index.js +24 -8
  284. package/dist/stages/abr/index.js.map +1 -1
  285. package/dist/stages/alt-audio/index.d.ts +3 -1
  286. package/dist/stages/alt-audio/index.d.ts.map +1 -1
  287. package/dist/stages/alt-audio/index.js +8 -5
  288. package/dist/stages/alt-audio/index.js.map +1 -1
  289. package/dist/stages/cmcd/index.d.ts.map +1 -1
  290. package/dist/stages/cmcd/index.js +39 -3
  291. package/dist/stages/cmcd/index.js.map +1 -1
  292. package/dist/stages/cmsd/index.d.ts +22 -0
  293. package/dist/stages/cmsd/index.d.ts.map +1 -0
  294. package/dist/stages/cmsd/index.js +65 -0
  295. package/dist/stages/cmsd/index.js.map +1 -0
  296. package/dist/stages/codec-probe/index.d.ts.map +1 -1
  297. package/dist/stages/codec-probe/index.js +30 -3
  298. package/dist/stages/codec-probe/index.js.map +1 -1
  299. package/dist/stages/eme-core/index.d.ts +14 -0
  300. package/dist/stages/eme-core/index.d.ts.map +1 -1
  301. package/dist/stages/eme-core/index.js +38 -5
  302. package/dist/stages/eme-core/index.js.map +1 -1
  303. package/dist/stages/eme-fairplay/index.d.ts +5 -0
  304. package/dist/stages/eme-fairplay/index.d.ts.map +1 -1
  305. package/dist/stages/eme-fairplay/index.js +17 -6
  306. package/dist/stages/eme-fairplay/index.js.map +1 -1
  307. package/dist/stages/hdr/index.d.ts +22 -0
  308. package/dist/stages/hdr/index.d.ts.map +1 -0
  309. package/dist/stages/hdr/index.js +191 -0
  310. package/dist/stages/hdr/index.js.map +1 -0
  311. package/dist/stages/meta-id3/index.d.ts.map +1 -1
  312. package/dist/stages/meta-id3/index.js +6 -2
  313. package/dist/stages/meta-id3/index.js.map +1 -1
  314. package/dist/stages/qoe/index.d.ts +32 -0
  315. package/dist/stages/qoe/index.d.ts.map +1 -0
  316. package/dist/stages/qoe/index.js +116 -0
  317. package/dist/stages/qoe/index.js.map +1 -0
  318. package/dist/stages/rendition-names/index.d.ts +41 -0
  319. package/dist/stages/rendition-names/index.d.ts.map +1 -0
  320. package/dist/stages/rendition-names/index.js +101 -0
  321. package/dist/stages/rendition-names/index.js.map +1 -0
  322. package/dist/stages/text-cea608/decode.d.ts +23 -2
  323. package/dist/stages/text-cea608/decode.d.ts.map +1 -1
  324. package/dist/stages/text-cea608/decode.js +59 -6
  325. package/dist/stages/text-cea608/decode.js.map +1 -1
  326. package/dist/stages/text-cea608/index.d.ts +9 -9
  327. package/dist/stages/text-cea608/index.d.ts.map +1 -1
  328. package/dist/stages/text-cea608/index.js +31 -105
  329. package/dist/stages/text-cea608/index.js.map +1 -1
  330. package/dist/stages/text-cea708/decode.d.ts +79 -0
  331. package/dist/stages/text-cea708/decode.d.ts.map +1 -0
  332. package/dist/stages/text-cea708/decode.js +410 -0
  333. package/dist/stages/text-cea708/decode.js.map +1 -0
  334. package/dist/stages/text-cea708/index.d.ts +3 -0
  335. package/dist/stages/text-cea708/index.d.ts.map +1 -0
  336. package/dist/stages/text-cea708/index.js +93 -0
  337. package/dist/stages/text-cea708/index.js.map +1 -0
  338. package/dist/stages/text-ttml/index.d.ts +3 -0
  339. package/dist/stages/text-ttml/index.d.ts.map +1 -0
  340. package/dist/stages/text-ttml/index.js +74 -0
  341. package/dist/stages/text-ttml/index.js.map +1 -0
  342. package/dist/stages/text-ttml/parse.d.ts +16 -0
  343. package/dist/stages/text-ttml/parse.d.ts.map +1 -0
  344. package/dist/stages/text-ttml/parse.js +277 -0
  345. package/dist/stages/text-ttml/parse.js.map +1 -0
  346. package/dist/stages/text-webvtt/index.d.ts +6 -13
  347. package/dist/stages/text-webvtt/index.d.ts.map +1 -1
  348. package/dist/stages/text-webvtt/index.js +21 -68
  349. package/dist/stages/text-webvtt/index.js.map +1 -1
  350. package/dist/stages/timed-metadata/index.d.ts +15 -0
  351. package/dist/stages/timed-metadata/index.d.ts.map +1 -0
  352. package/dist/stages/timed-metadata/index.js +370 -0
  353. package/dist/stages/timed-metadata/index.js.map +1 -0
  354. package/dist/types/error.d.ts +1 -1
  355. package/dist/types/error.d.ts.map +1 -1
  356. package/dist/types/facade.d.ts +8 -10
  357. package/dist/types/facade.d.ts.map +1 -1
  358. package/dist/types/ir.d.ts +90 -0
  359. package/dist/types/ir.d.ts.map +1 -1
  360. package/dist/types/kernel.d.ts +8 -0
  361. package/dist/types/kernel.d.ts.map +1 -1
  362. package/dist/types/messages.d.ts +10 -1
  363. package/dist/types/messages.d.ts.map +1 -1
  364. package/dist/types/metadata.d.ts +59 -0
  365. package/dist/types/metadata.d.ts.map +1 -0
  366. package/dist/types/metadata.js +7 -0
  367. package/dist/types/metadata.js.map +1 -0
  368. package/dist/types/quality.d.ts +10 -0
  369. package/dist/types/quality.d.ts.map +1 -1
  370. package/dist/types/stage.d.ts +17 -0
  371. package/dist/types/stage.d.ts.map +1 -1
  372. package/package.json +10 -2
@@ -1,6 +1,6 @@
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 { findTrackSite } from "../../kernel/presentation.js";
3
- import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/asyncToGenerator.js";
3
+ import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/asyncToGenerator.js";
4
4
  import { chaptersFromInput, parseAppleChapters, parseChapterTrack } from "./parse.js";
5
5
  //#region src/stages/chapters/index.ts
6
6
  /**
@@ -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 { parseVtt } from "../../containers/webvtt.js";
4
4
  import { resolveUrl } from "../../kernel/url.js";
5
5
  //#region src/stages/chapters/parse.ts
@@ -1,4 +1,6 @@
1
1
  import { findRendition } from "../../kernel/presentation.js";
2
+ import { segmentAt } from "../../kernel/timeline.js";
3
+ import { bytesToHex } from "../../kernel/base64.js";
2
4
  //#region src/stages/cmcd/index.ts
3
5
  /**
4
6
  * Common Media Client Data (CTA-5004). The engine already exposes the seam
@@ -8,8 +10,9 @@ import { findRendition } from "../../kernel/presentation.js";
8
10
  * argument or request headers.
9
11
  *
10
12
  * It computes nothing the kernel does not already track: the active rendition
11
- * bitrate, the measured throughput EWMA, and the buffer ahead of the playhead
12
- * from the media element. No new kernel state, no new effect.
13
+ * bitrate, the measured throughput EWMA, the buffer ahead of the playhead
14
+ * from the media element, and the segment after the one requested (`nor`,
15
+ * `nrr`), so a CDN can prefetch it. No new kernel state, no new effect.
13
16
  */
14
17
  /** The CMCD object type, inferred from the URL the request is fetching. */
15
18
  function objectType(url) {
@@ -46,9 +49,24 @@ function sessionUuid() {
46
49
  const bytes = crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(16));
47
50
  bytes[6] = bytes[6] & 15 | 64;
48
51
  bytes[8] = bytes[8] & 63 | 128;
49
- const hex = Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
52
+ const hex = bytesToHex(bytes);
50
53
  return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
51
54
  }
55
+ /**
56
+ * `to` as a path relative to `from`, as `nor` needs (CTA-5004 §3.3.1):
57
+ * the file name in the same directory, `../` steps up, or the absolute URL
58
+ * on another origin.
59
+ */
60
+ function relativePath(from, to) {
61
+ const a = new URL(from);
62
+ const b = new URL(to);
63
+ if (a.origin !== b.origin) return to;
64
+ const fromDirs = a.pathname.split("/").slice(0, -1);
65
+ const toParts = b.pathname.split("/");
66
+ let common = 0;
67
+ while (common < fromDirs.length && fromDirs[common] === toParts[common]) common += 1;
68
+ return `${"../".repeat(fromDirs.length - common)}${toParts.slice(common).join("/")}${b.search}`;
69
+ }
52
70
  function cmcd(options = {}) {
53
71
  var _options$sessionId, _options$mode;
54
72
  const sessionId = (_options$sessionId = options.sessionId) !== null && _options$sessionId !== void 0 ? _options$sessionId : sessionUuid();
@@ -74,6 +92,15 @@ function cmcd(options = {}) {
74
92
  const ahead = bufferAhead(el);
75
93
  if (ahead !== null) keys.bl = Math.round(ahead * 1e3 / 100) * 100;
76
94
  if (ahead !== null && ahead < 1) keys.su = true;
95
+ const request = state.scheduling.inflight.get(req.token);
96
+ if (request !== void 0 && request.seq >= 0 && request.renditionId !== void 0) {
97
+ const site = findRendition(state.presentation, request.renditionId);
98
+ const next = site === null ? null : segmentAt(site.rendition.segments, request.seq + 1, site.period.start);
99
+ if (next !== null) {
100
+ if (next.url !== request.url) keys.nor = encodeURIComponent(relativePath(request.url, next.url));
101
+ if (next.byteRange !== void 0) keys.nrr = `${next.byteRange.start}-${next.byteRange.end}`;
102
+ }
103
+ }
77
104
  const payload = serialize(keys);
78
105
  if (mode === "header") req.headers["CMCD-Request"] = payload;
79
106
  else {
@@ -0,0 +1,72 @@
1
+ //#region src/stages/cmsd/index.ts
2
+ /** Splits on commas or semicolons outside double quotes. */
3
+ function split(value, separator) {
4
+ const parts = [];
5
+ let current = "";
6
+ let quoted = false;
7
+ for (const char of value) {
8
+ if (char === "\"") quoted = !quoted;
9
+ if (char === separator && !quoted) {
10
+ parts.push(current);
11
+ current = "";
12
+ } else current += char;
13
+ }
14
+ parts.push(current);
15
+ return parts;
16
+ }
17
+ /** The numeric parameters of the list's last member: `"CDN-B";etp=480;mb=6000`. */
18
+ function cmsdParams(header) {
19
+ var _members;
20
+ const members = split(header, ",");
21
+ const last = (_members = members[members.length - 1]) !== null && _members !== void 0 ? _members : "";
22
+ const params = /* @__PURE__ */ new Map();
23
+ for (const param of split(last, ";").slice(1)) {
24
+ const [key, value] = param.trim().split("=");
25
+ const number = value === void 0 ? NaN : Number(value);
26
+ if (Number.isFinite(number)) params.set(key, number);
27
+ }
28
+ return params;
29
+ }
30
+ function cmsd() {
31
+ return {
32
+ name: "cmsd",
33
+ provides: ["cmsd"],
34
+ requires: ["transport", "rendition-select"],
35
+ install(ctx) {
36
+ let etp = null;
37
+ let mb = null;
38
+ ctx.addResponseHook((response) => {
39
+ var _response$headers;
40
+ const header = response.outcome === "success" ? (_response$headers = response.headers) === null || _response$headers === void 0 ? void 0 : _response$headers.get("CMSD-Dynamic") : null;
41
+ if (header === null || header === void 0) return;
42
+ const params = cmsdParams(header);
43
+ const kbps = (key) => {
44
+ const value = params.get(key);
45
+ return value !== void 0 && value > 0 ? value * 1e3 : null;
46
+ };
47
+ const nextEtp = kbps("etp");
48
+ if (nextEtp !== etp) {
49
+ etp = nextEtp;
50
+ ctx.dispatch({
51
+ type: "THROUGHPUT_HINT",
52
+ bps: etp
53
+ });
54
+ }
55
+ const nextMb = kbps("mb");
56
+ if (nextMb !== mb) {
57
+ mb = nextMb;
58
+ ctx.dispatch(mb === null ? {
59
+ type: "RELEASE_CONSTRAINT",
60
+ source: "cmsd"
61
+ } : {
62
+ type: "CONSTRAIN",
63
+ source: "cmsd",
64
+ constraint: { maxBitrate: mb }
65
+ });
66
+ }
67
+ });
68
+ }
69
+ };
70
+ }
71
+ //#endregion
72
+ export { cmsdParams, cmsd as default };
@@ -1,4 +1,6 @@
1
- import { probeInitSegment } from "../../containers/codec-probe/index.js";
1
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/objectSpread2.js";
2
+ import { findRendition } from "../../kernel/presentation.js";
3
+ import { codecMismatch, probeInitSegment } from "../../containers/codec-probe/index.js";
2
4
  //#region src/stages/codec-probe/index.ts
3
5
  /**
4
6
  * codec-probe as a loadable stage. The derivation itself lives in the
@@ -11,8 +13,10 @@ import { probeInitSegment } from "../../containers/codec-probe/index.js";
11
13
  * It also registers the composition's type probe: a rendition the manifest
12
14
  * left codec-less (a bare media playlist) gets its SourceBuffer typed from
13
15
  * its first segment instead of the bare `video/mp4` Chrome refuses. A
14
- * manifest that does declare codecs still creates the buffer as declared;
15
- * a mismatch with the probe surfaces on the event for a follow-up stage.
16
+ * manifest that does declare codecs still creates the buffer as declared.
17
+ * When the init segment holds another codec or another profile, the stage
18
+ * reports it once per rendition as a non-fatal MEDIA_CODEC_MISMATCH error:
19
+ * Chrome can refuse the appends of a buffer typed with the wrong profile.
16
20
  */
17
21
  /** A media segment carries a moof; only an init segment carries a moov. */
18
22
  function isInitSegment(data) {
@@ -27,6 +31,26 @@ function codecProbe() {
27
31
  install(ctx) {
28
32
  let detected = [];
29
33
  let mimeType = null;
34
+ const reported = /* @__PURE__ */ new Set();
35
+ /** Reports an init segment whose codec is not the one its rendition declares. */
36
+ function checkDeclared(codecs, renditionId) {
37
+ var _findRendition$rendit, _findRendition;
38
+ const presentation = ctx.getState().presentation;
39
+ const declared = (_findRendition$rendit = (_findRendition = findRendition(presentation, renditionId)) === null || _findRendition === void 0 ? void 0 : _findRendition.rendition.codecs) !== null && _findRendition$rendit !== void 0 ? _findRendition$rendit : null;
40
+ if (presentation === null || declared === null) return;
41
+ const mismatch = codecMismatch(declared, codecs);
42
+ if (mismatch === null) return;
43
+ const key = `${presentation.id}|${renditionId}|${mismatch.probed}`;
44
+ if (reported.has(key)) return;
45
+ reported.add(key);
46
+ ctx.emit("error", {
47
+ category: "media",
48
+ code: "MEDIA_CODEC_MISMATCH",
49
+ fatal: false,
50
+ recoverable: true,
51
+ context: _objectSpread2({ renditionId }, mismatch)
52
+ });
53
+ }
30
54
  ctx.registerNamespace("codecProbe", {
31
55
  get detected() {
32
56
  return detected;
@@ -54,6 +78,7 @@ function codecProbe() {
54
78
  codecs: result.codecs,
55
79
  mimeType: result.mimeType
56
80
  });
81
+ checkDeclared(result.codecs, meta.renditionId);
57
82
  }
58
83
  return data;
59
84
  }
@@ -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
  //#region src/stages/content-steering/index.ts
4
4
  /**
@@ -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
  import { bytesToBase64 } from "../../kernel/base64.js";
4
4
  import { keySystemHandlers, normalizeSystemId } from "../drm-shared.js";
5
5
  //#region src/stages/eme-core/index.ts
@@ -83,6 +83,7 @@ function emeCore(options = {}) {
83
83
  let keySystem = null;
84
84
  let handler = null;
85
85
  let licenseUrl = (_options$licenseUrl = options.licenseUrl) !== null && _options$licenseUrl !== void 0 ? _options$licenseUrl : null;
86
+ let certificateUrl = options.certificateUrl;
86
87
  const statuses = /* @__PURE__ */ new Map();
87
88
  const initDataSeen = /* @__PURE__ */ new Set();
88
89
  const open = /* @__PURE__ */ new Map();
@@ -100,6 +101,9 @@ function emeCore(options = {}) {
100
101
  },
101
102
  setLicenseUrl(url) {
102
103
  licenseUrl = url;
104
+ },
105
+ setCertificateUrl(url) {
106
+ certificateUrl = url;
103
107
  }
104
108
  });
105
109
  function fail(code, recoverable, cause) {
@@ -128,13 +132,13 @@ function emeCore(options = {}) {
128
132
  const candidates = preferredSystemIds.length > 0 ? ordered.filter((h) => h.systemIds.some((id) => preferredSystemIds.includes(id))) : ordered;
129
133
  let lastError;
130
134
  for (const candidate of candidates.length > 0 ? candidates : ordered) try {
131
- var _candidate$fairplay;
135
+ var _candidate$fairplay$c;
132
136
  const keys = yield (yield navigator.requestMediaKeySystemAccess(candidate.keySystem, accessConfig(candidate))).createMediaKeys();
133
137
  if (disposed) return false;
134
- if (((_candidate$fairplay = candidate.fairplay) === null || _candidate$fairplay === void 0 ? void 0 : _candidate$fairplay.certificateUrl) !== void 0) {
135
- const url = candidate.fairplay.certificateUrl;
136
- const response = yield ctx.request(url, {});
137
- if (!response.ok) throw new Error(`certificate ${url}: HTTP ${response.status}`);
138
+ const certificate = candidate.fairplay === void 0 ? void 0 : (_candidate$fairplay$c = candidate.fairplay.certificateUrl) !== null && _candidate$fairplay$c !== void 0 ? _candidate$fairplay$c : certificateUrl;
139
+ if (certificate !== void 0) {
140
+ const response = yield ctx.request(certificate, {});
141
+ if (!response.ok) throw new Error(`certificate ${certificate}: HTTP ${response.status}`);
138
142
  yield keys.setServerCertificate(yield response.arrayBuffer());
139
143
  }
140
144
  yield element.setMediaKeys(keys);
@@ -294,6 +298,24 @@ function emeCore(options = {}) {
294
298
  }
295
299
  };
296
300
  element.addEventListener("play", onPlay);
301
+ let released = [];
302
+ const offSuspended = ctx.on("lifecycle:suspended", () => {
303
+ if (options.releaseOnSuspend !== true || open.size === 0) return;
304
+ released = [...open.entries()].filter(([session]) => ![...open.values()].some((r) => r.replaces === session)).map(([, record]) => ({
305
+ initDataType: record.initDataType,
306
+ initData: record.initData,
307
+ replaces: null,
308
+ usable: false
309
+ }));
310
+ for (const session of [...open.keys()]) retire(session);
311
+ statuses.clear();
312
+ ctx.emit("drm:released", { sessions: released.length });
313
+ });
314
+ const offResumed = ctx.on("lifecycle:resumed", () => {
315
+ const records = released;
316
+ released = [];
317
+ for (const record of records) startSession(record);
318
+ });
297
319
  const onEncrypted = (event) => {
298
320
  const e = event;
299
321
  if (e.initData === null) return;
@@ -314,6 +336,8 @@ function emeCore(options = {}) {
314
336
  element.removeEventListener("encrypted", onEncrypted);
315
337
  element.removeEventListener("play", onPlay);
316
338
  offManifest();
339
+ offSuspended();
340
+ offResumed();
317
341
  for (const session of [...open.keys()]) retire(session);
318
342
  if (mediaKeys !== null) element.setMediaKeys(null).catch(() => {});
319
343
  };
@@ -1,13 +1,17 @@
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 { base64ToBytes, bytesToBase64 } from "../../kernel/base64.js";
3
3
  import { registerKeySystem } from "../drm-shared.js";
4
4
  //#region src/stages/eme-fairplay/index.ts
5
5
  /**
6
6
  * FairPlay Streaming: the non-standard SPC/CKC flow. Safari only, and it
7
- * differs from CENC enough to warrant its own stage — the CDM message is
8
- * an SPC to POST as form data, the response is a CKC, and the content id
9
- * comes from the skd:// URI the hls parser stored in licenseUrl. Registers
10
- * a handler; eme-core drives it, including the certificate fetch.
7
+ * differs from CENC enough to warrant its own stage: the CDM message is an
8
+ * SPC to POST, the response is a CKC, and the content id comes from the
9
+ * skd:// URI the hls parser stored in licenseUrl. Registers a handler;
10
+ * eme-core drives it, including the certificate fetch.
11
+ *
12
+ * Key servers differ in the body they take. Most, Irdeto's among them,
13
+ * take the SPC bytes as they are; some take an `spc=` form field with the
14
+ * SPC in base64. The `licenseBody` option picks one.
11
15
  */
12
16
  const FAIRPLAY_SYSTEM_ID = "94ce86fb-07ff-4f43-adb8-93d2fa968ca2";
13
17
  /** The content id from a skd:// init data blob: the URI's opaque tail. */
@@ -40,15 +44,20 @@ function emeFairplay(options = {}) {
40
44
  provides: ["eme-fairplay"],
41
45
  requires: ["eme-core"],
42
46
  install() {
43
- registerKeySystem({
47
+ registerKeySystem(_objectSpread2(_objectSpread2({
44
48
  keySystem: "com.apple.fps",
45
49
  systemIds: [FAIRPLAY_SYSTEM_ID],
46
- initDataTypes: ["sinf", "skd"],
50
+ initDataTypes: ["sinf", "skd"]
51
+ }, options.licenseBody === "form" ? {
47
52
  licenseHeaders: { "Content-Type": "application/x-www-form-urlencoded" },
48
- buildLicenseRequest: buildSpcRequest,
53
+ buildLicenseRequest: buildSpcRequest
54
+ } : {
55
+ licenseHeaders: { "Content-Type": "application/octet-stream" },
56
+ buildLicenseRequest: (message) => message
57
+ }), {}, {
49
58
  parseLicenseResponse: parseCkcResponse,
50
59
  fairplay: _objectSpread2(_objectSpread2({}, options.certificateUrl !== void 0 ? { certificateUrl: options.certificateUrl } : {}), {}, { contentId: contentIdFromSkd })
51
- });
60
+ }));
52
61
  }
53
62
  };
54
63
  }
@@ -0,0 +1,214 @@
1
+ import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/asyncToGenerator.js";
2
+ //#region src/stages/hdr/index.ts
3
+ const SOURCE = "hdr";
4
+ /** The display's answer, or null when the browser does not know `dynamic-range`. */
5
+ function displayHdr() {
6
+ if (typeof matchMedia !== "function") return null;
7
+ if (matchMedia("(dynamic-range: high)").matches) return true;
8
+ return matchMedia("(dynamic-range: standard)").matches ? false : null;
9
+ }
10
+ function capabilities() {
11
+ var _mediaCapabilities;
12
+ return (_mediaCapabilities = navigator.mediaCapabilities) !== null && _mediaCapabilities !== void 0 ? _mediaCapabilities : null;
13
+ }
14
+ /** True when `decodingInfo` reads the HDR fields: an invalid enum value is then a TypeError. */
15
+ function knowsHdrFields(_x) {
16
+ return _knowsHdrFields.apply(this, arguments);
17
+ }
18
+ function _knowsHdrFields() {
19
+ _knowsHdrFields = _asyncToGenerator(function* (api) {
20
+ try {
21
+ yield api.decodingInfo({
22
+ type: "media-source",
23
+ video: {
24
+ contentType: "video/mp4; codecs=\"avc1.42E01E\"",
25
+ width: 640,
26
+ height: 360,
27
+ bitrate: 1e6,
28
+ framerate: 30,
29
+ hdrMetadataType: "unknown"
30
+ }
31
+ });
32
+ return false;
33
+ } catch (error) {
34
+ return error instanceof TypeError;
35
+ }
36
+ });
37
+ return _knowsHdrFields.apply(this, arguments);
38
+ }
39
+ function isHdr(rendition) {
40
+ return rendition.videoRange === "PQ" || rendition.videoRange === "HLG";
41
+ }
42
+ const formatOf = (rendition) => {
43
+ var _rendition$codecs;
44
+ return `${(_rendition$codecs = rendition.codecs) !== null && _rendition$codecs !== void 0 ? _rendition$codecs : ""}|${rendition.videoRange}`;
45
+ };
46
+ function hdr(options = {}) {
47
+ return {
48
+ name: "hdr",
49
+ provides: ["hdr"],
50
+ requires: ["rendition-select"],
51
+ install(ctx) {
52
+ let state = {
53
+ display: null,
54
+ formats: {},
55
+ source: null,
56
+ allowed: true
57
+ };
58
+ let seen = null;
59
+ let run = 0;
60
+ let constrained = false;
61
+ function videoRenditions() {
62
+ var _ctx$getState$present, _ctx$getState$present2;
63
+ const out = [];
64
+ 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.contentType === "video") out.push(...track.renditions);
65
+ return out;
66
+ }
67
+ const hdrRenditions = () => videoRenditions().filter(isHdr);
68
+ function apply(excluded) {
69
+ if (excluded === "all" && videoRenditions().every(isHdr) || excluded === "none" || excluded !== "all" && excluded.length === 0) {
70
+ if (constrained) ctx.dispatch({
71
+ type: "RELEASE_CONSTRAINT",
72
+ source: SOURCE
73
+ });
74
+ constrained = false;
75
+ return;
76
+ }
77
+ constrained = true;
78
+ ctx.dispatch({
79
+ type: "CONSTRAIN",
80
+ source: SOURCE,
81
+ constraint: excluded === "all" ? { hdr: false } : { excludeIds: excluded.map((r) => r.id) }
82
+ });
83
+ }
84
+ function evaluate() {
85
+ return _evaluate.apply(this, arguments);
86
+ }
87
+ function _evaluate() {
88
+ _evaluate = _asyncToGenerator(function* () {
89
+ run += 1;
90
+ const mine = run;
91
+ const renditions = hdrRenditions();
92
+ if (renditions.length === 0) {
93
+ state = {
94
+ display: null,
95
+ formats: {},
96
+ source: null,
97
+ allowed: true
98
+ };
99
+ apply("none");
100
+ return;
101
+ }
102
+ const display = displayHdr();
103
+ if (options.supported !== void 0) {
104
+ const answer = typeof options.supported === "function" ? yield options.supported() : options.supported;
105
+ if (mine !== run) return;
106
+ state = {
107
+ display,
108
+ formats: {},
109
+ source: "option",
110
+ allowed: answer
111
+ };
112
+ apply(answer ? "none" : "all");
113
+ return;
114
+ }
115
+ const formats = {};
116
+ const api = capabilities();
117
+ const known = api !== null && (yield knowsHdrFields(api));
118
+ for (const rendition of renditions) {
119
+ const key = formatOf(rendition);
120
+ if (key in formats) continue;
121
+ formats[key] = null;
122
+ if (!known || api === null) continue;
123
+ try {
124
+ var _rendition$codecs2, _rendition$width, _rendition$height, _rendition$frameRate;
125
+ formats[key] = (yield api.decodingInfo({
126
+ type: "media-source",
127
+ video: {
128
+ contentType: `video/mp4; codecs="${(_rendition$codecs2 = rendition.codecs) !== null && _rendition$codecs2 !== void 0 ? _rendition$codecs2 : ""}"`,
129
+ width: (_rendition$width = rendition.width) !== null && _rendition$width !== void 0 ? _rendition$width : 1920,
130
+ height: (_rendition$height = rendition.height) !== null && _rendition$height !== void 0 ? _rendition$height : 1080,
131
+ bitrate: rendition.bitrate || 5e6,
132
+ framerate: (_rendition$frameRate = rendition.frameRate) !== null && _rendition$frameRate !== void 0 ? _rendition$frameRate : 30,
133
+ transferFunction: rendition.videoRange === "HLG" ? "hlg" : "pq",
134
+ colorGamut: "rec2020"
135
+ }
136
+ })).supported;
137
+ } catch (_unused) {
138
+ formats[key] = false;
139
+ }
140
+ }
141
+ if (mine !== run) return;
142
+ if (display === null && !known) {
143
+ state = {
144
+ display,
145
+ formats,
146
+ source: "default",
147
+ allowed: false
148
+ };
149
+ apply("all");
150
+ return;
151
+ }
152
+ if (display === false) {
153
+ state = {
154
+ display,
155
+ formats,
156
+ source: "probe",
157
+ allowed: false
158
+ };
159
+ apply("all");
160
+ return;
161
+ }
162
+ const unsupported = renditions.filter((r) => formats[formatOf(r)] === false);
163
+ state = {
164
+ display,
165
+ formats,
166
+ source: "probe",
167
+ allowed: unsupported.length < renditions.length
168
+ };
169
+ apply(unsupported.length === renditions.length ? "all" : unsupported);
170
+ });
171
+ return _evaluate.apply(this, arguments);
172
+ }
173
+ function onPresentation() {
174
+ const presentation = ctx.getState().presentation;
175
+ if (presentation === seen) return;
176
+ seen = presentation;
177
+ evaluate();
178
+ }
179
+ const query = typeof matchMedia === "function" ? matchMedia("(dynamic-range: high)") : null;
180
+ const onChange = () => {
181
+ evaluate();
182
+ };
183
+ if (query !== null) {
184
+ if (typeof query.addEventListener === "function") query.addEventListener("change", onChange);
185
+ else query.addListener(onChange);
186
+ }
187
+ const off = ctx.on("tracks:changed", onPresentation);
188
+ ctx.registerNamespace("hdr", {
189
+ get display() {
190
+ return state.display;
191
+ },
192
+ get formats() {
193
+ return state.formats;
194
+ },
195
+ get source() {
196
+ return state.source;
197
+ },
198
+ get allowed() {
199
+ return state.allowed;
200
+ }
201
+ });
202
+ return () => {
203
+ run += 1;
204
+ off();
205
+ if (query !== null) {
206
+ if (typeof query.removeEventListener === "function") query.removeEventListener("change", onChange);
207
+ else query.removeListener(onChange);
208
+ }
209
+ };
210
+ }
211
+ };
212
+ }
213
+ //#endregion
214
+ export { hdr as default };
@@ -1,4 +1,5 @@
1
- import { id3Cues } from "../../containers/id3.js";
1
+ import { id3Cues, id3Events } from "../../containers/id3.js";
2
+ import { deliverMetadata, metadataWanted } from "../../containers/metadata.js";
2
3
  import { createMetadataSink } from "../../kernel/sinks/metadata-sink.js";
3
4
  //#region src/stages/meta-id3/index.ts
4
5
  /**
@@ -13,6 +14,10 @@ import { createMetadataSink } from "../../kernel/sinks/metadata-sink.js";
13
14
  * legacy segments it rides in.
14
15
  */
15
16
  function parseId3Segment(data, meta) {
17
+ if (metadataWanted()) deliverMetadata(id3Events([{
18
+ time: meta.start,
19
+ bytes: data
20
+ }]));
16
21
  return id3Cues(data, meta.start);
17
22
  }
18
23
  function metaId3() {