mattebox 0.21.0 → 0.21.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 (114) 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-ll.min.js +3 -3
  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 -3
  7. package/dist/cdn/mattebox.dual-ts-drm.min.js +2 -2
  8. package/dist/cdn/mattebox.dual-ts.min.js +2 -2
  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 -3
  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 +5 -5
  17. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.159.0 → _@oxc-project_runtime@0.160.0}/helpers/esm/asyncToGenerator.js +1 -1
  18. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.159.0 → _@oxc-project_runtime@0.160.0}/helpers/esm/defineProperty.js +1 -1
  19. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.159.0 → _@oxc-project_runtime@0.160.0}/helpers/esm/objectSpread2.js +1 -1
  20. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.159.0 → _@oxc-project_runtime@0.160.0}/helpers/esm/objectWithoutProperties.js +1 -1
  21. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.159.0 → _@oxc-project_runtime@0.160.0}/helpers/esm/objectWithoutPropertiesLoose.js +1 -1
  22. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.159.0 → _@oxc-project_runtime@0.160.0}/helpers/esm/toPrimitive.js +1 -1
  23. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.159.0 → _@oxc-project_runtime@0.160.0}/helpers/esm/toPropertyKey.js +1 -1
  24. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.159.0 → _@oxc-project_runtime@0.160.0}/helpers/esm/typeof.js +1 -1
  25. package/dist/es2015/containers/fmp4/fit.js +1 -1
  26. package/dist/es2015/containers/id3.js +1 -1
  27. package/dist/es2015/containers/scte35.js +1 -1
  28. package/dist/es2015/containers/ts-transmux/h264.js +1 -1
  29. package/dist/es2015/containers/ts-transmux/h265.js +1 -1
  30. package/dist/es2015/containers/ts-transmux/index.js +1 -1
  31. package/dist/es2015/containers/ts-transmux/runner.js +2 -2
  32. package/dist/es2015/containers/ts-transmux/transmux.js +1 -1
  33. package/dist/es2015/containers/webm/index.js +1 -1
  34. package/dist/es2015/containers/webvtt.js +1 -1
  35. package/dist/es2015/containers/wvtt.js +1 -1
  36. package/dist/es2015/eme/index.js +3 -3
  37. package/dist/es2015/index.js +2 -2
  38. package/dist/es2015/kernel/append-queue.js +1 -1
  39. package/dist/es2015/kernel/bus.js +26 -6
  40. package/dist/es2015/kernel/context.js +1 -1
  41. package/dist/es2015/kernel/dry-run.js +1 -1
  42. package/dist/es2015/kernel/mse.js +5 -2
  43. package/dist/es2015/kernel/prepare.js +2 -2
  44. package/dist/es2015/kernel/reducer.js +163 -11
  45. package/dist/es2015/kernel/refresh.js +1 -1
  46. package/dist/es2015/kernel/rendition-select.js +2 -2
  47. package/dist/es2015/kernel/scheduler.js +1 -1
  48. package/dist/es2015/kernel/timeline.js +1 -1
  49. package/dist/es2015/kernel/trace.js +1 -1
  50. package/dist/es2015/kernel/transport.js +2 -2
  51. package/dist/es2015/presets/define.js +2 -2
  52. package/dist/es2015/protocols/dash-cmaf/index.js +1 -1
  53. package/dist/es2015/protocols/dash-cmaf/parse.js +1 -1
  54. package/dist/es2015/protocols/dash-cmaf/periods-runtime.js +1 -1
  55. package/dist/es2015/protocols/dash-cmaf/periods.js +1 -1
  56. package/dist/es2015/protocols/dash-live/index.js +1 -1
  57. package/dist/es2015/protocols/hls-cmaf/index.js +1 -1
  58. package/dist/es2015/protocols/hls-cmaf/parse.js +1 -1
  59. package/dist/es2015/protocols/hls-cmaf/unavailable.js +1 -1
  60. package/dist/es2015/protocols/hls-live/index.js +3 -2
  61. package/dist/es2015/protocols/hls-ll/parse.js +1 -1
  62. package/dist/es2015/stages/abr/index.js +1 -1
  63. package/dist/es2015/stages/aes-128/index.js +1 -1
  64. package/dist/es2015/stages/chapters/index.js +2 -2
  65. package/dist/es2015/stages/chapters/parse.js +2 -2
  66. package/dist/es2015/stages/codec-probe/index.js +1 -1
  67. package/dist/es2015/stages/content-steering/index.js +1 -1
  68. package/dist/es2015/stages/eme-core/index.js +2 -2
  69. package/dist/es2015/stages/eme-fairplay/index.js +1 -1
  70. package/dist/es2015/stages/hdr/index.js +1 -1
  71. package/dist/es2015/stages/interstitials/breaks.js +1 -1
  72. package/dist/es2015/stages/interstitials/index.js +2 -2
  73. package/dist/es2015/stages/live-catchup/index.js +21 -10
  74. package/dist/es2015/stages/qoe/index.js +29 -13
  75. package/dist/es2015/stages/recovery/index.js +1 -1
  76. package/dist/es2015/stages/rendition-names/index.js +1 -1
  77. package/dist/es2015/stages/text-cea608/decode.js +1 -1
  78. package/dist/es2015/stages/text-cea708/decode.js +2 -2
  79. package/dist/es2015/stages/text-cea708/index.js +1 -1
  80. package/dist/es2015/stages/text-ttml/index.js +1 -1
  81. package/dist/es2015/stages/text-ttml/parse.js +1 -1
  82. package/dist/es2015/stages/thumbnails/index.js +1 -1
  83. package/dist/es2015/stages/timed-metadata/index.js +1 -1
  84. package/dist/es2015/stages/transcript/index.js +2 -2
  85. package/dist/es2015/stages/trick-play/index.js +56 -5
  86. package/dist/index.d.ts.map +1 -1
  87. package/dist/index.js +3 -1
  88. package/dist/index.js.map +1 -1
  89. package/dist/kernel/bus.d.ts.map +1 -1
  90. package/dist/kernel/bus.js +26 -7
  91. package/dist/kernel/bus.js.map +1 -1
  92. package/dist/kernel/mse.d.ts.map +1 -1
  93. package/dist/kernel/mse.js +14 -3
  94. package/dist/kernel/mse.js.map +1 -1
  95. package/dist/kernel/reducer.d.ts.map +1 -1
  96. package/dist/kernel/reducer.js +178 -3
  97. package/dist/kernel/reducer.js.map +1 -1
  98. package/dist/protocols/hls-live/index.d.ts.map +1 -1
  99. package/dist/protocols/hls-live/index.js +11 -1
  100. package/dist/protocols/hls-live/index.js.map +1 -1
  101. package/dist/stages/live-catchup/index.d.ts.map +1 -1
  102. package/dist/stages/live-catchup/index.js +21 -11
  103. package/dist/stages/live-catchup/index.js.map +1 -1
  104. package/dist/stages/qoe/index.d.ts +0 -15
  105. package/dist/stages/qoe/index.d.ts.map +1 -1
  106. package/dist/stages/qoe/index.js +27 -15
  107. package/dist/stages/qoe/index.js.map +1 -1
  108. package/dist/stages/trick-play/index.d.ts +10 -5
  109. package/dist/stages/trick-play/index.d.ts.map +1 -1
  110. package/dist/stages/trick-play/index.js +55 -6
  111. package/dist/stages/trick-play/index.js.map +1 -1
  112. package/dist/types/kernel.d.ts +6 -0
  113. package/dist/types/kernel.d.ts.map +1 -1
  114. package/package.json +1 -1
@@ -6,7 +6,7 @@ import { isUnresolved } from "../../kernel/timeline.js";
6
6
  import { manifestFact } from "../adapter-shared.js";
7
7
  import { parse, sidxToSegments } from "./parse.js";
8
8
  import { installPeriods } from "./periods-runtime.js";
9
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectSpread2.js";
9
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.160.0/helpers/esm/objectSpread2.js";
10
10
  // src/protocols/dash-cmaf/index.ts
11
11
  /**
12
12
  * The dash-cmaf protocol adapter as a stage. Inert module: exports a
@@ -4,7 +4,7 @@ import { resolveUrl } from "../../kernel/url.js";
4
4
  import { manifestError } from "../adapter-shared.js";
5
5
  import { dimensions } from "../dimensions.js";
6
6
  import { flattenPeriods } from "./periods.js";
7
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectSpread2.js";
7
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.160.0/helpers/esm/objectSpread2.js";
8
8
  // src/protocols/dash-cmaf/parse.ts
9
9
  /**
10
10
  * MPD into the IR. Pure: no fetching, no state, no side effects. DOMParser
@@ -1,6 +1,6 @@
1
1
  import { findRendition } from "../../kernel/presentation.js";
2
2
  import { segmentAt } from "../../kernel/timeline.js";
3
- import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/asyncToGenerator.js";
3
+ import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.160.0/helpers/esm/asyncToGenerator.js";
4
4
  // src/protocols/dash-cmaf/periods-runtime.ts
5
5
  /**
6
6
  * What a flattened multi-period presentation needs at playback time, kept
@@ -1,5 +1,5 @@
1
1
  import { isIndexed, isUnresolved, segmentAt } from "../../kernel/timeline.js";
2
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectSpread2.js";
2
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.160.0/helpers/esm/objectSpread2.js";
3
3
  // src/protocols/dash-cmaf/periods.ts
4
4
  /**
5
5
  * Several DASH Periods as one continuous presentation, the way Shaka
@@ -1,7 +1,7 @@
1
1
  import { scheduled, tickAfter } from "../../kernel/effects.js";
2
2
  import { parse } from "../dash-cmaf/parse.js";
3
3
  import { registerLiveNamespace } from "../live-shared.js";
4
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectSpread2.js";
4
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.160.0/helpers/esm/objectSpread2.js";
5
5
  // src/protocols/dash-live/index.ts
6
6
  /**
7
7
  * DASH live: the edge is computed, never read. Wall clock enters only as
@@ -4,7 +4,7 @@ import { activeRenditions } from "../../kernel/rendition-select.js";
4
4
  import { manifestFact } from "../adapter-shared.js";
5
5
  import { parse, parseMediaPlaylist, refreshFor } from "./parse.js";
6
6
  import { LOAD_FAILED, readmitMessage, unavailableMessages } from "./unavailable.js";
7
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectSpread2.js";
7
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.160.0/helpers/esm/objectSpread2.js";
8
8
  // src/protocols/hls-cmaf/index.ts
9
9
  /**
10
10
  * The hls-cmaf protocol adapter as a stage. Inert module: exports a
@@ -3,7 +3,7 @@ import { resolveUrl } from "../../kernel/url.js";
3
3
  import { manifestError } from "../adapter-shared.js";
4
4
  import { dimensions } from "../dimensions.js";
5
5
  import { lex } from "./lexer.js";
6
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectSpread2.js";
6
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.160.0/helpers/esm/objectSpread2.js";
7
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
@@ -1,6 +1,6 @@
1
1
  import { isTrick } from "../../kernel/presentation.js";
2
2
  import { withDeadGroups } from "../../kernel/rendition-select.js";
3
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectSpread2.js";
3
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.160.0/helpers/esm/objectSpread2.js";
4
4
  // src/protocols/hls-cmaf/unavailable.ts
5
5
  /**
6
6
  * What a playlist that cannot be used means for playback. Pure; shared by
@@ -4,7 +4,7 @@ import { activeRenditions } from "../../kernel/rendition-select.js";
4
4
  import { parseMediaPlaylist, refreshFor } from "../hls-cmaf/parse.js";
5
5
  import { RELOAD_FAILED, readmitMessage, unavailableMessages } from "../hls-cmaf/unavailable.js";
6
6
  import { registerLiveNamespace } from "../live-shared.js";
7
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectSpread2.js";
7
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.160.0/helpers/esm/objectSpread2.js";
8
8
  // src/protocols/hls-live/index.ts
9
9
  /**
10
10
  * HLS live: the edge is read, never computed. A slice reducer reloads the
@@ -346,7 +346,8 @@ const createReduceHlsLive = (retryMs, ll) => (slice, msg, kernel) => {
346
346
  const switched = state.target !== null && target !== null && target.renditionId !== state.target.renditionId;
347
347
  let awaitingTarget = state.awaitingTarget;
348
348
  let inflight = state.inflight;
349
- if (switched && target !== null) {
349
+ const landed = msg.type === "PLAYLIST_REFRESHED" && target !== null && msg.renditionId === target.renditionId && inflight === null && !awaitingTarget;
350
+ if (switched && target !== null && !landed) {
350
351
  if (inflight !== target.renditionId) {
351
352
  effects.push(reload(_objectSpread2(_objectSpread2({}, target), {}, { url: reportFor(state.reports, target.url) })));
352
353
  inflight = target.renditionId;
@@ -2,7 +2,7 @@ import { resolveUrl } from "../../kernel/url.js";
2
2
  import { manifestError } from "../adapter-shared.js";
3
3
  import { lex } from "../hls-cmaf/lexer.js";
4
4
  import { parseByteRange, parseMediaLines } from "../hls-cmaf/parse.js";
5
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectSpread2.js";
5
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.160.0/helpers/esm/objectSpread2.js";
6
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,
@@ -1,7 +1,7 @@
1
1
  import { scheduled } from "../../kernel/effects.js";
2
2
  import { findRendition, isTrick } from "../../kernel/presentation.js";
3
3
  import { canSwitchTo } from "../../kernel/rendition-select.js";
4
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectSpread2.js";
4
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.160.0/helpers/esm/objectSpread2.js";
5
5
  // src/stages/abr/index.ts
6
6
  /**
7
7
  * Adaptive bitrate as a stage, not kernel. It registers one chooser
@@ -1,5 +1,5 @@
1
1
  import { findRendition } from "../../kernel/presentation.js";
2
- import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/asyncToGenerator.js";
2
+ import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.160.0/helpers/esm/asyncToGenerator.js";
3
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
@@ -1,7 +1,7 @@
1
1
  import { findTrackSite } from "../../kernel/presentation.js";
2
2
  import { chaptersFromInput, parseAppleChapters, parseChapterTrack } from "./parse.js";
3
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectSpread2.js";
4
- import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/asyncToGenerator.js";
3
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.160.0/helpers/esm/objectSpread2.js";
4
+ import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.160.0/helpers/esm/asyncToGenerator.js";
5
5
  // src/stages/chapters/index.ts
6
6
  /**
7
7
  * Chapters: named spans of the presentation, answered through
@@ -1,7 +1,7 @@
1
1
  import { parseVtt } from "../../containers/webvtt.js";
2
2
  import { resolveUrl } from "../../kernel/url.js";
3
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectSpread2.js";
4
- import _objectWithoutProperties from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectWithoutProperties.js";
3
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.160.0/helpers/esm/objectSpread2.js";
4
+ import _objectWithoutProperties from "../../_virtual/_@oxc-project_runtime@0.160.0/helpers/esm/objectWithoutProperties.js";
5
5
  // src/stages/chapters/parse.ts
6
6
  /**
7
7
  * Chapter files into one record shape. Pure. A WebVTT file serves two
@@ -1,6 +1,6 @@
1
1
  import { codecMismatch, probeInitSegment } from "../../containers/codec-probe/index.js";
2
2
  import { findRendition } from "../../kernel/presentation.js";
3
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectSpread2.js";
3
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.160.0/helpers/esm/objectSpread2.js";
4
4
  // src/stages/codec-probe/index.ts
5
5
  /**
6
6
  * codec-probe as a loadable stage. The derivation itself lives in the
@@ -1,5 +1,5 @@
1
1
  import { scheduled, tickAfter } from "../../kernel/effects.js";
2
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectSpread2.js";
2
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.160.0/helpers/esm/objectSpread2.js";
3
3
  // src/stages/content-steering/index.ts
4
4
  /**
5
5
  * Content steering: pathway switching from a steering manifest, plus
@@ -1,7 +1,7 @@
1
1
  import { bytesToBase64 } from "../../kernel/base64.js";
2
2
  import { keySystemHandlers, normalizeSystemId } from "../drm-shared.js";
3
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectSpread2.js";
4
- import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/asyncToGenerator.js";
3
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.160.0/helpers/esm/objectSpread2.js";
4
+ import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.160.0/helpers/esm/asyncToGenerator.js";
5
5
  // src/stages/eme-core/index.ts
6
6
  /**
7
7
  * The generic EME handshake, entanglement #3 resolved: DRM lands without
@@ -1,6 +1,6 @@
1
1
  import { base64ToBytes, bytesToBase64 } from "../../kernel/base64.js";
2
2
  import { registerKeySystem } from "../drm-shared.js";
3
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectSpread2.js";
3
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.160.0/helpers/esm/objectSpread2.js";
4
4
  // src/stages/eme-fairplay/index.ts
5
5
  /**
6
6
  * FairPlay Streaming: the non-standard SPC/CKC flow. Safari only, and it
@@ -1,4 +1,4 @@
1
- import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/asyncToGenerator.js";
1
+ import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.160.0/helpers/esm/asyncToGenerator.js";
2
2
  // src/stages/hdr/index.ts
3
3
  const SOURCE = "hdr";
4
4
  /** The display's answer, or null when the browser does not know `dynamic-range`. */
@@ -1,6 +1,6 @@
1
1
  import { scte35Summary } from "../../containers/scte35.js";
2
2
  import { resolveUrl } from "../../kernel/url.js";
3
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectSpread2.js";
3
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.160.0/helpers/esm/objectSpread2.js";
4
4
  // src/stages/interstitials/breaks.ts
5
5
  /**
6
6
  * Breaks from what the stream signals, as plain data. HLS interstitials
@@ -2,8 +2,8 @@ import { placeEmsg } from "../../containers/emsg.js";
2
2
  import { findBox, trackTimescales } from "../../containers/mp4-box/index.js";
3
3
  import { bytesToBase64 } from "../../kernel/base64.js";
4
4
  import { assetsOf, breaksOf, fromEvent } from "./breaks.js";
5
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectSpread2.js";
6
- import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/asyncToGenerator.js";
5
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.160.0/helpers/esm/objectSpread2.js";
6
+ import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.160.0/helpers/esm/asyncToGenerator.js";
7
7
  // src/stages/interstitials/index.ts
8
8
  /**
9
9
  * Plays breaks: HLS interstitials, DASH alternative MPD events, and the
@@ -36,6 +36,19 @@ function activated() {
36
36
  function clampRate(rate) {
37
37
  return Math.min(RATE_CEILING, Math.max(RATE_FLOOR, rate));
38
38
  }
39
+ const QUIET = [null, []];
40
+ const SOURCE = [null, [{
41
+ kind: "emit",
42
+ event: "catchup:source",
43
+ payload: {}
44
+ }]];
45
+ /**
46
+ * Says when the source goes or another comes, as `catchup:source`. It keeps
47
+ * no state: the reducer is where a stage sees a load and an unload. The
48
+ * message trace shows them too, but an engine with a trace listener builds
49
+ * an entry for every message.
50
+ */
51
+ const reduceCatchup = (_slice, msg) => msg.type === "LOAD" || msg.type === "UNLOAD" ? SOURCE : QUIET;
39
52
  function liveCatchup(options = {}) {
40
53
  return {
41
54
  name: "live-catchup",
@@ -176,15 +189,13 @@ function liveCatchup(options = {}) {
176
189
  element.addEventListener("play", onSettle);
177
190
  element.addEventListener("waiting", onWaiting);
178
191
  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
- }
192
+ ctx.reduce("live-catchup", reduceCatchup);
193
+ const offSource = ctx.on("catchup:source", () => {
194
+ release();
195
+ moved = null;
196
+ stalled = false;
197
+ started = false;
198
+ knownEnd = null;
188
199
  });
189
200
  ctx.registerNamespace("catchup", {
190
201
  get target() {
@@ -211,7 +222,7 @@ function liveCatchup(options = {}) {
211
222
  element.removeEventListener("play", onSettle);
212
223
  element.removeEventListener("waiting", onWaiting);
213
224
  element.removeEventListener("playing", onPlaying);
214
- offTrace();
225
+ offSource();
215
226
  release();
216
227
  };
217
228
  }
@@ -1,5 +1,26 @@
1
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectSpread2.js";
1
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.160.0/helpers/esm/objectSpread2.js";
2
2
  // src/stages/qoe/index.ts
3
+ const INITIAL = { rendition: null };
4
+ const NONE = [];
5
+ /**
6
+ * Reports a change from one rendition to another. The first selection of
7
+ * a load is no switch, and neither is the one after an unload: the kernel
8
+ * holds no rendition in between.
9
+ */
10
+ const reduceQoe = (slice, _msg, kernel) => {
11
+ const state = slice !== null && slice !== void 0 ? slice : INITIAL;
12
+ const active = kernel.quality.active;
13
+ if (active === state.rendition) return [state, NONE];
14
+ const switched = state.rendition !== null && active !== null;
15
+ return [{ rendition: active }, switched ? [{
16
+ kind: "emit",
17
+ event: "qoe:switch",
18
+ payload: {
19
+ from: state.rendition,
20
+ to: active
21
+ }
22
+ }] : NONE];
23
+ };
3
24
  function qoe() {
4
25
  return {
5
26
  name: "qoe",
@@ -14,7 +35,6 @@ function qoe() {
14
35
  let stallFrom = null;
15
36
  let stallTime = 0;
16
37
  let switches = 0;
17
- let rendition = null;
18
38
  const now = () => performance.now() / 1e3;
19
39
  const metrics = () => ({
20
40
  startupTime,
@@ -33,7 +53,6 @@ function qoe() {
33
53
  finished = 0;
34
54
  stallFrom = null;
35
55
  switches = 0;
36
- rendition = null;
37
56
  }
38
57
  function stall() {
39
58
  if (startupTime === null || stallFrom !== null || element.seeking || element.paused) return;
@@ -71,15 +90,11 @@ function qoe() {
71
90
  element.addEventListener("timeupdate", onTime);
72
91
  element.addEventListener("seeking", onSeeking);
73
92
  const offStalled = ctx.on("playback:stalled", stall);
74
- const offTrace = ctx.on("trace", (entry) => {
75
- if (entry.msg.type === "LOAD") reset();
76
- const active = ctx.getState().quality.active;
77
- if (active === rendition) return;
78
- if (rendition !== null && active !== null) {
79
- switches += 1;
80
- report("switch");
81
- }
82
- rendition = active;
93
+ const offLoading = ctx.on("lifecycle:loading", reset);
94
+ ctx.reduce("qoe", reduceQoe);
95
+ const offSwitch = ctx.on("qoe:switch", () => {
96
+ switches += 1;
97
+ report("switch");
83
98
  });
84
99
  ctx.registerNamespace("qoe", {
85
100
  get startupTime() {
@@ -102,7 +117,8 @@ function qoe() {
102
117
  element.removeEventListener("timeupdate", onTime);
103
118
  element.removeEventListener("seeking", onSeeking);
104
119
  offStalled();
105
- offTrace();
120
+ offLoading();
121
+ offSwitch();
106
122
  };
107
123
  }
108
124
  };
@@ -1,7 +1,7 @@
1
1
  import { scheduled, tickAfter } from "../../kernel/effects.js";
2
2
  import { findRendition, findTrackSite } from "../../kernel/presentation.js";
3
3
  import { segmentAt as segmentAt$1, segmentAtTime } from "../../kernel/timeline.js";
4
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectSpread2.js";
4
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.160.0/helpers/esm/objectSpread2.js";
5
5
  // src/stages/recovery/index.ts
6
6
  /**
7
7
  * Recovery as a stage: the kernel keeps its circuit breakers as the last
@@ -1,4 +1,4 @@
1
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectSpread2.js";
1
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.160.0/helpers/esm/objectSpread2.js";
2
2
  // 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.159.0/helpers/esm/defineProperty.js";
1
+ import _defineProperty from "../../_virtual/_@oxc-project_runtime@0.160.0/helpers/esm/defineProperty.js";
2
2
  // 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,6 +1,6 @@
1
1
  import { escapeCueText } from "../../containers/webvtt.js";
2
- import _defineProperty from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/defineProperty.js";
3
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectSpread2.js";
2
+ import _defineProperty from "../../_virtual/_@oxc-project_runtime@0.160.0/helpers/esm/defineProperty.js";
3
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.160.0/helpers/esm/objectSpread2.js";
4
4
  // src/stages/text-cea708/decode.ts
5
5
  /**
6
6
  * A CEA-708 caption decoder (CTA-708-E): DTVCC packets to cue text per
@@ -1,7 +1,7 @@
1
1
  import { registerCaptionConsumer } from "../../containers/captions.js";
2
2
  import { inbandCaptions, vttCue } from "../../kernel/sinks/caption-tracks.js";
3
3
  import { Dtvcc } from "./decode.js";
4
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectSpread2.js";
4
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.160.0/helpers/esm/objectSpread2.js";
5
5
  // src/stages/text-cea708/index.ts
6
6
  /**
7
7
  * CEA-708 in-band captions as a stage. It registers a caption consumer
@@ -4,7 +4,7 @@ import { joinTextSink } from "../../kernel/sinks/text-formats.js";
4
4
  import { segmentAt } from "../../kernel/timeline.js";
5
5
  import { showImages } from "./images.js";
6
6
  import { parseTtml } from "./parse.js";
7
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectSpread2.js";
7
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.160.0/helpers/esm/objectSpread2.js";
8
8
  // src/stages/text-ttml/index.ts
9
9
  /**
10
10
  * TTML subtitles as a stage, for the IMSC1 Text Profile and EBU-TT-D. It
@@ -1,5 +1,5 @@
1
1
  import { escapeCueText } from "../../containers/webvtt.js";
2
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectSpread2.js";
2
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.160.0/helpers/esm/objectSpread2.js";
3
3
  // src/stages/text-ttml/parse.ts
4
4
  /**
5
5
  * TTML to cues, for the IMSC1 Text Profile (W3C IMSC 1.0.1 to 1.2), which
@@ -2,7 +2,7 @@ import { parseVtt } from "../../containers/webvtt.js";
2
2
  import { scheduled } from "../../kernel/effects.js";
3
3
  import { isIndexed, segmentAt, segmentAtTime } from "../../kernel/timeline.js";
4
4
  import { resolveUrl } from "../../kernel/url.js";
5
- import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/asyncToGenerator.js";
5
+ import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.160.0/helpers/esm/asyncToGenerator.js";
6
6
  // src/stages/thumbnails/index.ts
7
7
  /**
8
8
  * Thumbnails: the trick-play images a scrubbing UI shows, answered through
@@ -5,7 +5,7 @@ import { findBox, trackTimescales } from "../../containers/mp4-box/index.js";
5
5
  import { scte35Summary } from "../../containers/scte35.js";
6
6
  import { bytesToHex } from "../../kernel/base64.js";
7
7
  import { adoptTextTrack, emptyTextTrack } from "../../kernel/sinks/text-track-sink.js";
8
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectSpread2.js";
8
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.160.0/helpers/esm/objectSpread2.js";
9
9
  // src/stages/timed-metadata/index.ts
10
10
  /**
11
11
  * Timed metadata from every source in one list, one API, and one native
@@ -1,7 +1,7 @@
1
1
  import { cueFormat } from "../../kernel/mime.js";
2
2
  import { isIndexed, isUnresolved, segmentAt, segmentAtTime } from "../../kernel/timeline.js";
3
- import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/asyncToGenerator.js";
4
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectSpread2.js";
3
+ import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.160.0/helpers/esm/asyncToGenerator.js";
4
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.160.0/helpers/esm/objectSpread2.js";
5
5
  // src/stages/transcript/index.ts
6
6
  /**
7
7
  * Transcript: the cues of a text track, read apart from playback. The
@@ -3,9 +3,11 @@ import { concat } from "../../containers/fmp4/writer.js";
3
3
  import { decoderConfigBox, findBox, fragmentSamples, trackTimescales, trexDefaults } from "../../containers/mp4-box/index.js";
4
4
  import { programTables } from "../../containers/ts-transmux/demux.js";
5
5
  import { findRendition, findTrackSite, isTrick } from "../../kernel/presentation.js";
6
+ import { sbIdFor } from "../../kernel/sinks/mse-sink.js";
6
7
  import { isUnresolved, segmentAtTime } from "../../kernel/timeline.js";
8
+ import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.160.0/helpers/esm/asyncToGenerator.js";
7
9
  import { looksLikeTransportStream } from "../../containers/ts-transmux/sniff.js";
8
- import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/asyncToGenerator.js";
10
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.160.0/helpers/esm/objectSpread2.js";
9
11
  // src/stages/trick-play/index.ts
10
12
  /**
11
13
  * Trick play: fast forward and rewind through the presentation's I-frame
@@ -26,6 +28,12 @@ import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.159.0/help
26
28
  * (fitFragment), because an I-frame lasts one frame period and the buffer
27
29
  * would otherwise hold islands a fast rate stalls in. Another gives a TS
28
30
  * I-frame range the program tables it starts past.
31
+ *
32
+ * The I-frame track is an accessory. When it fails while it shows (an
33
+ * append or the decoder refuses it, a range or its playlist does not
34
+ * load), the kernel returns to the normal stream and reports the error as
35
+ * not fatal. This stage then puts back what it changed, and `available`
36
+ * reads false until the source changes.
29
37
  */
30
38
  /** A scan is faster than this, in either direction; slower is playback speed. */
31
39
  const SCAN_THRESHOLD = 2;
@@ -58,6 +66,27 @@ function trickTrack(state) {
58
66
  return null;
59
67
  }
60
68
  /**
69
+ * True when the video buffer holds the audio too: the segments carry both.
70
+ * An I-frame track carries video alone, and a SourceBuffer refuses an init
71
+ * segment with fewer tracks than its first one (W3C Media Source
72
+ * Extensions, initialization segment received). The refusal ends the
73
+ * element with a decode error, so such a stream does not scan.
74
+ */
75
+ function muxed(state) {
76
+ var _state$buffers$get, _state$tracks$behindT, _findTrackSite;
77
+ if (((_state$buffers$get = state.buffers.get(sbIdFor("video"))) === null || _state$buffers$get === void 0 ? void 0 : _state$buffers$get.codecs.includes(",")) === true) return true;
78
+ const id = (_state$tracks$behindT = state.tracks.behindTrick) !== null && _state$tracks$behindT !== void 0 ? _state$tracks$behindT : state.tracks.active.get("video");
79
+ const track = id === void 0 ? void 0 : (_findTrackSite = findTrackSite(state.presentation, id)) === null || _findTrackSite === void 0 ? void 0 : _findTrackSite.track;
80
+ return (track === null || track === void 0 ? void 0 : track.renditions.some((r) => {
81
+ var _r$codecs;
82
+ return ((_r$codecs = r.codecs) === null || _r$codecs === void 0 ? void 0 : _r$codecs.includes(",")) === true;
83
+ })) === true;
84
+ }
85
+ /** The I-frame track, when the stream can scan with it and it has not failed. */
86
+ function usableTrack(state) {
87
+ return state.tracks.trickFailed === true || muxed(state) ? null : trickTrack(state);
88
+ }
89
+ /**
61
90
  * One key frame decoded with WebCodecs, or null when the browser cannot
62
91
  * configure the codec or produces no frame. The decoder lives for one frame.
63
92
  */
@@ -181,7 +210,7 @@ function trickPlay() {
181
210
  var _state$tracks$active$;
182
211
  if (saved !== null) return;
183
212
  const state = ctx.getState();
184
- const trick = trickTrack(state);
213
+ const trick = usableTrack(state);
185
214
  saved = {
186
215
  mainTrackId: (_state$tracks$active$ = state.tracks.active.get("video")) !== null && _state$tracks$active$ !== void 0 ? _state$tracks$active$ : null,
187
216
  bufferGoal: state.scheduling.bufferGoal,
@@ -251,6 +280,26 @@ function trickPlay() {
251
280
  return true;
252
281
  }
253
282
  let scrubbing = false;
283
+ /**
284
+ * The kernel left the I-frame track because it failed, and selected
285
+ * the normal stream again. A scan ends in the state it started from.
286
+ * A scrub goes on until scrubEnd as plain seeking, so the drag in
287
+ * progress still ends where the pointer is released.
288
+ */
289
+ const offSelected = ctx.on("tracks:selected", () => {
290
+ if (saved === null || ctx.getState().tracks.trickFailed !== true) return;
291
+ saved = _objectSpread2(_objectSpread2({}, saved), {}, { mainTrackId: null });
292
+ if (scrubbing) return;
293
+ stopTimer();
294
+ const was = rate;
295
+ rate = 1;
296
+ restore();
297
+ ctx.emit("trick:stopped", {
298
+ rate: was,
299
+ reason: "error"
300
+ });
301
+ ctx.emit("trick:rate", { rate: 1 });
302
+ });
254
303
  function clamp(time) {
255
304
  const ranges = element.seekable;
256
305
  if (ranges.length === 0) return Math.max(0, time);
@@ -300,8 +349,8 @@ function trickPlay() {
300
349
  for (const name of TAKEOVER) element.addEventListener(name, onTakeover);
301
350
  function scrubStart() {
302
351
  stale();
303
- if (trickTrack(ctx.getState()) === null) throw new Error("this presentation has no I-frame track to scrub with");
304
352
  if (scrubbing) return;
353
+ if (usableTrack(ctx.getState()) === null) throw new Error("this presentation has no I-frame track to scrub with");
305
354
  if (saved !== null) {
306
355
  stopTimer();
307
356
  ctx.emit("trick:stopped", {
@@ -460,7 +509,7 @@ function trickPlay() {
460
509
  }
461
510
  const api = {
462
511
  get available() {
463
- return trickTrack(ctx.getState()) !== null;
512
+ return usableTrack(ctx.getState()) !== null;
464
513
  },
465
514
  get rate() {
466
515
  stale();
@@ -480,13 +529,14 @@ function trickPlay() {
480
529
  frameAt,
481
530
  setRate(next) {
482
531
  stale();
532
+ if (scrubbing && ctx.getState().tracks.trickFailed === true) scrubEnd();
483
533
  scrubbing = false;
484
534
  if (next === 1) {
485
535
  if (rate !== 1) end("rate");
486
536
  return;
487
537
  }
488
538
  if (!(Math.abs(next) > SCAN_THRESHOLD) || !Number.isFinite(next)) throw new RangeError(`scan rate must be 1, above ${SCAN_THRESHOLD}, or below -${SCAN_THRESHOLD}, got ${next}; set the element's playbackRate for playback speed`);
489
- if (trickTrack(ctx.getState()) === null) throw new Error("this presentation has no I-frame track to scan with");
539
+ if (usableTrack(ctx.getState()) === null) throw new Error("this presentation has no I-frame track to scan with");
490
540
  const was = rate;
491
541
  begin();
492
542
  const restore = saved;
@@ -512,6 +562,7 @@ function trickPlay() {
512
562
  ctx.registerNamespace("trick", api);
513
563
  return () => {
514
564
  stopTimer();
565
+ offSelected();
515
566
  for (const bitmap of frames.values()) bitmap.close();
516
567
  frames.clear();
517
568
  element.removeEventListener("timeupdate", onTimeUpdate);
@@ -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,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,CAyd3D;yBAzde,QAAQ;mBA+dH,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,CA2d3D;yBA3de,QAAQ;mBAieH,gBAAgB,KAAG,QAAQ,GAAG,IAAI"}
package/dist/index.js CHANGED
@@ -264,7 +264,9 @@ export function mattebox(options) {
264
264
  // reload: a rebuilt pipeline restarts playback visibly, which is worse
265
265
  // than an honest error. In-place recovery (nudges, gap jumps, flushes,
266
266
  // skips, rendition exclusion) is the recovery stage's job and happens
267
- // before the decoder ever fails.
267
+ // before the decoder ever fails. One case goes on: an error while an
268
+ // I-frame track shows. The reducer then rebuilds the media source on the
269
+ // normal stream and reports the error as not fatal.
268
270
  const MEDIA_ERR = [
269
271
  '',
270
272
  'MEDIA_ERR_ABORTED',