mattebox 0.14.0 → 0.16.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 (255) hide show
  1. package/README.md +29 -21
  2. package/dist/cdn/mattebox.dash-drm.min.js +3 -3
  3. package/dist/cdn/mattebox.dash-ll.min.js +3 -0
  4. package/dist/cdn/mattebox.dash.min.js +3 -3
  5. package/dist/cdn/mattebox.dual-drm.min.js +3 -3
  6. package/dist/cdn/mattebox.dual-ll.min.js +3 -0
  7. package/dist/cdn/mattebox.dual-ts-drm.min.js +3 -3
  8. package/dist/cdn/mattebox.dual-ts.min.js +3 -3
  9. package/dist/cdn/mattebox.dual.min.js +3 -3
  10. package/dist/cdn/mattebox.hls-drm.min.js +3 -3
  11. package/dist/cdn/mattebox.hls-ll.min.js +3 -0
  12. package/dist/cdn/mattebox.hls-ts-drm.min.js +3 -3
  13. package/dist/cdn/mattebox.hls-ts.min.js +3 -3
  14. package/dist/cdn/mattebox.hls.min.js +3 -3
  15. package/dist/cdn/mattebox.kernel.min.js +1 -1
  16. package/dist/cdn/mattebox.min.js +6 -6
  17. package/dist/containers/fmp4/writer.d.ts +7 -1
  18. package/dist/containers/fmp4/writer.d.ts.map +1 -1
  19. package/dist/containers/fmp4/writer.js +2 -1
  20. package/dist/containers/fmp4/writer.js.map +1 -1
  21. package/dist/containers/mp4-box/index.d.ts +8 -0
  22. package/dist/containers/mp4-box/index.d.ts.map +1 -1
  23. package/dist/containers/mp4-box/index.js +27 -0
  24. package/dist/containers/mp4-box/index.js.map +1 -1
  25. package/dist/containers/ts-transmux/demux.d.ts +2 -0
  26. package/dist/containers/ts-transmux/demux.d.ts.map +1 -1
  27. package/dist/containers/ts-transmux/demux.js +3 -1
  28. package/dist/containers/ts-transmux/demux.js.map +1 -1
  29. package/dist/containers/ts-transmux/h265.d.ts +51 -0
  30. package/dist/containers/ts-transmux/h265.d.ts.map +1 -0
  31. package/dist/containers/ts-transmux/h265.js +182 -0
  32. package/dist/containers/ts-transmux/h265.js.map +1 -0
  33. package/dist/containers/ts-transmux/transmux.d.ts +3 -2
  34. package/dist/containers/ts-transmux/transmux.d.ts.map +1 -1
  35. package/dist/containers/ts-transmux/transmux.js +35 -11
  36. package/dist/containers/ts-transmux/transmux.js.map +1 -1
  37. package/dist/eme/index.d.ts +1 -10
  38. package/dist/eme/index.d.ts.map +1 -1
  39. package/dist/eme/index.js +4 -2
  40. package/dist/eme/index.js.map +1 -1
  41. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.154.0}/helpers/esm/asyncToGenerator.js +1 -1
  42. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.154.0}/helpers/esm/defineProperty.js +1 -1
  43. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.154.0}/helpers/esm/objectSpread2.js +1 -1
  44. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.154.0}/helpers/esm/objectWithoutProperties.js +1 -1
  45. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.154.0}/helpers/esm/objectWithoutPropertiesLoose.js +1 -1
  46. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.154.0}/helpers/esm/toPrimitive.js +1 -1
  47. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.154.0}/helpers/esm/toPropertyKey.js +1 -1
  48. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.154.0}/helpers/esm/typeof.js +1 -1
  49. package/dist/es2015/containers/fmp4/writer.js +2 -1
  50. package/dist/es2015/containers/id3.js +1 -1
  51. package/dist/es2015/containers/mp4-box/index.js +24 -1
  52. package/dist/es2015/containers/scte35.js +1 -1
  53. package/dist/es2015/containers/ts-transmux/demux.js +3 -1
  54. package/dist/es2015/containers/ts-transmux/h264.js +1 -1
  55. package/dist/es2015/containers/ts-transmux/h265.js +175 -0
  56. package/dist/es2015/containers/ts-transmux/index.js +1 -1
  57. package/dist/es2015/containers/ts-transmux/runner.js +2 -2
  58. package/dist/es2015/containers/ts-transmux/transmux.js +39 -16
  59. package/dist/es2015/containers/webvtt.js +1 -1
  60. package/dist/es2015/containers/wvtt.js +1 -1
  61. package/dist/es2015/eme/index.js +7 -5
  62. package/dist/es2015/index.js +8 -4
  63. package/dist/es2015/kernel/append-queue.js +1 -1
  64. package/dist/es2015/kernel/characteristics.js +19 -1
  65. package/dist/es2015/kernel/context.js +7 -0
  66. package/dist/es2015/kernel/dry-run.js +1 -1
  67. package/dist/es2015/kernel/mse.js +1 -1
  68. package/dist/es2015/kernel/prepare.js +3 -3
  69. package/dist/es2015/kernel/presentation.js +10 -1
  70. package/dist/es2015/kernel/reducer.js +92 -33
  71. package/dist/es2015/kernel/refresh.js +2 -2
  72. package/dist/es2015/kernel/rendition-select.js +2 -2
  73. package/dist/es2015/kernel/scheduler.js +31 -6
  74. package/dist/es2015/kernel/timeline.js +1 -1
  75. package/dist/es2015/kernel/trace.js +1 -1
  76. package/dist/es2015/kernel/transport.js +154 -22
  77. package/dist/es2015/presets/dash-ll/index.js +15 -0
  78. package/dist/es2015/presets/define.js +2 -2
  79. package/dist/es2015/presets/dual-ll/index.js +16 -0
  80. package/dist/es2015/presets/full/index.js +6 -4
  81. package/dist/es2015/presets/hls-ll/index.js +14 -0
  82. package/dist/es2015/presets/tiers.js +28 -3
  83. package/dist/es2015/protocols/dash-cmaf/index.js +13 -8
  84. package/dist/es2015/protocols/dash-cmaf/parse.js +129 -41
  85. package/dist/es2015/protocols/dash-cmaf/periods-runtime.js +1 -1
  86. package/dist/es2015/protocols/dash-cmaf/periods.js +1 -1
  87. package/dist/es2015/protocols/dash-live/index.js +75 -21
  88. package/dist/es2015/protocols/dash-ll/index.js +42 -0
  89. package/dist/es2015/protocols/hls-cmaf/index.js +5 -5
  90. package/dist/es2015/protocols/hls-cmaf/lexer.js +7 -1
  91. package/dist/es2015/protocols/hls-cmaf/parse.js +90 -27
  92. package/dist/es2015/protocols/hls-cmaf/unavailable.js +4 -3
  93. package/dist/es2015/protocols/hls-live/index.js +92 -18
  94. package/dist/es2015/protocols/hls-ll/index.js +30 -0
  95. package/dist/es2015/protocols/hls-ll/parse.js +240 -0
  96. package/dist/es2015/stages/abr/index.js +9 -2
  97. package/dist/es2015/stages/aes-128/index.js +1 -1
  98. package/dist/es2015/stages/chapters/index.js +2 -2
  99. package/dist/es2015/stages/chapters/parse.js +2 -2
  100. package/dist/es2015/stages/cmcd/index.js +7 -1
  101. package/dist/es2015/stages/codec-probe/index.js +1 -1
  102. package/dist/es2015/stages/content-steering/index.js +1 -1
  103. package/dist/es2015/stages/eme-core/index.js +193 -42
  104. package/dist/es2015/stages/eme-fairplay/index.js +1 -1
  105. package/dist/es2015/stages/hdr/index.js +1 -1
  106. package/dist/es2015/stages/live-catchup/index.js +221 -0
  107. package/dist/es2015/stages/qoe/index.js +1 -1
  108. package/dist/es2015/stages/recovery/index.js +2 -2
  109. package/dist/es2015/stages/rendition-names/index.js +1 -1
  110. package/dist/es2015/stages/text-cea608/decode.js +1 -1
  111. package/dist/es2015/stages/text-cea708/decode.js +2 -2
  112. package/dist/es2015/stages/text-cea708/index.js +1 -1
  113. package/dist/es2015/stages/text-ttml/images.js +60 -0
  114. package/dist/es2015/stages/text-ttml/index.js +22 -6
  115. package/dist/es2015/stages/text-ttml/parse.js +71 -5
  116. package/dist/es2015/stages/thumbnails/index.js +1 -1
  117. package/dist/es2015/stages/timed-metadata/index.js +1 -1
  118. package/dist/es2015/stages/trick-play/index.js +1 -1
  119. package/dist/index.d.ts +1 -1
  120. package/dist/index.d.ts.map +1 -1
  121. package/dist/index.js +2 -1
  122. package/dist/index.js.map +1 -1
  123. package/dist/kernel/characteristics.d.ts +8 -1
  124. package/dist/kernel/characteristics.d.ts.map +1 -1
  125. package/dist/kernel/characteristics.js +23 -0
  126. package/dist/kernel/characteristics.js.map +1 -1
  127. package/dist/kernel/context.d.ts +4 -6
  128. package/dist/kernel/context.d.ts.map +1 -1
  129. package/dist/kernel/context.js +10 -0
  130. package/dist/kernel/context.js.map +1 -1
  131. package/dist/kernel/lifecycle.d.ts +2 -6
  132. package/dist/kernel/lifecycle.d.ts.map +1 -1
  133. package/dist/kernel/lifecycle.js.map +1 -1
  134. package/dist/kernel/prepare.d.ts +3 -0
  135. package/dist/kernel/prepare.d.ts.map +1 -1
  136. package/dist/kernel/prepare.js +2 -1
  137. package/dist/kernel/prepare.js.map +1 -1
  138. package/dist/kernel/presentation.d.ts +5 -0
  139. package/dist/kernel/presentation.d.ts.map +1 -1
  140. package/dist/kernel/presentation.js +9 -0
  141. package/dist/kernel/presentation.js.map +1 -1
  142. package/dist/kernel/reducer.d.ts.map +1 -1
  143. package/dist/kernel/reducer.js +108 -49
  144. package/dist/kernel/reducer.js.map +1 -1
  145. package/dist/kernel/refresh.d.ts.map +1 -1
  146. package/dist/kernel/refresh.js +2 -0
  147. package/dist/kernel/refresh.js.map +1 -1
  148. package/dist/kernel/scheduler.d.ts.map +1 -1
  149. package/dist/kernel/scheduler.js +40 -3
  150. package/dist/kernel/scheduler.js.map +1 -1
  151. package/dist/kernel/transport.d.ts +34 -5
  152. package/dist/kernel/transport.d.ts.map +1 -1
  153. package/dist/kernel/transport.js +148 -11
  154. package/dist/kernel/transport.js.map +1 -1
  155. package/dist/presets/dash-ll/index.d.ts +4 -0
  156. package/dist/presets/dash-ll/index.d.ts.map +1 -0
  157. package/dist/presets/dash-ll/index.js +10 -0
  158. package/dist/presets/dash-ll/index.js.map +1 -0
  159. package/dist/presets/dual-ll/index.d.ts +4 -0
  160. package/dist/presets/dual-ll/index.d.ts.map +1 -0
  161. package/dist/presets/dual-ll/index.js +15 -0
  162. package/dist/presets/dual-ll/index.js.map +1 -0
  163. package/dist/presets/full/index.d.ts.map +1 -1
  164. package/dist/presets/full/index.js +6 -4
  165. package/dist/presets/full/index.js.map +1 -1
  166. package/dist/presets/hls-ll/index.d.ts +4 -0
  167. package/dist/presets/hls-ll/index.d.ts.map +1 -0
  168. package/dist/presets/hls-ll/index.js +9 -0
  169. package/dist/presets/hls-ll/index.js.map +1 -0
  170. package/dist/presets/tiers.d.ts +16 -0
  171. package/dist/presets/tiers.d.ts.map +1 -1
  172. package/dist/presets/tiers.js +25 -0
  173. package/dist/presets/tiers.js.map +1 -1
  174. package/dist/protocols/dash-cmaf/index.d.ts +29 -1
  175. package/dist/protocols/dash-cmaf/index.d.ts.map +1 -1
  176. package/dist/protocols/dash-cmaf/index.js +9 -4
  177. package/dist/protocols/dash-cmaf/index.js.map +1 -1
  178. package/dist/protocols/dash-cmaf/parse.d.ts +8 -2
  179. package/dist/protocols/dash-cmaf/parse.d.ts.map +1 -1
  180. package/dist/protocols/dash-cmaf/parse.js +121 -14
  181. package/dist/protocols/dash-cmaf/parse.js.map +1 -1
  182. package/dist/protocols/dash-live/index.d.ts +22 -0
  183. package/dist/protocols/dash-live/index.d.ts.map +1 -1
  184. package/dist/protocols/dash-live/index.js +77 -18
  185. package/dist/protocols/dash-live/index.js.map +1 -1
  186. package/dist/protocols/dash-ll/index.d.ts +27 -0
  187. package/dist/protocols/dash-ll/index.d.ts.map +1 -0
  188. package/dist/protocols/dash-ll/index.js +35 -0
  189. package/dist/protocols/dash-ll/index.js.map +1 -0
  190. package/dist/protocols/hls-cmaf/index.d.ts +23 -0
  191. package/dist/protocols/hls-cmaf/index.d.ts.map +1 -1
  192. package/dist/protocols/hls-cmaf/index.js +4 -4
  193. package/dist/protocols/hls-cmaf/index.js.map +1 -1
  194. package/dist/protocols/hls-cmaf/lexer.d.ts.map +1 -1
  195. package/dist/protocols/hls-cmaf/lexer.js +7 -0
  196. package/dist/protocols/hls-cmaf/lexer.js.map +1 -1
  197. package/dist/protocols/hls-cmaf/parse.d.ts +28 -2
  198. package/dist/protocols/hls-cmaf/parse.d.ts.map +1 -1
  199. package/dist/protocols/hls-cmaf/parse.js +106 -11
  200. package/dist/protocols/hls-cmaf/parse.js.map +1 -1
  201. package/dist/protocols/hls-cmaf/unavailable.d.ts +1 -1
  202. package/dist/protocols/hls-cmaf/unavailable.d.ts.map +1 -1
  203. package/dist/protocols/hls-cmaf/unavailable.js +8 -2
  204. package/dist/protocols/hls-cmaf/unavailable.js.map +1 -1
  205. package/dist/protocols/hls-live/index.d.ts +65 -0
  206. package/dist/protocols/hls-live/index.d.ts.map +1 -1
  207. package/dist/protocols/hls-live/index.js +115 -16
  208. package/dist/protocols/hls-live/index.js.map +1 -1
  209. package/dist/protocols/hls-ll/index.d.ts +22 -0
  210. package/dist/protocols/hls-ll/index.d.ts.map +1 -0
  211. package/dist/protocols/hls-ll/index.js +32 -0
  212. package/dist/protocols/hls-ll/index.js.map +1 -0
  213. package/dist/protocols/hls-ll/parse.d.ts +45 -0
  214. package/dist/protocols/hls-ll/parse.d.ts.map +1 -0
  215. package/dist/protocols/hls-ll/parse.js +300 -0
  216. package/dist/protocols/hls-ll/parse.js.map +1 -0
  217. package/dist/stages/abr/index.d.ts.map +1 -1
  218. package/dist/stages/abr/index.js +6 -6
  219. package/dist/stages/abr/index.js.map +1 -1
  220. package/dist/stages/cmcd/index.d.ts.map +1 -1
  221. package/dist/stages/cmcd/index.js +12 -3
  222. package/dist/stages/cmcd/index.js.map +1 -1
  223. package/dist/stages/eme-core/index.d.ts +67 -2
  224. package/dist/stages/eme-core/index.d.ts.map +1 -1
  225. package/dist/stages/eme-core/index.js +191 -40
  226. package/dist/stages/eme-core/index.js.map +1 -1
  227. package/dist/stages/live-catchup/index.d.ts +42 -0
  228. package/dist/stages/live-catchup/index.d.ts.map +1 -0
  229. package/dist/stages/live-catchup/index.js +217 -0
  230. package/dist/stages/live-catchup/index.js.map +1 -0
  231. package/dist/stages/recovery/index.d.ts.map +1 -1
  232. package/dist/stages/recovery/index.js +6 -2
  233. package/dist/stages/recovery/index.js.map +1 -1
  234. package/dist/stages/text-ttml/images.d.ts +10 -0
  235. package/dist/stages/text-ttml/images.d.ts.map +1 -0
  236. package/dist/stages/text-ttml/images.js +71 -0
  237. package/dist/stages/text-ttml/images.js.map +1 -0
  238. package/dist/stages/text-ttml/index.d.ts +13 -0
  239. package/dist/stages/text-ttml/index.d.ts.map +1 -1
  240. package/dist/stages/text-ttml/index.js +26 -6
  241. package/dist/stages/text-ttml/index.js.map +1 -1
  242. package/dist/stages/text-ttml/parse.d.ts +5 -2
  243. package/dist/stages/text-ttml/parse.d.ts.map +1 -1
  244. package/dist/stages/text-ttml/parse.js +74 -2
  245. package/dist/stages/text-ttml/parse.js.map +1 -1
  246. package/dist/types/ir.d.ts +43 -0
  247. package/dist/types/ir.d.ts.map +1 -1
  248. package/dist/types/kernel.d.ts +4 -0
  249. package/dist/types/kernel.d.ts.map +1 -1
  250. package/dist/types/kernel.js.map +1 -1
  251. package/dist/types/messages.d.ts +40 -0
  252. package/dist/types/messages.d.ts.map +1 -1
  253. package/dist/types/stage.d.ts +24 -5
  254. package/dist/types/stage.d.ts.map +1 -1
  255. package/package.json +4 -2
@@ -0,0 +1,221 @@
1
+ //#region src/stages/live-catchup/index.ts
2
+ /** dash.js limits the rates to 0.5 and 2. */
3
+ const RATE_FLOOR = .5;
4
+ const RATE_CEILING = 2;
5
+ /**
6
+ * The rate for a drift, pure: dash.js's default catch-up curve. It is 1 on
7
+ * target and approaches the bound as the drift grows.
8
+ */
9
+ function catchupRate(latency, target, bounds) {
10
+ const drift = latency - target;
11
+ const reach = drift < 0 ? 1 - bounds.minRate : bounds.maxRate - 1;
12
+ return 1 - reach + 2 * reach / (1 + Math.exp(-5 * drift));
13
+ }
14
+ /**
15
+ * The smallest rate change worth writing: dash.js's 0.02, scaled to the
16
+ * fastest rate, so 0.02 for a bound of 1.5 and less for a narrower one.
17
+ */
18
+ function rateStep(bounds) {
19
+ return .02 * (bounds.maxRate - 1) / .5;
20
+ }
21
+ /** HTMLMediaElement HAVE_FUTURE_DATA. */
22
+ const HAVE_FUTURE_DATA = 3;
23
+ /** Seconds of drift past which the stage seeks, without a manifest value (dash.js). */
24
+ const DEFAULT_MAX_DRIFT = 12;
25
+ /** A viewer's seek that lands this close to the target counts as a return to it. */
26
+ const NEAR_TARGET = .5;
27
+ /**
28
+ * Whether the page had a user interaction. Browsers without
29
+ * `navigator.userActivation` (before Safari 16.4) count as yes.
30
+ */
31
+ function activated() {
32
+ var _globalThis$navigator;
33
+ const activation = (_globalThis$navigator = globalThis.navigator) === null || _globalThis$navigator === void 0 ? void 0 : _globalThis$navigator.userActivation;
34
+ return activation === void 0 || activation.hasBeenActive;
35
+ }
36
+ function clampRate(rate) {
37
+ return Math.min(RATE_CEILING, Math.max(RATE_FLOOR, rate));
38
+ }
39
+ function liveCatchup(options = {}) {
40
+ return {
41
+ name: "live-catchup",
42
+ provides: ["live-catchup"],
43
+ install(ctx) {
44
+ var _options$targetLatenc;
45
+ const element = ctx.element;
46
+ let chosen = (_options$targetLatenc = options.targetLatency) !== null && _options$targetLatenc !== void 0 ? _options$targetLatenc : null;
47
+ /** The latency the viewer moved to, which the stage holds instead of the target. */
48
+ let moved = null;
49
+ /** The rate this stage set last, or null when it set none. */
50
+ let ours = null;
51
+ let selfSeek = false;
52
+ /** A stall happened; the rate stays 1 until the buffer recovers. */
53
+ let stalled = false;
54
+ /** Playback started: the start-up seek and first play are the engine's, not the viewer's. */
55
+ let started = false;
56
+ let knownEnd = null;
57
+ let movedAt = 0;
58
+ const now = () => performance.now() / 1e3;
59
+ function live() {
60
+ var _state$presentation;
61
+ const state = ctx.getState();
62
+ if (state.live === null || ((_state$presentation = state.presentation) === null || _state$presentation === void 0 ? void 0 : _state$presentation.isLive) !== true) return null;
63
+ return {
64
+ end: state.live.span.end,
65
+ edge: state.live.edge,
66
+ info: state.presentation.live
67
+ };
68
+ }
69
+ function latency() {
70
+ const window = live();
71
+ if (window === null) return null;
72
+ if (window.end !== knownEnd) {
73
+ knownEnd = window.end;
74
+ movedAt = now();
75
+ }
76
+ return window.end + (now() - movedAt) - element.currentTime;
77
+ }
78
+ /** The manifest's or the page's target. */
79
+ function baseTarget() {
80
+ var _chosen;
81
+ const window = live();
82
+ if (window === null) return null;
83
+ return (_chosen = chosen) !== null && _chosen !== void 0 ? _chosen : Math.max(0, window.end - window.edge);
84
+ }
85
+ function target() {
86
+ var _moved;
87
+ const base = baseTarget();
88
+ return base === null ? null : (_moved = moved) !== null && _moved !== void 0 ? _moved : base;
89
+ }
90
+ function bounds() {
91
+ var _live, _ref, _options$minRate, _ref2, _options$maxRate;
92
+ const rates = (_live = live()) === null || _live === void 0 || (_live = _live.info) === null || _live === void 0 ? void 0 : _live.playbackRate;
93
+ return {
94
+ minRate: clampRate((_ref = (_options$minRate = options.minRate) !== null && _options$minRate !== void 0 ? _options$minRate : rates === null || rates === void 0 ? void 0 : rates.min) !== null && _ref !== void 0 ? _ref : .5),
95
+ maxRate: clampRate((_ref2 = (_options$maxRate = options.maxRate) !== null && _options$maxRate !== void 0 ? _options$maxRate : rates === null || rates === void 0 ? void 0 : rates.max) !== null && _ref2 !== void 0 ? _ref2 : 1.5)
96
+ };
97
+ }
98
+ function maxDrift() {
99
+ var _live2;
100
+ if (options.maxDrift !== void 0) return options.maxDrift;
101
+ const max = (_live2 = live()) === null || _live2 === void 0 || (_live2 = _live2.info) === null || _live2 === void 0 ? void 0 : _live2.maxLatency;
102
+ const base = baseTarget();
103
+ if (max !== void 0 && base !== null && max > base) return max - base + .5;
104
+ return DEFAULT_MAX_DRIFT;
105
+ }
106
+ function bufferAhead() {
107
+ const time = element.currentTime;
108
+ const ranges = element.buffered;
109
+ for (let i = 0; i < ranges.length; i += 1) if (ranges.start(i) <= time + .1 && ranges.end(i) > time) return ranges.end(i) - time;
110
+ return 0;
111
+ }
112
+ function setRate(rate, current, goal) {
113
+ if (element.playbackRate === rate) return;
114
+ element.playbackRate = rate;
115
+ ours = rate;
116
+ ctx.emit("catchup:rate", {
117
+ rate,
118
+ latency: current,
119
+ target: goal
120
+ });
121
+ }
122
+ /** Gives the element back its normal rate, when the stage set another. */
123
+ function release() {
124
+ if (ours !== null && ours !== 1) setRate(1, latency(), target());
125
+ ours = null;
126
+ }
127
+ /** Whether catch-up applies to the stream playing. */
128
+ function applies() {
129
+ var _options$enabled, _live3;
130
+ return (_options$enabled = options.enabled) !== null && _options$enabled !== void 0 ? _options$enabled : ((_live3 = live()) === null || _live3 === void 0 || (_live3 = _live3.info) === null || _live3 === void 0 ? void 0 : _live3.lowLatency) === true;
131
+ }
132
+ const onTime = () => {
133
+ const current = latency();
134
+ const goal = target();
135
+ if (current === null || goal === null || !applies()) {
136
+ release();
137
+ return;
138
+ }
139
+ if (element.paused || element.seeking) return;
140
+ if (current - goal > maxDrift()) {
141
+ selfSeek = true;
142
+ release();
143
+ ctx.emit("catchup:seek", {
144
+ latency: current,
145
+ target: goal
146
+ });
147
+ ctx.dispatch({ type: "SEEK_TO_LIVE_EDGE" });
148
+ return;
149
+ }
150
+ if (stalled && bufferAhead() > goal / 2) stalled = false;
151
+ if (!activated() || element.readyState < HAVE_FUTURE_DATA) return;
152
+ const range = bounds();
153
+ const rate = stalled ? 1 : catchupRate(current, goal, range);
154
+ if (rate === 1 || Math.abs(element.playbackRate - rate) >= rateStep(range)) setRate(rate, current, goal);
155
+ };
156
+ /** The viewer moved the playhead: hold the latency there, or the target when it is near. */
157
+ const onSettle = () => {
158
+ if (selfSeek || !started) {
159
+ selfSeek = false;
160
+ moved = null;
161
+ return;
162
+ }
163
+ const current = latency();
164
+ const base = baseTarget();
165
+ if (current === null || base === null) return;
166
+ moved = Math.abs(current - base) <= NEAR_TARGET ? null : current;
167
+ };
168
+ const onWaiting = () => {
169
+ stalled = true;
170
+ };
171
+ const onPlaying = () => {
172
+ started = true;
173
+ };
174
+ element.addEventListener("timeupdate", onTime);
175
+ element.addEventListener("seeked", onSettle);
176
+ element.addEventListener("play", onSettle);
177
+ element.addEventListener("waiting", onWaiting);
178
+ element.addEventListener("playing", onPlaying);
179
+ const offTrace = ctx.on("trace", (entry) => {
180
+ const type = entry.msg.type;
181
+ if (type === "LOAD" || type === "UNLOAD") {
182
+ release();
183
+ moved = null;
184
+ stalled = false;
185
+ started = false;
186
+ knownEnd = null;
187
+ }
188
+ });
189
+ ctx.registerNamespace("catchup", {
190
+ get target() {
191
+ return target();
192
+ },
193
+ get latency() {
194
+ return latency();
195
+ },
196
+ get rate() {
197
+ var _ours;
198
+ return (_ours = ours) !== null && _ours !== void 0 ? _ours : 1;
199
+ },
200
+ get active() {
201
+ return moved === null && live() !== null && applies();
202
+ },
203
+ setTarget(seconds) {
204
+ chosen = seconds;
205
+ moved = null;
206
+ }
207
+ });
208
+ return () => {
209
+ element.removeEventListener("timeupdate", onTime);
210
+ element.removeEventListener("seeked", onSettle);
211
+ element.removeEventListener("play", onSettle);
212
+ element.removeEventListener("waiting", onWaiting);
213
+ element.removeEventListener("playing", onPlaying);
214
+ offTrace();
215
+ release();
216
+ };
217
+ }
218
+ };
219
+ }
220
+ //#endregion
221
+ export { catchupRate, liveCatchup as default };
@@ -1,4 +1,4 @@
1
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/objectSpread2.js";
1
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/objectSpread2.js";
2
2
  //#region src/stages/qoe/index.ts
3
3
  function qoe() {
4
4
  return {
@@ -1,4 +1,4 @@
1
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/objectSpread2.js";
1
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/objectSpread2.js";
2
2
  import { scheduled, tickAfter } from "../../kernel/effects.js";
3
3
  import { findRendition, findTrackSite } from "../../kernel/presentation.js";
4
4
  import { segmentAt as segmentAt$1, segmentAtTime } from "../../kernel/timeline.js";
@@ -87,7 +87,7 @@ function createRecoveryReducer(options) {
87
87
  if (msg.type === "DETACH" || msg.type === "UNLOAD" || msg.type === "LOAD") return [INITIAL, msg.type === "LOAD" ? [] : []];
88
88
  if (msg.type === "SEGMENT_FAILED") {
89
89
  var _state$renditionFails, _state$seqFails$seqKe;
90
- if (msg.renditionId === void 0 || isCueTrack(kernel, msg.trackId)) return [state, []];
90
+ if (msg.renditionId === void 0 || msg.preload === true || isCueTrack(kernel, msg.trackId)) return [state, []];
91
91
  const effects = [];
92
92
  const renditionFails = _objectSpread2(_objectSpread2({}, state.renditionFails), {}, { [msg.renditionId]: ((_state$renditionFails = state.renditionFails[msg.renditionId]) !== null && _state$renditionFails !== void 0 ? _state$renditionFails : 0) + 1 });
93
93
  const seqKey = `${msg.trackId}:${msg.seq}`;
@@ -1,4 +1,4 @@
1
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/objectSpread2.js";
1
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/objectSpread2.js";
2
2
  //#region src/stages/rendition-names/index.ts
3
3
  const DATA_ID = "_hls.localized-rendition-names";
4
4
  const FETCH_TOKEN = "rendition-names:dictionary";
@@ -1,4 +1,4 @@
1
- import _defineProperty from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/defineProperty.js";
1
+ import _defineProperty from "../../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/defineProperty.js";
2
2
  //#region src/stages/text-cea608/decode.ts
3
3
  const ROWS = 15;
4
4
  /** The basic CEA-608 character set: ASCII with a handful of substitutions. */
@@ -1,5 +1,5 @@
1
- import _defineProperty from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/defineProperty.js";
2
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/objectSpread2.js";
1
+ import _defineProperty from "../../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/defineProperty.js";
2
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/objectSpread2.js";
3
3
  import { escapeCueText } from "../../containers/webvtt.js";
4
4
  //#region src/stages/text-cea708/decode.ts
5
5
  /**
@@ -1,4 +1,4 @@
1
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/objectSpread2.js";
1
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/objectSpread2.js";
2
2
  import { registerCaptionConsumer } from "../../containers/captions.js";
3
3
  import { inbandCaptions, vttCue } from "../../kernel/sinks/caption-tracks.js";
4
4
  import { Dtvcc } from "./decode.js";
@@ -0,0 +1,60 @@
1
+ //#region src/stages/text-ttml/images.ts
2
+ function imageOf(cue) {
3
+ const payload = cue.payload;
4
+ return typeof (payload === null || payload === void 0 ? void 0 : payload.image) === "string" ? payload : null;
5
+ }
6
+ /** Draws the image cues into `container` until the returned function stops it. */
7
+ function showImages(element, container) {
8
+ const tracks = element.textTracks;
9
+ const drawn = [];
10
+ const watched = /* @__PURE__ */ new Set();
11
+ function render() {
12
+ for (const img of drawn.splice(0)) img.remove();
13
+ for (let i = 0; i < tracks.length; i += 1) {
14
+ const track = tracks[i];
15
+ if (track.mode !== "showing") continue;
16
+ const active = track.activeCues;
17
+ for (let j = 0; active !== null && j < active.length; j += 1) {
18
+ const box = imageOf(active[j]);
19
+ if (box === null) continue;
20
+ const img = document.createElement("img");
21
+ img.src = box.image;
22
+ img.alt = "";
23
+ const style = img.style;
24
+ style.position = "absolute";
25
+ style.left = `${box.left}%`;
26
+ style.top = `${box.top}%`;
27
+ style.width = `${box.width}%`;
28
+ style.height = `${box.height}%`;
29
+ style.objectFit = "contain";
30
+ style.pointerEvents = "none";
31
+ container.appendChild(img);
32
+ drawn.push(img);
33
+ }
34
+ }
35
+ }
36
+ function watch() {
37
+ for (let i = 0; i < tracks.length; i += 1) {
38
+ const track = tracks[i];
39
+ if (watched.has(track)) continue;
40
+ watched.add(track);
41
+ track.addEventListener("cuechange", render);
42
+ }
43
+ }
44
+ const onTracks = () => {
45
+ watch();
46
+ render();
47
+ };
48
+ tracks.addEventListener("addtrack", onTracks);
49
+ tracks.addEventListener("change", onTracks);
50
+ onTracks();
51
+ return () => {
52
+ tracks.removeEventListener("addtrack", onTracks);
53
+ tracks.removeEventListener("change", onTracks);
54
+ for (const track of watched) track.removeEventListener("cuechange", render);
55
+ watched.clear();
56
+ for (const img of drawn.splice(0)) img.remove();
57
+ };
58
+ }
59
+ //#endregion
60
+ export { showImages };
@@ -1,8 +1,9 @@
1
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/objectSpread2.js";
1
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/objectSpread2.js";
2
2
  import { findRendition } from "../../kernel/presentation.js";
3
3
  import { segmentAt } from "../../kernel/timeline.js";
4
4
  import { timedSamples, trackTimescales } from "../../containers/mp4-box/index.js";
5
5
  import { joinTextSink } from "../../kernel/sinks/text-formats.js";
6
+ import { showImages } from "./images.js";
6
7
  import { parseTtml } from "./parse.js";
7
8
  //#region src/stages/text-ttml/index.ts
8
9
  /**
@@ -22,15 +23,21 @@ import { parseTtml } from "./parse.js";
22
23
  * not: a VTTCue carries them only through page CSS, which the engine does
23
24
  * not write. Each cue's `payload` holds its resolved styles, for a player
24
25
  * that draws captions itself.
26
+ *
27
+ * Image subtitles (the IMSC1 Image Profile) become cues without text. They
28
+ * show in the container a page passes to `engine.ttml.showImages`.
25
29
  */
26
30
  const TTML = "application/ttml+xml";
27
31
  /** The cues with open ends closed at `end`, and an id for each, so a refetched segment adds nothing twice. */
28
32
  function finish(cues, shift, end) {
29
33
  return cues.map((cue) => {
34
+ var _cue$payload;
30
35
  const start = cue.start + shift;
31
36
  const stop = Math.min(cue.end + shift, end);
37
+ const image = (_cue$payload = cue.payload) === null || _cue$payload === void 0 ? void 0 : _cue$payload.image;
38
+ const key = cue.text !== "" || image === void 0 ? cue.text : `${image.length}:${image.slice(-24)}`;
32
39
  return _objectSpread2(_objectSpread2({}, cue), {}, {
33
- id: `${start.toFixed(3)}|${stop.toFixed(3)}|${cue.text}`,
40
+ id: `${start.toFixed(3)}|${stop.toFixed(3)}|${key}`,
34
41
  start,
35
42
  end: stop
36
43
  });
@@ -72,15 +79,24 @@ function textTtml() {
72
79
  * DASH period's start when the segment carries that offset.
73
80
  */
74
81
  function parseDocument(data, meta) {
75
- var _segmentAt;
76
82
  const site = findRendition(ctx.getState().presentation, meta.renditionId);
77
- const offset = site === null ? void 0 : (_segmentAt = segmentAt(site.rendition.segments, meta.seq, site.period.start)) === null || _segmentAt === void 0 ? void 0 : _segmentAt.timeOffset;
78
- return finish(parseTtml(new TextDecoder().decode(data)), offset !== null && offset !== void 0 ? offset : 0, meta.start + meta.duration);
83
+ const segment = site === null ? null : segmentAt(site.rendition.segments, meta.seq, site.period.start);
84
+ const offset = segment === null || segment === void 0 ? void 0 : segment.timeOffset;
85
+ return finish(parseTtml(new TextDecoder().decode(data), segment === null || segment === void 0 ? void 0 : segment.url), offset !== null && offset !== void 0 ? offset : 0, meta.start + meta.duration);
79
86
  }
80
- return joinTextSink(ctx, {
87
+ let stopImages = null;
88
+ ctx.registerNamespace("ttml", { showImages(container) {
89
+ stopImages === null || stopImages === void 0 || stopImages();
90
+ stopImages = container === null ? null : showImages(ctx.element, container);
91
+ } });
92
+ const leave = joinTextSink(ctx, {
81
93
  [TTML]: parseDocument,
82
94
  "application/mp4;stpp": parseStpp
83
95
  });
96
+ return () => {
97
+ stopImages === null || stopImages === void 0 || stopImages();
98
+ leave();
99
+ };
84
100
  }
85
101
  };
86
102
  }
@@ -1,4 +1,4 @@
1
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/objectSpread2.js";
1
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/objectSpread2.js";
2
2
  import { escapeCueText } from "../../containers/webvtt.js";
3
3
  //#region src/stages/text-ttml/parse.ts
4
4
  /**
@@ -8,12 +8,21 @@ import { escapeCueText } from "../../containers/webvtt.js";
8
8
  * styles a cue can show, and the region a `p` is flowed into. Anything else
9
9
  * is ignored, so a richer document still shows its text.
10
10
  *
11
+ * The Image Profile (IMSC1 §6) puts a PNG on a `div`: its
12
+ * `smpte:backgroundImage` names an `smpte:image` in the head's metadata
13
+ * (SMPTE ST 2052-1 §5.5.2), base64 encoded, or a file. IMSC 1.1 also allows
14
+ * an `image` child with `src` (TTML2 §8.1.11). Such a div becomes a cue with
15
+ * no text; its payload's `image` holds the PNG as a data URL or the file's
16
+ * URL, and `left`, `top`, `width` and `height` the region it fills, in
17
+ * percent of the video.
18
+ *
11
19
  * Times come back in document time; `Infinity` marks an end the document
12
20
  * leaves open, for the caller to close at its segment's end.
13
21
  */
14
22
  const TTP = "http://www.w3.org/ns/ttml#parameter";
15
23
  const TTS = "http://www.w3.org/ns/ttml#styling";
16
24
  const XML = "http://www.w3.org/XML/1998/namespace";
25
+ const SMPTE = "http://www.smpte-ra.org/schemas/2052-1/2010/smpte";
17
26
  /** The styles kept: what a cue shows, and what the raw form carries for a page. */
18
27
  const STYLES = [
19
28
  "fontStyle",
@@ -121,8 +130,11 @@ function settingsFor(style, root, cells) {
121
130
  ].includes(align)) out.push(`align:${align}`);
122
131
  return out.join(" ");
123
132
  }
124
- /** The cues of a TTML document. Throws a RangeError for bytes that are not XML. */
125
- function parseTtml(xml) {
133
+ /**
134
+ * The cues of a TTML document. Throws a RangeError for bytes that are not
135
+ * XML. `base` resolves an image file's relative URL.
136
+ */
137
+ function parseTtml(xml, base) {
126
138
  var _attrNS4, _attrNS5;
127
139
  const doc = new DOMParser().parseFromString(xml, "application/xml");
128
140
  const tt = doc.documentElement;
@@ -137,9 +149,28 @@ function parseTtml(xml) {
137
149
  const head = childElements(tt, "head")[0];
138
150
  for (const styling of head === void 0 ? [] : childElements(head, "styling")) for (const style of childElements(styling, "style")) styles.set(idOf(style), style);
139
151
  for (const layout of head === void 0 ? [] : childElements(head, "layout")) for (const region of childElements(layout, "region")) regions.set(idOf(region), region);
152
+ const images = /* @__PURE__ */ new Map();
153
+ for (const metadata of head === void 0 ? [] : childElements(head, "metadata")) for (const image of childElements(metadata, "image")) {
154
+ var _ref, _image$getAttribute, _image$textContent;
155
+ const type = ((_ref = (_image$getAttribute = image.getAttribute("imagetype")) !== null && _image$getAttribute !== void 0 ? _image$getAttribute : image.getAttribute("imageType")) !== null && _ref !== void 0 ? _ref : "PNG").trim().toLowerCase();
156
+ const data = ((_image$textContent = image.textContent) !== null && _image$textContent !== void 0 ? _image$textContent : "").replace(/\s+/g, "");
157
+ images.set(idOf(image), `data:image/${type};base64,${data}`);
158
+ }
159
+ /** An image reference as a URL: `#id` for an embedded image, else a file. */
160
+ function imageUrl(reference) {
161
+ var _images$get;
162
+ const ref = reference.trim();
163
+ if (ref.startsWith("#")) return (_images$get = images.get(ref.slice(1))) !== null && _images$get !== void 0 ? _images$get : null;
164
+ if (ref === "") return null;
165
+ try {
166
+ return base === void 0 ? ref : new URL(ref, base).href;
167
+ } catch (_unused) {
168
+ return null;
169
+ }
170
+ }
140
171
  function idOf(element) {
141
- var _ref, _element$getAttribute2;
142
- return (_ref = (_element$getAttribute2 = element.getAttributeNS(XML, "id")) !== null && _element$getAttribute2 !== void 0 ? _element$getAttribute2 : element.getAttribute("xml:id")) !== null && _ref !== void 0 ? _ref : "";
172
+ var _ref2, _element$getAttribute2;
173
+ return (_ref2 = (_element$getAttribute2 = element.getAttributeNS(XML, "id")) !== null && _element$getAttribute2 !== void 0 ? _element$getAttribute2 : element.getAttribute("xml:id")) !== null && _ref2 !== void 0 ? _ref2 : "";
143
174
  }
144
175
  /** The style an element specifies: referenced styles in order, then nested and inline ones. */
145
176
  function specified(element, seen = /* @__PURE__ */ new Set()) {
@@ -235,8 +266,43 @@ function parseTtml(xml) {
235
266
  cuesOf(element, placed, interval_);
236
267
  return;
237
268
  }
269
+ const image = element.localName === "div" ? imageOf(element) : null;
270
+ if (image !== null) {
271
+ cues.push({
272
+ start: interval_[0],
273
+ end: interval_[1],
274
+ text: "",
275
+ payload: imageBox(image, placed)
276
+ });
277
+ return;
278
+ }
238
279
  for (const child of childElements(element)) if (child.localName === "div" || child.localName === "p") walk(child, style, own, interval_);
239
280
  }
281
+ /**
282
+ * An image cue's payload: the image, and its region as percents of the
283
+ * video (`left`, `top`, `width`, `height`). A region the document does not
284
+ * size fills the video.
285
+ */
286
+ function imageBox(image, style) {
287
+ var _style$origin2, _style$extent2, _percent, _percent2, _percent3, _percent4;
288
+ const origin = ((_style$origin2 = style.origin) !== null && _style$origin2 !== void 0 ? _style$origin2 : "").split(/\s+/);
289
+ const extent = ((_style$extent2 = style.extent) !== null && _style$extent2 !== void 0 ? _style$extent2 : "").split(/\s+/);
290
+ return {
291
+ image,
292
+ left: (_percent = percent(origin[0], 0, root, cells)) !== null && _percent !== void 0 ? _percent : 0,
293
+ top: (_percent2 = percent(origin[1], 1, root, cells)) !== null && _percent2 !== void 0 ? _percent2 : 0,
294
+ width: (_percent3 = percent(extent[0], 0, root, cells)) !== null && _percent3 !== void 0 ? _percent3 : 100,
295
+ height: (_percent4 = percent(extent[1], 1, root, cells)) !== null && _percent4 !== void 0 ? _percent4 : 100
296
+ };
297
+ }
298
+ /** A div's image: `smpte:backgroundImage` (IMSC 1.0), else an `image` child (IMSC 1.1). */
299
+ function imageOf(div) {
300
+ const background = attrNS(div, SMPTE, "smpte", "backgroundImage");
301
+ if (background !== null) return imageUrl(background);
302
+ const child = childElements(div, "image")[0];
303
+ const src = child === null || child === void 0 ? void 0 : child.getAttribute("src");
304
+ return src === null || src === void 0 ? null : imageUrl(src);
305
+ }
240
306
  function pick(style) {
241
307
  const out = {};
242
308
  for (const key of [
@@ -1,5 +1,5 @@
1
1
  import { scheduled } from "../../kernel/effects.js";
2
- import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/asyncToGenerator.js";
2
+ import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/asyncToGenerator.js";
3
3
  import { isIndexed, segmentAt, segmentAtTime } from "../../kernel/timeline.js";
4
4
  import { parseVtt } from "../../containers/webvtt.js";
5
5
  import { resolveUrl } from "../../kernel/url.js";
@@ -1,4 +1,4 @@
1
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/objectSpread2.js";
1
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/objectSpread2.js";
2
2
  import { earliestDecodeTime, findBox, trackTimescales } from "../../containers/mp4-box/index.js";
3
3
  import { readEmsg } from "../../containers/emsg.js";
4
4
  import { id3Frames } from "../../containers/id3.js";
@@ -1,4 +1,4 @@
1
- import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/asyncToGenerator.js";
1
+ import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/asyncToGenerator.js";
2
2
  import { findRendition, findTrackSite, isTrick } from "../../kernel/presentation.js";
3
3
  import { isUnresolved, segmentAtTime } from "../../kernel/timeline.js";
4
4
  import { decoderConfigBox, findBox, fragmentSamples, trackTimescales, trexDefaults } from "../../containers/mp4-box/index.js";
package/dist/index.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  * name for both, so the ESM import and the CDN global read the same.
6
6
  */
7
7
  import type { MatteboxBase, MatteboxOptions } from './types/facade.js';
8
- export { isAudioDescription, isEnhancedSpeech, isOriginal, isSdh, } from './kernel/characteristics.js';
8
+ export { isAudioDescription, isEnhancedSpeech, isOriginal, isSdh, videoKind, } from './kernel/characteristics.js';
9
9
  export { createReducer, initialState, resolveConfig } from './kernel/reducer.js';
10
10
  export { canSwitchTo } from './kernel/rendition-select.js';
11
11
  export { exportTrace, replay } from './kernel/trace.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAuBH,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAMvE,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,UAAU,EACV,KAAK,GACN,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEjF,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAExD,mBAAmB,kBAAkB,CAAC;AACtC,mBAAmB,mBAAmB,CAAC;AACvC,mBAAmB,eAAe,CAAC;AACnC,mBAAmB,mBAAmB,CAAC;AACvC,mBAAmB,qBAAqB,CAAC;AACzC,mBAAmB,qBAAqB,CAAC;AACzC,mBAAmB,oBAAoB,CAAC;AACxC,mBAAmB,iBAAiB,CAAC;AACrC,mBAAmB,kBAAkB,CAAC;AAEtC;;;;;;GAMG;AAEH,MAAM,WAAW,kBAAkB;CAAG;AAEtC;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,YAAY,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAkBlE,wBAAgB,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,QAAQ,CA+c3D;yBA/ce,QAAQ;mBAqdH,gBAAgB,KAAG,QAAQ,GAAG,IAAI"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAuBH,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAMvE,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,UAAU,EACV,KAAK,EACL,SAAS,GACV,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEjF,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAExD,mBAAmB,kBAAkB,CAAC;AACtC,mBAAmB,mBAAmB,CAAC;AACvC,mBAAmB,eAAe,CAAC;AACnC,mBAAmB,mBAAmB,CAAC;AACvC,mBAAmB,qBAAqB,CAAC;AACzC,mBAAmB,qBAAqB,CAAC;AACzC,mBAAmB,oBAAoB,CAAC;AACxC,mBAAmB,iBAAiB,CAAC;AACrC,mBAAmB,kBAAkB,CAAC;AAEtC;;;;;;GAMG;AAEH,MAAM,WAAW,kBAAkB;CAAG;AAEtC;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,YAAY,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAkBlE,wBAAgB,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,QAAQ,CAgd3D;yBAhde,QAAQ;mBAsdH,gBAAgB,KAAG,QAAQ,GAAG,IAAI"}
package/dist/index.js CHANGED
@@ -19,7 +19,7 @@ import { createMseSink } from './kernel/sinks/mse-sink.js';
19
19
  import { createTrackRegistry } from './kernel/track-registry.js';
20
20
  import { createTransport } from './kernel/transport.js';
21
21
  // Track labels from the standard characteristic tags, for a player's menus.
22
- export { isAudioDescription, isEnhancedSpeech, isOriginal, isSdh, } from './kernel/characteristics.js';
22
+ export { isAudioDescription, isEnhancedSpeech, isOriginal, isSdh, videoKind, } from './kernel/characteristics.js';
23
23
  // Diagnosability is a project goal: the trace tooling is public API. A
24
24
  // production trace replays into a fresh reducer as a regression test.
25
25
  export { createReducer, initialState, resolveConfig } from './kernel/reducer.js';
@@ -73,6 +73,7 @@ export function mattebox(options) {
73
73
  const transport = createTransport({
74
74
  absorb: prepare,
75
75
  inflight: (token) => bus.getState().scheduling.inflight.get(token),
76
+ split: () => hooks.chunkSplitter ?? null,
76
77
  // A media Content-Type on the manifest response that no adapter parses
77
78
  // (an mp3, a progressive mp4) is refused before the body downloads.
78
79
  // Anything else, including octet-stream, downloads and is sniffed.