mattebox 0.16.0 → 0.16.2

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 (198) hide show
  1. package/dist/cdn/mattebox.dash-drm.min.js +1 -1
  2. package/dist/cdn/mattebox.dash-ll.min.js +1 -1
  3. package/dist/cdn/mattebox.dash.min.js +1 -1
  4. package/dist/cdn/mattebox.dual-drm.min.js +1 -1
  5. package/dist/cdn/mattebox.dual-ll.min.js +1 -1
  6. package/dist/cdn/mattebox.dual-ts-drm.min.js +3 -3
  7. package/dist/cdn/mattebox.dual-ts.min.js +3 -3
  8. package/dist/cdn/mattebox.dual.min.js +1 -1
  9. package/dist/cdn/mattebox.hls-drm.min.js +2 -2
  10. package/dist/cdn/mattebox.hls-ll.min.js +1 -1
  11. package/dist/cdn/mattebox.hls-ts-drm.min.js +3 -3
  12. package/dist/cdn/mattebox.hls-ts.min.js +3 -3
  13. package/dist/cdn/mattebox.hls.min.js +1 -1
  14. package/dist/cdn/mattebox.kernel.min.js +1 -1
  15. package/dist/cdn/mattebox.min.js +3 -3
  16. package/dist/containers/fmp4/fit.d.ts +6 -0
  17. package/dist/containers/fmp4/fit.d.ts.map +1 -1
  18. package/dist/containers/fmp4/fit.js +49 -0
  19. package/dist/containers/fmp4/fit.js.map +1 -1
  20. package/dist/containers/fmp4/writer.d.ts +12 -0
  21. package/dist/containers/fmp4/writer.d.ts.map +1 -1
  22. package/dist/containers/fmp4/writer.js +33 -1
  23. package/dist/containers/fmp4/writer.js.map +1 -1
  24. package/dist/containers/ts-transmux/index.d.ts.map +1 -1
  25. package/dist/containers/ts-transmux/index.js +44 -2
  26. package/dist/containers/ts-transmux/index.js.map +1 -1
  27. package/dist/containers/ts-transmux/runner.d.ts +2 -2
  28. package/dist/containers/ts-transmux/runner.d.ts.map +1 -1
  29. package/dist/containers/ts-transmux/runner.js +13 -4
  30. package/dist/containers/ts-transmux/runner.js.map +1 -1
  31. package/dist/containers/ts-transmux/serve.d.ts +3 -1
  32. package/dist/containers/ts-transmux/serve.d.ts.map +1 -1
  33. package/dist/containers/ts-transmux/serve.js +4 -2
  34. package/dist/containers/ts-transmux/serve.js.map +1 -1
  35. package/dist/containers/ts-transmux/transmux.d.ts +29 -5
  36. package/dist/containers/ts-transmux/transmux.d.ts.map +1 -1
  37. package/dist/containers/ts-transmux/transmux.js +91 -29
  38. package/dist/containers/ts-transmux/transmux.js.map +1 -1
  39. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/asyncToGenerator.js +1 -2
  40. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/defineProperty.js +1 -2
  41. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/objectSpread2.js +1 -2
  42. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/objectWithoutProperties.js +1 -2
  43. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/objectWithoutPropertiesLoose.js +1 -2
  44. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/toPrimitive.js +1 -2
  45. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/toPropertyKey.js +1 -2
  46. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.155.0}/helpers/esm/typeof.js +1 -2
  47. package/dist/es2015/containers/adts.js +1 -2
  48. package/dist/es2015/containers/captions.js +1 -2
  49. package/dist/es2015/containers/codec-probe/index.js +1 -2
  50. package/dist/es2015/containers/emsg.js +1 -2
  51. package/dist/es2015/containers/fmp4/fit.js +52 -4
  52. package/dist/es2015/containers/fmp4/writer.js +32 -4
  53. package/dist/es2015/containers/id3.js +2 -3
  54. package/dist/es2015/containers/metadata.js +1 -2
  55. package/dist/es2015/containers/mp4-box/index.js +1 -2
  56. package/dist/es2015/containers/packed-audio/index.js +1 -2
  57. package/dist/es2015/containers/scte35.js +2 -3
  58. package/dist/es2015/containers/sei.js +1 -2
  59. package/dist/es2015/containers/ts-transmux/demux.js +1 -2
  60. package/dist/es2015/containers/ts-transmux/h264.js +2 -3
  61. package/dist/es2015/containers/ts-transmux/h265.js +2 -3
  62. package/dist/es2015/containers/ts-transmux/index.js +37 -6
  63. package/dist/es2015/containers/ts-transmux/runner.js +11 -9
  64. package/dist/es2015/containers/ts-transmux/serve.js +7 -6
  65. package/dist/es2015/containers/ts-transmux/sniff.js +0 -1
  66. package/dist/es2015/containers/ts-transmux/source.js +1 -2
  67. package/dist/es2015/containers/ts-transmux/transmux.js +92 -40
  68. package/dist/es2015/containers/ts-transmux/transmux.worker.js +1 -2
  69. package/dist/es2015/containers/webvtt.js +2 -3
  70. package/dist/es2015/containers/wvtt.js +2 -3
  71. package/dist/es2015/eme/index.js +3 -4
  72. package/dist/es2015/index.js +3 -4
  73. package/dist/es2015/kernel/append-queue.js +2 -3
  74. package/dist/es2015/kernel/base64.js +1 -2
  75. package/dist/es2015/kernel/bus.js +1 -2
  76. package/dist/es2015/kernel/characteristics.js +1 -2
  77. package/dist/es2015/kernel/context.js +1 -2
  78. package/dist/es2015/kernel/dry-run.js +2 -3
  79. package/dist/es2015/kernel/effects.js +1 -2
  80. package/dist/es2015/kernel/evictor.js +1 -2
  81. package/dist/es2015/kernel/lifecycle.js +1 -2
  82. package/dist/es2015/kernel/loader.js +1 -2
  83. package/dist/es2015/kernel/mime.js +1 -2
  84. package/dist/es2015/kernel/mse.js +2 -3
  85. package/dist/es2015/kernel/prepare.js +5 -6
  86. package/dist/es2015/kernel/presentation.js +1 -2
  87. package/dist/es2015/kernel/reducer.js +3 -4
  88. package/dist/es2015/kernel/refresh.js +2 -3
  89. package/dist/es2015/kernel/rendition-select.js +3 -4
  90. package/dist/es2015/kernel/scheduler.js +2 -3
  91. package/dist/es2015/kernel/sinks/caption-tracks.js +1 -2
  92. package/dist/es2015/kernel/sinks/metadata-sink.js +1 -2
  93. package/dist/es2015/kernel/sinks/mse-sink.js +1 -2
  94. package/dist/es2015/kernel/sinks/native-sync.js +1 -2
  95. package/dist/es2015/kernel/sinks/text-formats.js +1 -2
  96. package/dist/es2015/kernel/sinks/text-track-sink.js +1 -2
  97. package/dist/es2015/kernel/timeline.js +2 -3
  98. package/dist/es2015/kernel/trace.js +1 -2
  99. package/dist/es2015/kernel/track-registry.js +1 -2
  100. package/dist/es2015/kernel/transport.js +9 -9
  101. package/dist/es2015/kernel/url.js +1 -2
  102. package/dist/es2015/kernel/watchdog.js +1 -2
  103. package/dist/es2015/presets/dash/index.js +1 -2
  104. package/dist/es2015/presets/dash-drm/index.js +1 -2
  105. package/dist/es2015/presets/dash-ll/index.js +1 -2
  106. package/dist/es2015/presets/define.js +3 -4
  107. package/dist/es2015/presets/dual/index.js +1 -2
  108. package/dist/es2015/presets/dual-drm/index.js +1 -2
  109. package/dist/es2015/presets/dual-ll/index.js +1 -2
  110. package/dist/es2015/presets/dual-ts/index.js +1 -2
  111. package/dist/es2015/presets/dual-ts-drm/index.js +1 -2
  112. package/dist/es2015/presets/full/index.js +1 -2
  113. package/dist/es2015/presets/hls/index.js +1 -2
  114. package/dist/es2015/presets/hls-drm/index.js +1 -2
  115. package/dist/es2015/presets/hls-ll/index.js +1 -2
  116. package/dist/es2015/presets/hls-ts/index.js +1 -2
  117. package/dist/es2015/presets/hls-ts-drm/index.js +1 -2
  118. package/dist/es2015/presets/kernel/index.js +1 -2
  119. package/dist/es2015/presets/tiers.js +1 -2
  120. package/dist/es2015/protocols/adapter-shared.js +1 -2
  121. package/dist/es2015/protocols/dash-cmaf/index.js +4 -4
  122. package/dist/es2015/protocols/dash-cmaf/parse.js +2 -3
  123. package/dist/es2015/protocols/dash-cmaf/periods-runtime.js +2 -3
  124. package/dist/es2015/protocols/dash-cmaf/periods.js +2 -3
  125. package/dist/es2015/protocols/dash-live/index.js +5 -4
  126. package/dist/es2015/protocols/dash-ll/index.js +1 -2
  127. package/dist/es2015/protocols/dimensions.js +1 -2
  128. package/dist/es2015/protocols/hls-cmaf/index.js +6 -5
  129. package/dist/es2015/protocols/hls-cmaf/lexer.js +1 -2
  130. package/dist/es2015/protocols/hls-cmaf/parse.js +2 -3
  131. package/dist/es2015/protocols/hls-cmaf/unavailable.js +2 -3
  132. package/dist/es2015/protocols/hls-live/index.js +5 -5
  133. package/dist/es2015/protocols/hls-ll/index.js +1 -2
  134. package/dist/es2015/protocols/hls-ll/parse.js +2 -3
  135. package/dist/es2015/protocols/live-shared.js +1 -2
  136. package/dist/es2015/stages/abr/index.js +2 -3
  137. package/dist/es2015/stages/abr-cap-size/index.js +1 -2
  138. package/dist/es2015/stages/aes-128/index.js +2 -3
  139. package/dist/es2015/stages/alt-audio/index.js +1 -2
  140. package/dist/es2015/stages/chapters/index.js +3 -4
  141. package/dist/es2015/stages/chapters/parse.js +3 -4
  142. package/dist/es2015/stages/cmaf-timing/index.js +1 -2
  143. package/dist/es2015/stages/cmcd/index.js +1 -2
  144. package/dist/es2015/stages/cmsd/index.js +1 -2
  145. package/dist/es2015/stages/codec-probe/index.js +2 -3
  146. package/dist/es2015/stages/codec-switch/index.js +1 -2
  147. package/dist/es2015/stages/content-steering/index.js +2 -3
  148. package/dist/es2015/stages/drm-shared.js +1 -2
  149. package/dist/es2015/stages/eme-cenc/index.js +1 -2
  150. package/dist/es2015/stages/eme-core/index.js +16 -10
  151. package/dist/es2015/stages/eme-fairplay/index.js +2 -3
  152. package/dist/es2015/stages/forced-subtitles/index.js +1 -2
  153. package/dist/es2015/stages/hdr/index.js +2 -3
  154. package/dist/es2015/stages/live-catchup/index.js +1 -2
  155. package/dist/es2015/stages/meta-id3/index.js +1 -2
  156. package/dist/es2015/stages/mp4-box/index.js +1 -2
  157. package/dist/es2015/stages/nal-scan/index.js +1 -2
  158. package/dist/es2015/stages/pdt/index.js +1 -2
  159. package/dist/es2015/stages/qoe/index.js +2 -3
  160. package/dist/es2015/stages/recovery/index.js +2 -3
  161. package/dist/es2015/stages/rendition-names/index.js +2 -3
  162. package/dist/es2015/stages/text-cea608/decode.js +2 -3
  163. package/dist/es2015/stages/text-cea608/index.js +1 -2
  164. package/dist/es2015/stages/text-cea708/decode.js +3 -4
  165. package/dist/es2015/stages/text-cea708/index.js +2 -3
  166. package/dist/es2015/stages/text-ttml/images.js +1 -2
  167. package/dist/es2015/stages/text-ttml/index.js +2 -3
  168. package/dist/es2015/stages/text-ttml/parse.js +2 -3
  169. package/dist/es2015/stages/text-webvtt/index.js +1 -2
  170. package/dist/es2015/stages/text-webvtt-segmented/index.js +1 -2
  171. package/dist/es2015/stages/thumbnails/index.js +2 -3
  172. package/dist/es2015/stages/timed-metadata/index.js +2 -3
  173. package/dist/es2015/stages/trick-play/index.js +2 -3
  174. package/dist/kernel/prepare.d.ts.map +1 -1
  175. package/dist/kernel/prepare.js +1 -0
  176. package/dist/kernel/prepare.js.map +1 -1
  177. package/dist/kernel/transport.d.ts +3 -1
  178. package/dist/kernel/transport.d.ts.map +1 -1
  179. package/dist/kernel/transport.js +5 -1
  180. package/dist/kernel/transport.js.map +1 -1
  181. package/dist/protocols/dash-cmaf/index.d.ts.map +1 -1
  182. package/dist/protocols/dash-cmaf/index.js +3 -1
  183. package/dist/protocols/dash-cmaf/index.js.map +1 -1
  184. package/dist/protocols/dash-live/index.d.ts.map +1 -1
  185. package/dist/protocols/dash-live/index.js +3 -1
  186. package/dist/protocols/dash-live/index.js.map +1 -1
  187. package/dist/protocols/hls-cmaf/index.d.ts.map +1 -1
  188. package/dist/protocols/hls-cmaf/index.js +4 -2
  189. package/dist/protocols/hls-cmaf/index.js.map +1 -1
  190. package/dist/protocols/hls-live/index.d.ts.map +1 -1
  191. package/dist/protocols/hls-live/index.js +4 -2
  192. package/dist/protocols/hls-live/index.js.map +1 -1
  193. package/dist/stages/eme-core/index.d.ts.map +1 -1
  194. package/dist/stages/eme-core/index.js +14 -3
  195. package/dist/stages/eme-core/index.js.map +1 -1
  196. package/dist/types/messages.d.ts +8 -0
  197. package/dist/types/messages.d.ts.map +1 -1
  198. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- //#region src/protocols/adapter-shared.ts
1
+ // src/protocols/adapter-shared.ts
2
2
  function manifestError(reason) {
3
3
  return {
4
4
  category: "manifest",
@@ -24,5 +24,4 @@ function manifestFact(bytes, url, claims, parse) {
24
24
  presentation: result.presentation
25
25
  };
26
26
  }
27
- //#endregion
28
27
  export { manifestError, manifestFact };
@@ -1,4 +1,4 @@
1
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/objectSpread2.js";
1
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/objectSpread2.js";
2
2
  import { scheduled, tickAfter } from "../../kernel/effects.js";
3
3
  import { normalizeMimeType } from "../../kernel/mime.js";
4
4
  import { findRendition } from "../../kernel/presentation.js";
@@ -7,7 +7,7 @@ import { activeRenditions } from "../../kernel/rendition-select.js";
7
7
  import { manifestFact } from "../adapter-shared.js";
8
8
  import { parse, sidxToSegments } from "./parse.js";
9
9
  import { installPeriods } from "./periods-runtime.js";
10
- //#region src/protocols/dash-cmaf/index.ts
10
+ // src/protocols/dash-cmaf/index.ts
11
11
  /**
12
12
  * The dash-cmaf protocol adapter as a stage. Inert module: exports a
13
13
  * factory, registers nothing at import time.
@@ -129,8 +129,9 @@ const createReduceDash = (retryMs, lowLatency = false) => (slice, msg, kernel) =
129
129
  if (msg.type === "UNLOAD" || msg.type === "DETACH") return [INITIAL, []];
130
130
  if (msg.type === "TICK" && msg.token.startsWith(RETRY_TOKEN)) return retry(state, msg.token.slice(11));
131
131
  if (msg.type === "SEGMENT_LOADED" && msg.trackId === "manifest" && state.manifestUrl !== null) {
132
+ var _msg$url;
132
133
  let warnings = [];
133
- const fact = manifestFact(msg.bytes, state.manifestUrl, (text) => claims(state, text), (text, url) => {
134
+ const fact = manifestFact(msg.bytes, (_msg$url = msg.url) !== null && _msg$url !== void 0 ? _msg$url : state.manifestUrl, (text) => claims(state, text), (text, url) => {
134
135
  var _result$warnings;
135
136
  const result = parse(text, url, lowLatency);
136
137
  if (result.presentation !== null) warnings = (_result$warnings = result.warnings) !== null && _result$warnings !== void 0 ? _result$warnings : [];
@@ -253,5 +254,4 @@ function dashCmaf(options = {}) {
253
254
  }
254
255
  };
255
256
  }
256
- //#endregion
257
257
  export { MANIFEST_TYPES, createReduceDash, dashCmaf as default, installDashPeriods };
@@ -1,11 +1,11 @@
1
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/objectSpread2.js";
1
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/objectSpread2.js";
2
2
  import { findBox, parseSidx } from "../../containers/mp4-box/index.js";
3
3
  import { base64ToBytes } from "../../kernel/base64.js";
4
4
  import { resolveUrl } from "../../kernel/url.js";
5
5
  import { manifestError } from "../adapter-shared.js";
6
6
  import { dimensions } from "../dimensions.js";
7
7
  import { flattenPeriods } from "./periods.js";
8
- //#region src/protocols/dash-cmaf/parse.ts
8
+ // src/protocols/dash-cmaf/parse.ts
9
9
  /**
10
10
  * MPD into the IR. Pure: no fetching, no state, no side effects. DOMParser
11
11
  * carries the XML work at zero bundle cost. URLs are resolved here, against
@@ -946,5 +946,4 @@ function sidxToSegments(sidxBytes, addressing) {
946
946
  }
947
947
  return segments;
948
948
  }
949
- //#endregion
950
949
  export { parse, parseDuration, sidxToSegments };
@@ -1,7 +1,7 @@
1
- import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/asyncToGenerator.js";
1
+ import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/asyncToGenerator.js";
2
2
  import { findRendition } from "../../kernel/presentation.js";
3
3
  import { segmentAt } from "../../kernel/timeline.js";
4
- //#region src/protocols/dash-cmaf/periods-runtime.ts
4
+ // src/protocols/dash-cmaf/periods-runtime.ts
5
5
  /**
6
6
  * What a flattened multi-period presentation needs at playback time, kept
7
7
  * in the dash-cmaf stage so the kernel stays unaware of periods:
@@ -130,5 +130,4 @@ function installPeriods(ctx, skips) {
130
130
  ]) element.removeEventListener(name, skipPast);
131
131
  };
132
132
  }
133
- //#endregion
134
133
  export { installPeriods };
@@ -1,6 +1,6 @@
1
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/objectSpread2.js";
1
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/objectSpread2.js";
2
2
  import { isIndexed, isUnresolved, segmentAt } from "../../kernel/timeline.js";
3
- //#region src/protocols/dash-cmaf/periods.ts
3
+ // src/protocols/dash-cmaf/periods.ts
4
4
  /**
5
5
  * Several DASH Periods as one continuous presentation, the way Shaka
6
6
  * Player combines periods. Each logical track keeps one id for the whole
@@ -174,5 +174,4 @@ function flattenPeriods(periods) {
174
174
  warnings
175
175
  };
176
176
  }
177
- //#endregion
178
177
  export { flattenPeriods };
@@ -1,8 +1,8 @@
1
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/objectSpread2.js";
1
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/objectSpread2.js";
2
2
  import { scheduled, tickAfter } from "../../kernel/effects.js";
3
3
  import { registerLiveNamespace } from "../live-shared.js";
4
4
  import { parse } from "../dash-cmaf/parse.js";
5
- //#region src/protocols/dash-live/index.ts
5
+ // src/protocols/dash-live/index.ts
6
6
  /**
7
7
  * DASH live: the edge is computed, never read. Wall clock enters only as
8
8
  * fields on facts, stamped at the transport and element boundaries; the
@@ -253,8 +253,10 @@ const createReduceDashLive = (lowLatency = false) => (slice, msg, kernel) => {
253
253
  }), []];
254
254
  }
255
255
  if (msg.type === "SEGMENT_LOADED" && msg.trackId === MPD_TOKEN) {
256
+ var _msg$url;
256
257
  if (state.manifestUrl === null) return [state, []];
257
- const result = parse(new TextDecoder().decode(msg.bytes), state.manifestUrl, lowLatency);
258
+ const base = (_msg$url = msg.url) !== null && _msg$url !== void 0 ? _msg$url : state.manifestUrl;
259
+ const result = parse(new TextDecoder().decode(msg.bytes), base, lowLatency);
258
260
  if (result.presentation === null) return reloadFailed(state, kernel.presentation, result.error.code);
259
261
  const effects = [];
260
262
  const hash = hashOf(msg.bytes);
@@ -299,5 +301,4 @@ function dashLive() {
299
301
  }
300
302
  };
301
303
  }
302
- //#endregion
303
304
  export { createReduceDashLive, dashLive as default };
@@ -2,7 +2,7 @@ import { completeChunks } from "../../containers/mp4-box/index.js";
2
2
  import { registerLiveNamespace } from "../live-shared.js";
3
3
  import { MANIFEST_TYPES, createReduceDash, installDashPeriods } from "../dash-cmaf/index.js";
4
4
  import { createReduceDashLive } from "../dash-live/index.js";
5
- //#region src/protocols/dash-ll/index.ts
5
+ // src/protocols/dash-ll/index.ts
6
6
  /**
7
7
  * Low-latency DASH (DASH-IF IOP low-latency modes, ISO/IEC 23009-1 Annex
8
8
  * K): dash-cmaf and dash-live in one stage, reading what a low-latency MPD
@@ -38,5 +38,4 @@ function dashLl(options = {}) {
38
38
  }
39
39
  };
40
40
  }
41
- //#endregion
42
41
  export { dashLl as default };
@@ -1,4 +1,4 @@
1
- //#region src/protocols/dimensions.ts
1
+ // src/protocols/dimensions.ts
2
2
  /**
3
3
  * The `AxB` pair both manifest families write for sizes and grids: HLS
4
4
  * RESOLUTION and LAYOUT (RFC 8216 §4.3.4.2, the Roku image-playlist tags),
@@ -11,5 +11,4 @@ function dimensions(value) {
11
11
  const b = Number(match === null || match === void 0 ? void 0 : match[2]);
12
12
  return a > 0 && b > 0 ? [a, b] : null;
13
13
  }
14
- //#endregion
15
14
  export { dimensions };
@@ -1,11 +1,11 @@
1
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/objectSpread2.js";
1
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/objectSpread2.js";
2
2
  import { scheduled, tickAfter } from "../../kernel/effects.js";
3
3
  import { normalizeMimeType } from "../../kernel/mime.js";
4
4
  import { activeRenditions } from "../../kernel/rendition-select.js";
5
5
  import { manifestFact } from "../adapter-shared.js";
6
6
  import { parse, parseMediaPlaylist, refreshFor } from "./parse.js";
7
7
  import { LOAD_FAILED, readmitMessage, unavailableMessages } from "./unavailable.js";
8
- //#region src/protocols/hls-cmaf/index.ts
8
+ // src/protocols/hls-cmaf/index.ts
9
9
  /**
10
10
  * The hls-cmaf protocol adapter as a stage. Inert module: exports a
11
11
  * factory, registers nothing at import time.
@@ -120,18 +120,20 @@ const createReduceHls = (retryMs, parseMedia = parseMediaPlaylist) => (slice, ms
120
120
  }), []];
121
121
  if (msg.type === "UNLOAD" || msg.type === "DETACH") return [INITIAL, []];
122
122
  if (msg.type === "SEGMENT_LOADED" && msg.trackId === "manifest" && state.manifestUrl !== null) {
123
- const fact = manifestFact(msg.bytes, state.manifestUrl, (text) => claims(state, text), (text, url) => parse(text, url, parseMedia));
123
+ var _msg$url;
124
+ const fact = manifestFact(msg.bytes, (_msg$url = msg.url) !== null && _msg$url !== void 0 ? _msg$url : state.manifestUrl, (text) => claims(state, text), (text, url) => parse(text, url, parseMedia));
124
125
  return [state, fact === null ? [] : [feed(fact)]];
125
126
  }
126
127
  if (msg.type === "TICK" && msg.token.startsWith(RETRY_TOKEN)) return retry(state, kernel, msg.token.slice(10));
127
128
  let next = state;
128
129
  const effects = [];
129
130
  if (msg.type === "SEGMENT_LOADED" && msg.trackId in state.pending) {
131
+ var _msg$url2;
130
132
  const url = state.pending[msg.trackId];
131
133
  const pending = _objectSpread2({}, state.pending);
132
134
  delete pending[msg.trackId];
133
135
  next = _objectSpread2(_objectSpread2({}, next), {}, { pending });
134
- const media = parseMedia(new TextDecoder().decode(msg.bytes), url);
136
+ const media = parseMedia(new TextDecoder().decode(msg.bytes), (_msg$url2 = msg.url) !== null && _msg$url2 !== void 0 ? _msg$url2 : url);
135
137
  const playlist = media.playlist;
136
138
  const error = playlist === null ? media.error : playlist.endlist && playlist.segments.length === 0 ? {
137
139
  category: "manifest",
@@ -201,5 +203,4 @@ function hlsCmaf(options = {}) {
201
203
  }
202
204
  };
203
205
  }
204
- //#endregion
205
206
  export { MANIFEST_TYPES, createReduceHls, hlsCmaf as default };
@@ -1,4 +1,4 @@
1
- //#region src/protocols/hls-cmaf/lexer.ts
1
+ // src/protocols/hls-cmaf/lexer.ts
2
2
  /** Tags with attribute lists; everything else keeps its raw value. */
3
3
  const ATTRIBUTE_TAGS = /* @__PURE__ */ new Set([
4
4
  "EXT-X-STREAM-INF",
@@ -78,5 +78,4 @@ function lex(text) {
78
78
  }
79
79
  return lines;
80
80
  }
81
- //#endregion
82
81
  export { lex, parseAttributeList };
@@ -1,10 +1,10 @@
1
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/objectSpread2.js";
1
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/objectSpread2.js";
2
2
  import { byteToHex } from "../../kernel/base64.js";
3
3
  import { resolveUrl } from "../../kernel/url.js";
4
4
  import { manifestError } from "../adapter-shared.js";
5
5
  import { dimensions } from "../dimensions.js";
6
6
  import { lex } from "./lexer.js";
7
- //#region src/protocols/hls-cmaf/parse.ts
7
+ // src/protocols/hls-cmaf/parse.ts
8
8
  /**
9
9
  * m3u8 into the IR. Pure: no fetching, no state, no side effects. URLs are
10
10
  * resolved here, against the playlist's own URL, and stored absolute;
@@ -781,5 +781,4 @@ function refreshFor(presentation, renditionId, playlist) {
781
781
  function shiftRange(range, shift) {
782
782
  return _objectSpread2(_objectSpread2(_objectSpread2({}, range), {}, { start: range.start + shift }, range.end !== void 0 ? { end: range.end + shift } : {}), range.plannedEnd !== void 0 ? { plannedEnd: range.plannedEnd + shift } : {});
783
783
  }
784
- //#endregion
785
784
  export { normalizeAvcCodec, parse, parseByteRange, parseMediaLines, parseMediaPlaylist, refreshFor };
@@ -1,7 +1,7 @@
1
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/objectSpread2.js";
1
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/objectSpread2.js";
2
2
  import { isTrick } from "../../kernel/presentation.js";
3
3
  import { withDeadGroups } from "../../kernel/rendition-select.js";
4
- //#region src/protocols/hls-cmaf/unavailable.ts
4
+ // src/protocols/hls-cmaf/unavailable.ts
5
5
  /**
6
6
  * What a playlist that cannot be used means for playback. Pure; shared by
7
7
  * hls-cmaf (a playlist that fails to load) and hls-live (a playlist that
@@ -71,5 +71,4 @@ function readmitMessage(kernel, source, ids) {
71
71
  constraint: { excludeIds: [...own] }
72
72
  };
73
73
  }
74
- //#endregion
75
74
  export { LOAD_FAILED, RELOAD_FAILED, readmitMessage, unavailableMessages };
@@ -1,11 +1,11 @@
1
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/objectSpread2.js";
1
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/objectSpread2.js";
2
2
  import { scheduled, tickAfter } from "../../kernel/effects.js";
3
3
  import { findRendition } from "../../kernel/presentation.js";
4
4
  import { activeRenditions } from "../../kernel/rendition-select.js";
5
5
  import { parseMediaPlaylist, refreshFor } from "../hls-cmaf/parse.js";
6
6
  import { RELOAD_FAILED, readmitMessage, unavailableMessages } from "../hls-cmaf/unavailable.js";
7
7
  import { registerLiveNamespace } from "../live-shared.js";
8
- //#region src/protocols/hls-live/index.ts
8
+ // src/protocols/hls-live/index.ts
9
9
  /**
10
10
  * HLS live: the edge is read, never computed. A slice reducer reloads the
11
11
  * active playlists on the TARGETDURATION cadence, reconciles the sliding
@@ -421,7 +421,7 @@ const createReduceHlsLive = (retryMs, ll) => (slice, msg, kernel) => {
421
421
  return reloadFailed(state, kernel, renditionId, msg.error, retryMs);
422
422
  }
423
423
  if (msg.type === "SEGMENT_LOADED") {
424
- var _site$rendition$segme, _site$rendition$dateR, _media$playlist$skipp, _findRendition4, _lastSegment$seq;
424
+ var _msg$url, _site$rendition$segme, _site$rendition$dateR, _media$playlist$skipp, _findRendition4, _lastSegment$seq;
425
425
  const renditionId = renditionOfToken(msg.trackId);
426
426
  if (renditionId === null || kernel.presentation === null) return [state, []];
427
427
  const isTarget = state.target !== null && renditionId === state.target.renditionId;
@@ -429,7 +429,8 @@ const createReduceHlsLive = (retryMs, ll) => (slice, msg, kernel) => {
429
429
  if (url === null) return [state, []];
430
430
  const text = new TextDecoder().decode(msg.bytes);
431
431
  const site = findRendition(kernel.presentation, renditionId);
432
- const media = ll === void 0 ? parseMediaPlaylist(text, url) : ll.parse(text, url, (_site$rendition$segme = site === null || site === void 0 ? void 0 : site.rendition.segments) !== null && _site$rendition$segme !== void 0 ? _site$rendition$segme : [], (_site$rendition$dateR = site === null || site === void 0 ? void 0 : site.rendition.dateRanges) !== null && _site$rendition$dateR !== void 0 ? _site$rendition$dateR : []);
432
+ const base = (_msg$url = msg.url) !== null && _msg$url !== void 0 ? _msg$url : url;
433
+ const media = ll === void 0 ? parseMediaPlaylist(text, base) : ll.parse(text, base, (_site$rendition$segme = site === null || site === void 0 ? void 0 : site.rendition.segments) !== null && _site$rendition$segme !== void 0 ? _site$rendition$segme : [], (_site$rendition$dateR = site === null || site === void 0 ? void 0 : site.rendition.dateRanges) !== null && _site$rendition$dateR !== void 0 ? _site$rendition$dateR : []);
433
434
  if (media.playlist === null) return reloadFailed(state, kernel, renditionId, media.error, retryMs);
434
435
  const chained = state.chained.filter((id) => id !== renditionId);
435
436
  if (ll !== void 0 && ((_media$playlist$skipp = media.playlist.skipped) !== null && _media$playlist$skipp !== void 0 ? _media$playlist$skipp : 0) > 0) {
@@ -507,5 +508,4 @@ function hlsLive(options = {}) {
507
508
  }
508
509
  };
509
510
  }
510
- //#endregion
511
511
  export { createReduceHlsLive, hlsLive as default };
@@ -2,7 +2,7 @@ import { MANIFEST_TYPES, createReduceHls } from "../hls-cmaf/index.js";
2
2
  import { registerLiveNamespace } from "../live-shared.js";
3
3
  import { createReduceHlsLive } from "../hls-live/index.js";
4
4
  import { nextReload, parseLowLatency, reportsOf } from "./parse.js";
5
- //#region src/protocols/hls-ll/index.ts
5
+ // src/protocols/hls-ll/index.ts
6
6
  /** The stage factory. It provides `hls-cmaf` and `hls-live`, so stages that require either compose with it. */
7
7
  function hlsLl(options = {}) {
8
8
  var _options$unavailableR;
@@ -26,5 +26,4 @@ function hlsLl(options = {}) {
26
26
  }
27
27
  };
28
28
  }
29
- //#endregion
30
29
  export { hlsLl as default };
@@ -1,9 +1,9 @@
1
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/objectSpread2.js";
1
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/objectSpread2.js";
2
2
  import { resolveUrl } from "../../kernel/url.js";
3
3
  import { manifestError } from "../adapter-shared.js";
4
4
  import { lex } from "../hls-cmaf/lexer.js";
5
5
  import { parseByteRange, parseMediaLines } from "../hls-cmaf/parse.js";
6
- //#region src/protocols/hls-ll/parse.ts
6
+ // src/protocols/hls-ll/parse.ts
7
7
  /**
8
8
  * Low-latency HLS media playlists (RFC 8216bis §4.4.3.7, §4.4.3.8,
9
9
  * §4.4.4.9, §4.4.5.2 to §4.4.5.4). The base parser reads the segments; this
@@ -236,5 +236,4 @@ function reportsOf(playlist) {
236
236
  var _reports;
237
237
  return (_reports = playlist.reports) !== null && _reports !== void 0 ? _reports : {};
238
238
  }
239
- //#endregion
240
239
  export { nextReload, parseLowLatency, reportsOf, withDirectives };
@@ -1,4 +1,4 @@
1
- //#region src/protocols/live-shared.ts
1
+ // src/protocols/live-shared.ts
2
2
  /** How far behind the edge still counts as at it, in seconds. */
3
3
  const AT_EDGE_SLACK = 2;
4
4
  function registerLiveNamespace(ctx) {
@@ -25,5 +25,4 @@ function registerLiveNamespace(ctx) {
25
25
  ctx.registerNamespace("live", api);
26
26
  } catch (_unused) {}
27
27
  }
28
- //#endregion
29
28
  export { registerLiveNamespace };
@@ -1,8 +1,8 @@
1
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/objectSpread2.js";
1
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/objectSpread2.js";
2
2
  import { scheduled } from "../../kernel/effects.js";
3
3
  import { findRendition, isTrick } from "../../kernel/presentation.js";
4
4
  import { canSwitchTo } from "../../kernel/rendition-select.js";
5
- //#region src/stages/abr/index.ts
5
+ // src/stages/abr/index.ts
6
6
  /**
7
7
  * Adaptive bitrate as a stage, not kernel. It registers one chooser
8
8
  * consulted at arbitration step 5 and one constraint source for
@@ -140,5 +140,4 @@ function abr(options) {
140
140
  }
141
141
  };
142
142
  }
143
- //#endregion
144
143
  export { abr as default };
@@ -1,4 +1,4 @@
1
- //#region src/stages/abr-cap-size/index.ts
1
+ // src/stages/abr-cap-size/index.ts
2
2
  function abrCapSize() {
3
3
  return {
4
4
  name: "abr-cap-size",
@@ -18,5 +18,4 @@ function abrCapSize() {
18
18
  }
19
19
  };
20
20
  }
21
- //#endregion
22
21
  export { abrCapSize as default };
@@ -1,6 +1,6 @@
1
- import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/asyncToGenerator.js";
1
+ import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/asyncToGenerator.js";
2
2
  import { findRendition } from "../../kernel/presentation.js";
3
- //#region src/stages/aes-128/index.ts
3
+ // src/stages/aes-128/index.ts
4
4
  /**
5
5
  * aes-128 as a stage: full-segment AES-CBC decryption for HLS EXT-X-KEY
6
6
  * METHOD=AES-128 (RFC 8216 §4.3.2.4). One transform step, ordered ahead of
@@ -79,5 +79,4 @@ function aes128() {
79
79
  }
80
80
  };
81
81
  }
82
- //#endregion
83
82
  export { aes128 as default, ivFor };
@@ -1,6 +1,6 @@
1
1
  import { scheduled } from "../../kernel/effects.js";
2
2
  import { groupOf } from "../../kernel/rendition-select.js";
3
- //#region src/stages/alt-audio/index.ts
3
+ // src/stages/alt-audio/index.ts
4
4
  /**
5
5
  * Alternate audio: a second media pipeline on sb:audio. The kernel already
6
6
  * schedules audio tracks generically, so this stage owns selection and
@@ -111,5 +111,4 @@ function altAudio() {
111
111
  }
112
112
  };
113
113
  }
114
- //#endregion
115
114
  export { altAudio as default };
@@ -1,8 +1,8 @@
1
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/objectSpread2.js";
2
- import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/asyncToGenerator.js";
1
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/objectSpread2.js";
2
+ import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/asyncToGenerator.js";
3
3
  import { findTrackSite } from "../../kernel/presentation.js";
4
4
  import { chaptersFromInput, parseAppleChapters, parseChapterTrack } from "./parse.js";
5
- //#region src/stages/chapters/index.ts
5
+ // src/stages/chapters/index.ts
6
6
  /**
7
7
  * Chapters: named spans of the presentation, answered through
8
8
  * `engine.chapters`. Two sources fill it:
@@ -166,5 +166,4 @@ function chapters() {
166
166
  }
167
167
  };
168
168
  }
169
- //#endregion
170
169
  export { chapters as default };
@@ -1,8 +1,8 @@
1
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/objectSpread2.js";
2
- import _objectWithoutProperties from "../../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/objectWithoutProperties.js";
1
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/objectSpread2.js";
2
+ import _objectWithoutProperties from "../../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/objectWithoutProperties.js";
3
3
  import { parseVtt } from "../../containers/webvtt.js";
4
4
  import { resolveUrl } from "../../kernel/url.js";
5
- //#region src/stages/chapters/parse.ts
5
+ // src/stages/chapters/parse.ts
6
6
  /**
7
7
  * Chapter files into one record shape. Pure. A WebVTT file serves two
8
8
  * sources: a chapters track, whose cue payload is the title, and the
@@ -172,5 +172,4 @@ function chaptersFromInput(inputs) {
172
172
  warnings
173
173
  };
174
174
  }
175
- //#endregion
176
175
  export { chaptersFromInput, orderChapters, parseAppleChapters, parseChapterTrack };
@@ -1,5 +1,5 @@
1
1
  import { earliestDecodeTime, findBox, trackTimescales } from "../../containers/mp4-box/index.js";
2
- //#region src/stages/cmaf-timing/index.ts
2
+ // src/stages/cmaf-timing/index.ts
3
3
  /**
4
4
  * cmaf-timing reads where a native fMP4 segment's media clock starts, so
5
5
  * the kernel can land the segment at the presentation time the manifest
@@ -36,5 +36,4 @@ function cmafTiming() {
36
36
  }
37
37
  };
38
38
  }
39
- //#endregion
40
39
  export { cmafTiming as default };
@@ -1,7 +1,7 @@
1
1
  import { findRendition } from "../../kernel/presentation.js";
2
2
  import { segmentAt } from "../../kernel/timeline.js";
3
3
  import { bytesToHex } from "../../kernel/base64.js";
4
- //#region src/stages/cmcd/index.ts
4
+ // src/stages/cmcd/index.ts
5
5
  /**
6
6
  * Common Media Client Data (CTA-5004). The engine already exposes the seam
7
7
  * this needs: a request hook that sees every outgoing segment and manifest
@@ -122,5 +122,4 @@ function bufferAhead(el) {
122
122
  for (let i = 0; i < buffered.length; i += 1) if (buffered.start(i) <= currentTime && currentTime <= buffered.end(i)) return buffered.end(i) - currentTime;
123
123
  return null;
124
124
  }
125
- //#endregion
126
125
  export { cmcd as default };
@@ -1,4 +1,4 @@
1
- //#region src/stages/cmsd/index.ts
1
+ // src/stages/cmsd/index.ts
2
2
  /** Splits on commas or semicolons outside double quotes. */
3
3
  function split(value, separator) {
4
4
  const parts = [];
@@ -68,5 +68,4 @@ function cmsd() {
68
68
  }
69
69
  };
70
70
  }
71
- //#endregion
72
71
  export { cmsdParams, cmsd as default };
@@ -1,7 +1,7 @@
1
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/objectSpread2.js";
1
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/objectSpread2.js";
2
2
  import { findRendition } from "../../kernel/presentation.js";
3
3
  import { codecMismatch, probeInitSegment } from "../../containers/codec-probe/index.js";
4
- //#region src/stages/codec-probe/index.ts
4
+ // src/stages/codec-probe/index.ts
5
5
  /**
6
6
  * codec-probe as a loadable stage. The derivation itself lives in the
7
7
  * container layer (probeInitSegment reads the stsd sample entries and rebuilds
@@ -86,5 +86,4 @@ function codecProbe() {
86
86
  }
87
87
  };
88
88
  }
89
- //#endregion
90
89
  export { codecProbe as default };
@@ -1,6 +1,6 @@
1
1
  import { typeString } from "../../kernel/mime.js";
2
2
  import { canSwitchTo } from "../../kernel/rendition-select.js";
3
- //#region src/stages/codec-switch/index.ts
3
+ // src/stages/codec-switch/index.ts
4
4
  /**
5
5
  * codec-switch: the real answer to entanglement #2's query. It registers a
6
6
  * switch policy the kernel injects into abr's telemetry; abr consumes it
@@ -40,5 +40,4 @@ function codecSwitch() {
40
40
  }
41
41
  };
42
42
  }
43
- //#endregion
44
43
  export { createPolicy, codecSwitch as default };
@@ -1,6 +1,6 @@
1
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/objectSpread2.js";
1
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/objectSpread2.js";
2
2
  import { scheduled, tickAfter } from "../../kernel/effects.js";
3
- //#region src/stages/content-steering/index.ts
3
+ // src/stages/content-steering/index.ts
4
4
  /**
5
5
  * Content steering: pathway switching from a steering manifest, plus
6
6
  * failover when the active pathway starts failing. The two manifest
@@ -199,5 +199,4 @@ function contentSteering() {
199
199
  }
200
200
  };
201
201
  }
202
- //#endregion
203
202
  export { contentSteering as default };
@@ -1,4 +1,4 @@
1
- //#region src/stages/drm-shared.ts
1
+ // src/stages/drm-shared.ts
2
2
  const handlers = /* @__PURE__ */ new Map();
3
3
  /** Registers a handler, keyed by its key system; a repeat replaces. */
4
4
  function registerKeySystem(handler) {
@@ -14,5 +14,4 @@ function normalizeSystemId(raw) {
14
14
  const match = /([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/i.exec(raw);
15
15
  return match !== null ? match[1].toLowerCase() : null;
16
16
  }
17
- //#endregion
18
17
  export { keySystemHandlers, normalizeSystemId, registerKeySystem };
@@ -1,6 +1,6 @@
1
1
  import { base64ToBytes } from "../../kernel/base64.js";
2
2
  import { registerKeySystem } from "../drm-shared.js";
3
- //#region src/stages/eme-cenc/index.ts
3
+ // src/stages/eme-cenc/index.ts
4
4
  /**
5
5
  * Widevine and PlayReady over Common Encryption. Neither drives EME
6
6
  * itself: each registers a key-system handler that eme-core negotiates and
@@ -48,5 +48,4 @@ function emeCenc() {
48
48
  }
49
49
  };
50
50
  }
51
- //#endregion
52
51
  export { emeCenc as default, unwrapPlayReadyResponse };
@@ -1,8 +1,8 @@
1
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/objectSpread2.js";
2
- import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/asyncToGenerator.js";
1
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/objectSpread2.js";
2
+ import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/asyncToGenerator.js";
3
3
  import { bytesToBase64 } from "../../kernel/base64.js";
4
4
  import { keySystemHandlers, normalizeSystemId } from "../drm-shared.js";
5
- //#region src/stages/eme-core/index.ts
5
+ // src/stages/eme-core/index.ts
6
6
  /**
7
7
  * The generic EME handshake, entanglement #3 resolved: DRM lands without
8
8
  * touching a protocol adapter. Init data arrives by two routes — the
@@ -197,14 +197,21 @@ function emeCore(options = {}) {
197
197
  });
198
198
  return _certificateFor.apply(this, arguments);
199
199
  }
200
+ let negotiation = null;
201
+ /** Chooses and initializes a key system, once: a later caller waits for the first. */
202
+ function ensureKeys(preferredSystemIds) {
203
+ var _negotiation;
204
+ if (mediaKeys !== null) return Promise.resolve(true);
205
+ (_negotiation = negotiation) !== null && _negotiation !== void 0 || (negotiation = negotiate(preferredSystemIds));
206
+ return negotiation;
207
+ }
200
208
  /** Chooses and initializes a key system for the given systemIds. */
201
- function ensureKeys(_x2) {
202
- return _ensureKeys.apply(this, arguments);
209
+ function negotiate(_x2) {
210
+ return _negotiate.apply(this, arguments);
203
211
  }
204
- function _ensureKeys() {
205
- _ensureKeys = _asyncToGenerator(function* (preferredSystemIds) {
212
+ function _negotiate() {
213
+ _negotiate = _asyncToGenerator(function* (preferredSystemIds) {
206
214
  var _options$preferredKey2;
207
- if (mediaKeys !== null) return true;
208
215
  const preferred = (_options$preferredKey2 = options.preferredKeySystems) !== null && _options$preferredKey2 !== void 0 ? _options$preferredKey2 : [];
209
216
  const rank = (h) => {
210
217
  const i = preferred.indexOf(h.keySystem);
@@ -231,7 +238,7 @@ function emeCore(options = {}) {
231
238
  fail("DRM_KEY_SYSTEM_UNAVAILABLE", false, lastError);
232
239
  return false;
233
240
  });
234
- return _ensureKeys.apply(this, arguments);
241
+ return _negotiate.apply(this, arguments);
235
242
  }
236
243
  /** Opens a session for one init data blob, deduped by key id. */
237
244
  function openSession(_x3, _x4) {
@@ -499,5 +506,4 @@ function emeCore(options = {}) {
499
506
  }
500
507
  };
501
508
  }
502
- //#endregion
503
509
  export { emeCore as default };
@@ -1,7 +1,7 @@
1
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/objectSpread2.js";
1
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.155.0/helpers/esm/objectSpread2.js";
2
2
  import { base64ToBytes, bytesToBase64 } from "../../kernel/base64.js";
3
3
  import { registerKeySystem } from "../drm-shared.js";
4
- //#region src/stages/eme-fairplay/index.ts
4
+ // src/stages/eme-fairplay/index.ts
5
5
  /**
6
6
  * FairPlay Streaming: the non-standard SPC/CKC flow. Safari only, and it
7
7
  * differs from CENC enough to warrant its own stage: the CDM message is an
@@ -61,5 +61,4 @@ function emeFairplay(options = {}) {
61
61
  }
62
62
  };
63
63
  }
64
- //#endregion
65
64
  export { buildSpcRequest, contentIdFromSkd, emeFairplay as default, parseCkcResponse };
@@ -1,4 +1,4 @@
1
- //#region src/stages/forced-subtitles/index.ts
1
+ // src/stages/forced-subtitles/index.ts
2
2
  function textTracks(state) {
3
3
  var _state$presentation$p, _state$presentation;
4
4
  return ((_state$presentation$p = (_state$presentation = state.presentation) === null || _state$presentation === void 0 ? void 0 : _state$presentation.periods) !== null && _state$presentation$p !== void 0 ? _state$presentation$p : []).flatMap((period) => period.tracks.filter((track) => track.contentType === "text"));
@@ -78,5 +78,4 @@ function forcedSubtitles(options = {}) {
78
78
  }
79
79
  };
80
80
  }
81
- //#endregion
82
81
  export { forcedSubtitles as default, pickForced };