supervision 0.2.0-next.0 → 0.2.0-next.1

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 (172) hide show
  1. package/dist/constants/media-renderer.d.ts +3 -0
  2. package/dist/constants/media-renderer.d.ts.map +1 -1
  3. package/dist/index.d.ts +2 -5
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +1246 -1300
  6. package/dist/index.js.map +1 -1
  7. package/dist/mask-preparation.worker.js +109 -31
  8. package/dist/mask-preparation.worker.js.map +1 -1
  9. package/dist/media/media-source-state.d.ts.map +1 -1
  10. package/dist/media/video-engine-media-source.d.ts +17 -7
  11. package/dist/media/video-engine-media-source.d.ts.map +1 -1
  12. package/dist/media/video-engine-media-source.js +3 -0
  13. package/dist/media/video-engine-media-source.js.map +1 -0
  14. package/dist/playback/media-playback-controller.d.ts +7 -1
  15. package/dist/playback/media-playback-controller.d.ts.map +1 -1
  16. package/dist/render-preparation/mask-frame-artifact.d.ts +2 -0
  17. package/dist/render-preparation/mask-frame-artifact.d.ts.map +1 -1
  18. package/dist/render-preparation/mask-frame-compositor.d.ts +7 -0
  19. package/dist/render-preparation/mask-frame-compositor.d.ts.map +1 -1
  20. package/dist/render-preparation/mask-preparation-worker-protocol.d.ts +1 -0
  21. package/dist/render-preparation/mask-preparation-worker-protocol.d.ts.map +1 -1
  22. package/dist/render-preparation/prepared-render-window.d.ts +21 -2
  23. package/dist/render-preparation/prepared-render-window.d.ts.map +1 -1
  24. package/dist/renderers/injected-pixi.d.ts +38 -0
  25. package/dist/renderers/injected-pixi.d.ts.map +1 -0
  26. package/dist/renderers/media-renderer-core.d.ts +9 -0
  27. package/dist/renderers/media-renderer-core.d.ts.map +1 -1
  28. package/dist/renderers/media-renderer-scene.d.ts +16 -5
  29. package/dist/renderers/media-renderer-scene.d.ts.map +1 -1
  30. package/dist/renderers/media-renderer-state.d.ts +9 -0
  31. package/dist/renderers/media-renderer-state.d.ts.map +1 -1
  32. package/dist/renderers/media-renderer-transport.d.ts +16 -3
  33. package/dist/renderers/media-renderer-transport.d.ts.map +1 -1
  34. package/dist/renderers/pixi-focus-layer.d.ts +1 -0
  35. package/dist/renderers/pixi-focus-layer.d.ts.map +1 -1
  36. package/dist/renderers/pixi-frame-present.d.ts +1 -1
  37. package/dist/renderers/pixi-frame-present.d.ts.map +1 -1
  38. package/dist/renderers/pixi-id-mask-shader.d.ts +4 -33
  39. package/dist/renderers/pixi-id-mask-shader.d.ts.map +1 -1
  40. package/dist/renderers/pixi-interaction-presentation-layer.d.ts +0 -1
  41. package/dist/renderers/pixi-interaction-presentation-layer.d.ts.map +1 -1
  42. package/dist/renderers/pixi-mask-halo.d.ts +4 -33
  43. package/dist/renderers/pixi-mask-halo.d.ts.map +1 -1
  44. package/dist/renderers/pixi-mask-layer.d.ts +28 -29
  45. package/dist/renderers/pixi-mask-layer.d.ts.map +1 -1
  46. package/dist/renderers/pixi-media-scene.d.ts.map +1 -1
  47. package/dist/renderers/pixi-polygon-layer.d.ts +2 -0
  48. package/dist/renderers/pixi-polygon-layer.d.ts.map +1 -1
  49. package/dist/renderers/pixi-region-coverage-mask.d.ts +4 -33
  50. package/dist/renderers/pixi-region-coverage-mask.d.ts.map +1 -1
  51. package/dist/renderers/pixi-region-layer.d.ts +6 -31
  52. package/dist/renderers/pixi-region-layer.d.ts.map +1 -1
  53. package/dist/renderers/pixi-shader-lifecycle.d.ts +14 -0
  54. package/dist/renderers/pixi-shader-lifecycle.d.ts.map +1 -0
  55. package/dist/renderers/presented-frame-channel.d.ts +32 -1
  56. package/dist/renderers/presented-frame-channel.d.ts.map +1 -1
  57. package/dist/sessions/media-session-defaults.d.ts.map +1 -1
  58. package/dist/sessions/media-session-state.d.ts.map +1 -1
  59. package/dist/tracking.worker.js +19 -5
  60. package/dist/tracking.worker.js.map +1 -1
  61. package/dist/types/media-session.d.ts +20 -27
  62. package/dist/types/media-session.d.ts.map +1 -1
  63. package/dist/types/render-preparation.d.ts +70 -23
  64. package/dist/types/render-preparation.d.ts.map +1 -1
  65. package/dist/video-engine-media-source-CUXnOJOV.js +450 -0
  66. package/dist/video-engine-media-source-CUXnOJOV.js.map +1 -0
  67. package/dist/web-video-engine/analysis-session.d.ts +0 -1
  68. package/dist/web-video-engine/analysis.d.ts +0 -1
  69. package/dist/web-video-engine/analysis.js +195 -23
  70. package/dist/web-video-engine/cache-budget.d.ts +0 -1
  71. package/dist/web-video-engine/canvas-sink-scrub-cursor.d.ts +0 -1
  72. package/dist/web-video-engine/clock.d.ts +0 -1
  73. package/dist/web-video-engine/constants.d.ts +9 -1
  74. package/dist/web-video-engine/create-scrub-cursor.d.ts +6 -3
  75. package/dist/web-video-engine/decode-resolution.d.ts +0 -1
  76. package/dist/web-video-engine/decode-scheduler.d.ts +18 -3
  77. package/dist/web-video-engine/decode-session.d.ts +8 -1
  78. package/dist/web-video-engine/decode-source.d.ts +9 -1
  79. package/dist/web-video-engine/diagnostics-store.d.ts +0 -1
  80. package/dist/web-video-engine/diagnostics.d.ts +19 -19
  81. package/dist/web-video-engine/embedded-engine-worker.d.ts +0 -1
  82. package/dist/web-video-engine/engine-core.d.ts +22 -11
  83. package/dist/web-video-engine/engine.d.ts +3 -4
  84. package/dist/web-video-engine/engine.js +76 -37
  85. package/dist/web-video-engine/engine.worker.d.ts +0 -1
  86. package/dist/web-video-engine/engine.worker.js +5501 -3197
  87. package/dist/web-video-engine/frame-cache.d.ts +119 -12
  88. package/dist/web-video-engine/frame-extractor.d.ts +0 -1
  89. package/dist/web-video-engine/{frame-timeline-GINI8Gum.js → frame-timeline-DreEwsRY.js} +83 -27
  90. package/dist/web-video-engine/frame-timeline.d.ts +10 -1
  91. package/dist/web-video-engine/frame-walker.d.ts +0 -1
  92. package/dist/web-video-engine/index.d.ts +12 -2
  93. package/dist/web-video-engine/index.d.ts.map +1 -1
  94. package/dist/web-video-engine/index.js +2 -2
  95. package/dist/web-video-engine/key-packet.d.ts +0 -1
  96. package/dist/web-video-engine/keyframe-index.d.ts +0 -1
  97. package/dist/web-video-engine/mirror-store.d.ts +0 -1
  98. package/dist/web-video-engine/renderer.d.ts +0 -1
  99. package/dist/web-video-engine/rotation.d.ts +0 -1
  100. package/dist/web-video-engine/scrub-controller.d.ts +0 -1
  101. package/dist/web-video-engine/scrub-cursor.d.ts +12 -7
  102. package/dist/web-video-engine/scrub-trajectory.d.ts +0 -1
  103. package/dist/web-video-engine/source-residency.d.ts +35 -1
  104. package/dist/web-video-engine/trace-recorder.d.ts +0 -1
  105. package/dist/web-video-engine/types.d.ts +18 -22
  106. package/dist/web-video-engine/video-engine.d.ts +27 -16
  107. package/dist/web-video-engine/webgpu-renderer.d.ts +0 -1
  108. package/dist/web-video-engine/worker-bridge.d.ts +0 -1
  109. package/dist/web-video-engine/worker-dispatch.d.ts +0 -1
  110. package/dist/web-video-engine/worker-protocol.d.ts +29 -14
  111. package/node_modules/supervision-js-core/dist/detections/buffered-detection-timeline.d.ts.map +1 -1
  112. package/node_modules/supervision-js-core/dist/index.d.ts +2 -2
  113. package/node_modules/supervision-js-core/dist/index.d.ts.map +1 -1
  114. package/node_modules/supervision-js-core/dist/index.js +107 -29
  115. package/node_modules/supervision-js-core/dist/index.js.map +1 -1
  116. package/node_modules/supervision-js-core/dist/types/detection-timeline.d.ts +12 -0
  117. package/node_modules/supervision-js-core/dist/types/detection-timeline.d.ts.map +1 -1
  118. package/node_modules/supervision-js-core/dist/types/media-rendering.d.ts +28 -26
  119. package/node_modules/supervision-js-core/dist/types/media-rendering.d.ts.map +1 -1
  120. package/node_modules/supervision-js-core/dist/types/session-lifecycle.d.ts +16 -0
  121. package/node_modules/supervision-js-core/dist/types/session-lifecycle.d.ts.map +1 -1
  122. package/node_modules/supervision-js-core/dist/utils/detection-masks.d.ts.map +1 -1
  123. package/node_modules/supervision-js-core/dist/utils/id-mask-frame.d.ts +19 -0
  124. package/node_modules/supervision-js-core/dist/utils/id-mask-frame.d.ts.map +1 -1
  125. package/package.json +3 -3
  126. package/dist/media/media-condition-probe.d.ts +0 -51
  127. package/dist/media/media-condition-probe.d.ts.map +0 -1
  128. package/dist/media/media-conditions.d.ts +0 -28
  129. package/dist/media/media-conditions.d.ts.map +0 -1
  130. package/dist/types/media-conditions.d.ts +0 -149
  131. package/dist/types/media-conditions.d.ts.map +0 -1
  132. package/dist/web-video-engine/analysis-session.d.ts.map +0 -1
  133. package/dist/web-video-engine/analysis.d.ts.map +0 -1
  134. package/dist/web-video-engine/analysis.js.map +0 -1
  135. package/dist/web-video-engine/cache-budget.d.ts.map +0 -1
  136. package/dist/web-video-engine/canvas-sink-scrub-cursor.d.ts.map +0 -1
  137. package/dist/web-video-engine/clock.d.ts.map +0 -1
  138. package/dist/web-video-engine/constants.d.ts.map +0 -1
  139. package/dist/web-video-engine/create-scrub-cursor.d.ts.map +0 -1
  140. package/dist/web-video-engine/decode-resolution.d.ts.map +0 -1
  141. package/dist/web-video-engine/decode-scheduler.d.ts.map +0 -1
  142. package/dist/web-video-engine/decode-session.d.ts.map +0 -1
  143. package/dist/web-video-engine/decode-source.d.ts.map +0 -1
  144. package/dist/web-video-engine/diagnostics-store.d.ts.map +0 -1
  145. package/dist/web-video-engine/diagnostics.d.ts.map +0 -1
  146. package/dist/web-video-engine/embedded-engine-worker.d.ts.map +0 -1
  147. package/dist/web-video-engine/engine-core.d.ts.map +0 -1
  148. package/dist/web-video-engine/engine.d.ts.map +0 -1
  149. package/dist/web-video-engine/engine.js.map +0 -1
  150. package/dist/web-video-engine/engine.worker.d.ts.map +0 -1
  151. package/dist/web-video-engine/engine.worker.js.map +0 -1
  152. package/dist/web-video-engine/frame-cache.d.ts.map +0 -1
  153. package/dist/web-video-engine/frame-extractor.d.ts.map +0 -1
  154. package/dist/web-video-engine/frame-timeline-GINI8Gum.js.map +0 -1
  155. package/dist/web-video-engine/frame-timeline.d.ts.map +0 -1
  156. package/dist/web-video-engine/frame-walker.d.ts.map +0 -1
  157. package/dist/web-video-engine/key-packet.d.ts.map +0 -1
  158. package/dist/web-video-engine/keyframe-index.d.ts.map +0 -1
  159. package/dist/web-video-engine/mirror-store.d.ts.map +0 -1
  160. package/dist/web-video-engine/renderer.d.ts.map +0 -1
  161. package/dist/web-video-engine/rotation.d.ts.map +0 -1
  162. package/dist/web-video-engine/scrub-controller.d.ts.map +0 -1
  163. package/dist/web-video-engine/scrub-cursor.d.ts.map +0 -1
  164. package/dist/web-video-engine/scrub-trajectory.d.ts.map +0 -1
  165. package/dist/web-video-engine/source-residency.d.ts.map +0 -1
  166. package/dist/web-video-engine/trace-recorder.d.ts.map +0 -1
  167. package/dist/web-video-engine/types.d.ts.map +0 -1
  168. package/dist/web-video-engine/video-engine.d.ts.map +0 -1
  169. package/dist/web-video-engine/webgpu-renderer.d.ts.map +0 -1
  170. package/dist/web-video-engine/worker-bridge.d.ts.map +0 -1
  171. package/dist/web-video-engine/worker-dispatch.d.ts.map +0 -1
  172. package/dist/web-video-engine/worker-protocol.d.ts.map +0 -1
@@ -563,8 +563,8 @@ function startWaitBound(timeoutMs) {
563
563
  return { cancel: () => clearTimeout(handle), expired };
564
564
  }
565
565
 
566
- const DEFAULT_BUFFER_AHEAD_SECONDS = 5;
567
- const DEFAULT_BUFFER_BEHIND_SECONDS = 0.5;
566
+ const DEFAULT_BUFFER_AHEAD_SECONDS = 10;
567
+ const DEFAULT_BUFFER_BEHIND_SECONDS = 5;
568
568
  /**
569
569
  * Share of the ahead window that must still lead the playhead when the next
570
570
  * window is fetched.
@@ -773,6 +773,32 @@ function createBufferedDetectionTimeline(options) {
773
773
  comparableMediaTime >= state.bufferStartTime &&
774
774
  comparableMediaTime <= state.bufferEndTime);
775
775
  };
776
+ const inFlightCovers = (mediaTime) => {
777
+ if (!inFlight) {
778
+ return true;
779
+ }
780
+ const comparableMediaTime = getComparableMediaTime(mediaTime);
781
+ return (comparableMediaTime >= inFlight.startTime &&
782
+ comparableMediaTime <= inFlight.endTime);
783
+ };
784
+ const supersedeLoadOutside = (mediaTime) => {
785
+ if (!inFlight || inFlightCovers(mediaTime)) {
786
+ return;
787
+ }
788
+ const keepsCurrentBuffer = isBuffered(mediaTime);
789
+ loadId += 1;
790
+ inFlight = undefined;
791
+ if (keepsCurrentBuffer) {
792
+ state = {
793
+ ...state,
794
+ errorMessage: null,
795
+ requestedEndTime: state.bufferEndTime,
796
+ requestedStartTime: state.bufferStartTime,
797
+ status: DetectionBufferStatus.Ready,
798
+ };
799
+ notifyBufferChanged();
800
+ }
801
+ };
776
802
  const isInsideBufferedRange = (mediaTime) => {
777
803
  const comparableMediaTime = getComparableMediaTime(mediaTime);
778
804
  return (bufferedVersionRange !== null &&
@@ -783,6 +809,11 @@ function createBufferedDetectionTimeline(options) {
783
809
  };
784
810
  const refreshBuffer = async (mediaTime, lead = "full") => {
785
811
  if (isBuffered(mediaTime)) {
812
+ // A backwards navigation may land in the retained buffer while a rolling
813
+ // prefetch for the old playhead is about to replace it. The navigation
814
+ // is current truth; do not let that older load evict its detections after
815
+ // the frame has been accepted.
816
+ supersedeLoadOutside(mediaTime);
786
817
  return;
787
818
  }
788
819
  if (isInsideBufferedRange(mediaTime) &&
@@ -842,6 +873,11 @@ function createBufferedDetectionTimeline(options) {
842
873
  await refreshBuffer(mediaTime);
843
874
  anchorWindowToPlayhead(mediaTime);
844
875
  },
876
+ needsBufferPrepare(mediaTime) {
877
+ return (!destroyed &&
878
+ isLoadingEnabled() &&
879
+ (!isBuffered(mediaTime) || !inFlightCovers(mediaTime)));
880
+ },
845
881
  needsPlaybackGateWait(mediaTime, prepareOptions) {
846
882
  if (destroyed ||
847
883
  !isLoadingEnabled() ||
@@ -859,6 +895,7 @@ function createBufferedDetectionTimeline(options) {
859
895
  return;
860
896
  }
861
897
  anchorWindowToPlayhead(mediaTime);
898
+ supersedeLoadOutside(mediaTime);
862
899
  if (!shouldPrefetch(mediaTime)) {
863
900
  return;
864
901
  }
@@ -4033,9 +4070,16 @@ function computeMaskBounds(data, width, height) {
4033
4070
  };
4034
4071
  }
4035
4072
  function computeDetectionMaskRect(mask) {
4036
- const decoded = decodeCompressedRleMask(mask);
4037
- const bounds = computeMaskBounds(decoded.data, decoded.width, decoded.height);
4038
- return bounds ?? undefined;
4073
+ const { bounds } = readCompressedRleMask(mask);
4074
+ if (!bounds) {
4075
+ return undefined;
4076
+ }
4077
+ return {
4078
+ height: bounds.height,
4079
+ width: bounds.width,
4080
+ x: bounds.left + bounds.width / 2,
4081
+ y: bounds.top + bounds.height / 2,
4082
+ };
4039
4083
  }
4040
4084
  function detectMaskBorders(data, width, height) {
4041
4085
  assertMaskDimensions(data, width, height);
@@ -4097,13 +4141,8 @@ function extractMaskRectRuns(data, width, height) {
4097
4141
  * the pass are that box.
4098
4142
  */
4099
4143
  function extractDetectionMaskRectRuns(mask) {
4100
- if (mask.encoding !== DetectionMaskEncoding.CompressedRle) {
4101
- throw new Error(`Unsupported detection mask encoding: ${mask.encoding}`);
4102
- }
4103
4144
  const { height, width } = mask;
4104
- assertMaskSize(width, height);
4105
- const counts = decodeCompressedRleCounts(mask.counts);
4106
- const bounds = computeCompressedRleBounds(counts, width, height);
4145
+ const { bounds, counts } = readCompressedRleMask(mask);
4107
4146
  if (!bounds) {
4108
4147
  return undefined;
4109
4148
  }
@@ -4135,6 +4174,17 @@ function extractDetectionMaskRectRuns(mask) {
4135
4174
  const rects = mergeRowSpansIntoRects(boundsBuffer, boundsWidth, boundsHeight, left, top);
4136
4175
  return rects.length > 0 ? rects : undefined;
4137
4176
  }
4177
+ function readCompressedRleMask(mask) {
4178
+ if (mask.encoding !== DetectionMaskEncoding.CompressedRle) {
4179
+ throw new Error(`Unsupported detection mask encoding: ${mask.encoding}`);
4180
+ }
4181
+ assertMaskSize(mask.width, mask.height);
4182
+ const counts = decodeCompressedRleCounts(mask.counts);
4183
+ return {
4184
+ bounds: computeCompressedRleBounds(counts, mask.width, mask.height),
4185
+ counts,
4186
+ };
4187
+ }
4138
4188
  /** Counts alternate background, foreground, starting on background. */
4139
4189
  function isForegroundRun(index) {
4140
4190
  return index % 2 === 1;
@@ -7433,7 +7483,6 @@ function createIdMaskFrame(instructions, options = {}) {
7433
7483
  const height = width === maskWidth
7434
7484
  ? maskHeight
7435
7485
  : Math.max(1, Math.round((width * maskHeight) / maskWidth));
7436
- const strokeScale = width / maskWidth;
7437
7486
  const scaledAxes = width === maskWidth
7438
7487
  ? undefined
7439
7488
  : createScaledMaskAxes({ height, maskHeight, maskWidth, width });
@@ -7444,18 +7493,17 @@ function createIdMaskFrame(instructions, options = {}) {
7444
7493
  let hasStroke = false;
7445
7494
  let maxStrokeWidth = 0;
7446
7495
  for (const instruction of instructions) {
7447
- const detectionMaskId = instruction.detectionIndex + 1;
7448
- if (detectionMaskId <= 0 ||
7449
- detectionMaskId >= MAX_ID_MASK_PALETTE_ENTRIES) {
7496
+ const detectionMaskId = resolveIdMaskPaletteId(instruction.detectionIndex);
7497
+ if (detectionMaskId === undefined) {
7450
7498
  return undefined;
7451
7499
  }
7452
- writePaletteEntry(fillPalette, detectionMaskId, instruction.color, instruction.alpha);
7500
+ writeIdMaskPaletteEntry(fillPalette, detectionMaskId, instruction.color, instruction.alpha);
7453
7501
  if (instruction.stroke && instruction.stroke.width > 0) {
7454
- const strokeWidth = Math.min(resolveStrokeTexels(instruction.stroke.width, strokeScale), MAX_ID_MASK_STROKE_WIDTH);
7502
+ const strokeWidth = resolveIdMaskStrokeTexels(instruction.stroke.width, maskWidth, width);
7455
7503
  hasStroke = true;
7456
7504
  strokeWidths[detectionMaskId] = strokeWidth;
7457
7505
  maxStrokeWidth = Math.max(maxStrokeWidth, strokeWidth);
7458
- writePaletteEntry(strokePalette, detectionMaskId, instruction.stroke.color, instruction.stroke.alpha);
7506
+ writeIdMaskPaletteEntry(strokePalette, detectionMaskId, instruction.stroke.color, instruction.stroke.alpha);
7459
7507
  }
7460
7508
  if (scaledAxes) {
7461
7509
  writeScaledMaskRuns(data, scaledAxes, instruction.mask, detectionMaskId);
@@ -7470,6 +7518,7 @@ function createIdMaskFrame(instructions, options = {}) {
7470
7518
  hasStroke,
7471
7519
  height,
7472
7520
  maxStrokeWidth,
7521
+ sourceWidth: maskWidth,
7473
7522
  strokePalette,
7474
7523
  strokeWidths,
7475
7524
  width,
@@ -7552,10 +7601,14 @@ function resolveRasterWidth(maskWidth, maxWidth) {
7552
7601
  * A stroke is measured in texels of the raster it is drawn on, so a coarser
7553
7602
  * raster measures it in coarser texels. A stroke of a texel or more keeps at
7554
7603
  * least one, the thinnest line the shader can draw; a narrower one keeps its
7555
- * own width, which the shader draws as an inner boundary at any scale.
7604
+ * own width, which the shader draws as an inner boundary at any scale. The
7605
+ * ceiling is the widest neighbourhood the shaders scan, so a wider stroke would
7606
+ * be drawn at the ceiling anyway and every layer drawing the same annotation
7607
+ * has to arrive at the same width.
7556
7608
  */
7557
- function resolveStrokeTexels(strokeWidth, scale) {
7558
- return Math.max(strokeWidth * scale, Math.min(strokeWidth, 1));
7609
+ function resolveIdMaskStrokeTexels(strokeWidth, maskWidth, rasterWidth) {
7610
+ const scale = maskWidth > 0 ? rasterWidth / maskWidth : 1;
7611
+ return Math.min(Math.max(strokeWidth * scale, Math.min(strokeWidth, 1)), MAX_ID_MASK_STROKE_WIDTH);
7559
7612
  }
7560
7613
  function createScaledMaskAxes(frame) {
7561
7614
  return {
@@ -7572,8 +7625,19 @@ function createMaskAxisMap(sourceLength, targetLength, stride) {
7572
7625
  }
7573
7626
  return map;
7574
7627
  }
7575
- function writePaletteEntry(palette, id, color, alpha) {
7576
- const offset = id * 4;
7628
+ /**
7629
+ * The palette slot a detection index names, or undefined when the palette has
7630
+ * no slot for it. Slot zero is the background, so the ids start at one and the
7631
+ * last detection the palette can name sits one index below the last slot.
7632
+ */
7633
+ function resolveIdMaskPaletteId(detectionIndex) {
7634
+ const detectionMaskId = detectionIndex + 1;
7635
+ return detectionMaskId > 0 && detectionMaskId < MAX_ID_MASK_PALETTE_ENTRIES
7636
+ ? detectionMaskId
7637
+ : undefined;
7638
+ }
7639
+ function writeIdMaskPaletteEntry(palette, detectionMaskId, color, alpha) {
7640
+ const offset = detectionMaskId * 4;
7577
7641
  palette[offset] = ((color >> 16) & 0xff) / 255;
7578
7642
  palette[offset + 1] = ((color >> 8) & 0xff) / 255;
7579
7643
  palette[offset + 2] = (color & 0xff) / 255;
@@ -7811,7 +7875,7 @@ var MediaRendererPlaybackState;
7811
7875
  */
7812
7876
  var MediaErrorKind;
7813
7877
  (function (MediaErrorKind) {
7814
- /** The media could not be opened or read at all. */
7878
+ /** The media could not be opened or read, or was refused before any read. */
7815
7879
  MediaErrorKind["Unreadable"] = "unreadable";
7816
7880
  /** The container or codec is not supported by this platform. */
7817
7881
  MediaErrorKind["UnsupportedFormat"] = "unsupportedFormat";
@@ -7845,8 +7909,8 @@ var MediaSourceStatus;
7845
7909
  * A source the renderer pulls samples from can be held between any two frames,
7846
7910
  * because the renderer decides when each one is drawn. A source that presents
7847
7911
  * its own frames owns the playhead, so holding it means stopping the producer
7848
- * and starting it again, which the detection gate does and the
7849
- * render-preparation gate does not.
7912
+ * and starting it again, and a gate that stops one has to bound its own wait
7913
+ * or a producer nothing answers for never runs again.
7850
7914
  */
7851
7915
  var PlaybackGateReach;
7852
7916
  (function (PlaybackGateReach) {
@@ -7857,8 +7921,6 @@ var PlaybackGateReach;
7857
7921
  * missing, until they arrive or the gate's own wait bound gives up on them.
7858
7922
  */
7859
7923
  PlaybackGateReach["EveryFrame"] = "everyFrame";
7860
- /** Playback waits to begin; frames after that are not held. */
7861
- PlaybackGateReach["StartOfPlayback"] = "startOfPlayback";
7862
7924
  })(PlaybackGateReach || (PlaybackGateReach = {}));
7863
7925
 
7864
7926
  /**
@@ -7912,7 +7974,23 @@ var MediaSessionActivityKind;
7912
7974
  MediaSessionActivityKind["Error"] = "error";
7913
7975
  MediaSessionActivityKind["MediaNormalizing"] = "mediaNormalizing";
7914
7976
  MediaSessionActivityKind["MediaOpening"] = "mediaOpening";
7977
+ /**
7978
+ * The picture is waiting on media the source has not handed over yet, which
7979
+ * is the bytes and their decode rather than anything downstream of them.
7980
+ * `PlaybackBuffering` is what a transport reports once it has already
7981
+ * stopped; this is reported from the read itself, including the reads a seek
7982
+ * makes while the transport still reads as paused.
7983
+ */
7984
+ MediaSessionActivityKind["MediaSourceReading"] = "mediaSourceReading";
7915
7985
  MediaSessionActivityKind["PlaybackBuffering"] = "playbackBuffering";
7986
+ /**
7987
+ * The render-preparation gate held the picture for artifacts that never
7988
+ * arrived and let it go. Nothing is blocked: the frames reaching the screen
7989
+ * are the ones whose artifacts were given up on. What is waited on is
7990
+ * preparation finishing another frame, which is what lets the gate hold the
7991
+ * picture again; `RenderPreparing` covers the holds that are running.
7992
+ */
7993
+ MediaSessionActivityKind["RenderPreparationAbandoned"] = "renderPreparationAbandoned";
7916
7994
  MediaSessionActivityKind["RenderPreparing"] = "renderPreparing";
7917
7995
  })(MediaSessionActivityKind || (MediaSessionActivityKind = {}));
7918
7996
  /**
@@ -7925,5 +8003,5 @@ var MediaSessionActivityStatus;
7925
8003
  MediaSessionActivityStatus["Waiting"] = "waiting";
7926
8004
  })(MediaSessionActivityStatus || (MediaSessionActivityStatus = {}));
7927
8005
 
7928
- export { AnnotationFrameMutationKind, AnnotationGeometryKind, AnnotationGestureStateKind, AnnotationHandleKind, BaseBoxCornerStyle, BaseBoxStyle, BaseFocusStyle, BaseInteractionStyle, BaseKeypointStyle, BaseLabelStyle, BaseMarkerStyle, BaseMaskStyle, BasePolygonStyle, BasePolylineStyle, BoxShape, StrokeAlignment as BoxStrokeAlignment, DEFAULT_DETECTION_CLASS_STYLES, DEFAULT_DETECTION_COLOR_SEQUENCE, DetectionBufferStatus, DetectionFrameRetentionMode, DetectionFrameSelectionMode, DetectionInteractionState, DetectionMaskEncoding, DetectionMaskPayloadFormat, DetectionPickTarget, FocusTargetMode, KeypointMarkerShape, KeypointVisibility, LabelPlacement, LabelVisibilityMode, MAX_ID_MASK_PALETTE_ENTRIES, MAX_ID_MASK_STROKE_WIDTH, MarkerShape, MarkerSizeSpace, MaskRenderMode, MediaErrorKind, MediaInteractionMode, MediaRendererFit, MediaRendererPlaybackState, MediaSessionActivityKind, MediaSessionActivityStatus, MediaSessionMode, MediaSessionStatus, MediaSourceStatus, PlaybackGateReach, RegionRendererComposeMode, RegionRendererCoverageKind, RegionRendererMediaEffectKind, RegionRendererRegionKind, RegionRendererSizeSpace, RegionRendererSourceKind, SUPERVISION_ROBOFLOW_COLOR, ShapeInstructionKind, StrokeAlignment, TrackingGeometry, annotationRendererKinds, annotationRenderers, applyAnnotationHandleDrag, canReuseMaskStyleArtifacts, centerRectToTopLeftRect, computeDetectionMaskRect, computeMaskBounds, containsPoint, convertDetectionBoxToMask, convertDetectionBoxToPolygon, convertDetectionMaskToBox, convertDetectionMaskToPolygon, convertDetectionPolygonToBox, convertDetectionPolygonToMask, copySortedDetectionFrames, createAnnotationEditingEngine, createArrayDetectionFrameSource, createBufferedDetectionTimeline, createByteTrackTracker, createCBIoUTracker, createColdDetectionFrameSource, createCompositeDetectionFrameSource, createDefaultAnnotationPresentation, createDetectionPickKey, createEditableAnnotationFrameSession, createIdMaskFrame, createIdleDetectionBufferState, createMemoryColdDetectionFrameStore, createOCSortTracker, createProjectedDetectionFrameSource, createSortTracker, createSourceAwarePresentation, createViewportController, createWritableDetectionFrameSource, decodeCompressedRleCounts, decodeCompressedRleMask, decodeDetectionMaskPayload, deleteAnnotationVertex, detectMaskBorders, detectionFrameOverlapsRange, detectionPostProcessors, distanceToSegment, encodeBinaryMask, encodeBinaryMaskWithBounds, encodeCompressedRleCounts, encodeDetectionMaskPayload, extractDetectionMaskRectRuns, extractMaskContour, extractMaskRectRuns, filterDetectionFramesForRange, findClosestAnnotationSegment, followDetectionPickAcrossFrames, getAnnotationHandles, getBufferedDetectionTimelineFrameSnapshot, getDetectionRect, getPointsRect, haveSameDetectionPickIdentities, includeDefined, isDeflatedBase64DetectionMaskPayload, lightenColor, mediaToScreen, mergeDetectionMasks, mergeDetectionPolygonsByClass, normalizeDetectionClassName, offsetDetection, pickAnnotationHandle, pickDetectionAtPoint, pickDetectionByMaskId, pointInPolygon, polygonArea, polygonToRect, projectDetectionFrame, projectDetectionFrameForTracking, projectDetectionFrames, rasterizePolygonToMask, rasterizeRectToMask, rebaseDetectionPickToFrame, rectArea, rectToPolygon, resolveAnnotationRendererPresentation, resolveAnnotationRendererStyleFields, resolveAnnotationStyleState, resolveContrastTextColor, resolveDetectionClassColorStyle, resolveEllipseSegmentCount, resolveMarkerGeometry, resolveMaskStyleOpacity, resolveStyleValue, sampleEllipseArc, screenToMedia, selectDetectionFrame, topLeftRectToCenterRect, validateDetectionFrames };
8006
+ export { AnnotationFrameMutationKind, AnnotationGeometryKind, AnnotationGestureStateKind, AnnotationHandleKind, BaseBoxCornerStyle, BaseBoxStyle, BaseFocusStyle, BaseInteractionStyle, BaseKeypointStyle, BaseLabelStyle, BaseMarkerStyle, BaseMaskStyle, BasePolygonStyle, BasePolylineStyle, BoxShape, StrokeAlignment as BoxStrokeAlignment, DEFAULT_DETECTION_CLASS_STYLES, DEFAULT_DETECTION_COLOR_SEQUENCE, DetectionBufferStatus, DetectionFrameRetentionMode, DetectionFrameSelectionMode, DetectionInteractionState, DetectionMaskEncoding, DetectionMaskPayloadFormat, DetectionPickTarget, FocusTargetMode, KeypointMarkerShape, KeypointVisibility, LabelPlacement, LabelVisibilityMode, MAX_ID_MASK_PALETTE_ENTRIES, MAX_ID_MASK_STROKE_WIDTH, MarkerShape, MarkerSizeSpace, MaskRenderMode, MediaErrorKind, MediaInteractionMode, MediaRendererFit, MediaRendererPlaybackState, MediaSessionActivityKind, MediaSessionActivityStatus, MediaSessionMode, MediaSessionStatus, MediaSourceStatus, PlaybackGateReach, RegionRendererComposeMode, RegionRendererCoverageKind, RegionRendererMediaEffectKind, RegionRendererRegionKind, RegionRendererSizeSpace, RegionRendererSourceKind, SUPERVISION_ROBOFLOW_COLOR, ShapeInstructionKind, StrokeAlignment, TrackingGeometry, annotationRendererKinds, annotationRenderers, applyAnnotationHandleDrag, canReuseMaskStyleArtifacts, centerRectToTopLeftRect, computeDetectionMaskRect, computeMaskBounds, containsPoint, convertDetectionBoxToMask, convertDetectionBoxToPolygon, convertDetectionMaskToBox, convertDetectionMaskToPolygon, convertDetectionPolygonToBox, convertDetectionPolygonToMask, copySortedDetectionFrames, createAnnotationEditingEngine, createArrayDetectionFrameSource, createBufferedDetectionTimeline, createByteTrackTracker, createCBIoUTracker, createColdDetectionFrameSource, createCompositeDetectionFrameSource, createDefaultAnnotationPresentation, createDetectionPickKey, createEditableAnnotationFrameSession, createIdMaskFrame, createIdleDetectionBufferState, createMemoryColdDetectionFrameStore, createOCSortTracker, createProjectedDetectionFrameSource, createSortTracker, createSourceAwarePresentation, createViewportController, createWritableDetectionFrameSource, decodeCompressedRleCounts, decodeCompressedRleMask, decodeDetectionMaskPayload, deleteAnnotationVertex, detectMaskBorders, detectionFrameOverlapsRange, detectionPostProcessors, distanceToSegment, encodeBinaryMask, encodeBinaryMaskWithBounds, encodeCompressedRleCounts, encodeDetectionMaskPayload, extractDetectionMaskRectRuns, extractMaskContour, extractMaskRectRuns, filterDetectionFramesForRange, findClosestAnnotationSegment, followDetectionPickAcrossFrames, getAnnotationHandles, getBufferedDetectionTimelineFrameSnapshot, getDetectionRect, getPointsRect, haveSameDetectionPickIdentities, includeDefined, isDeflatedBase64DetectionMaskPayload, lightenColor, mediaToScreen, mergeDetectionMasks, mergeDetectionPolygonsByClass, normalizeDetectionClassName, offsetDetection, pickAnnotationHandle, pickDetectionAtPoint, pickDetectionByMaskId, pointInPolygon, polygonArea, polygonToRect, projectDetectionFrame, projectDetectionFrameForTracking, projectDetectionFrames, rasterizePolygonToMask, rasterizeRectToMask, rebaseDetectionPickToFrame, rectArea, rectToPolygon, resolveAnnotationRendererPresentation, resolveAnnotationRendererStyleFields, resolveAnnotationStyleState, resolveContrastTextColor, resolveDetectionClassColorStyle, resolveEllipseSegmentCount, resolveIdMaskPaletteId, resolveIdMaskStrokeTexels, resolveMarkerGeometry, resolveMaskStyleOpacity, resolveStyleValue, sampleEllipseArc, screenToMedia, selectDetectionFrame, topLeftRectToCenterRect, validateDetectionFrames, writeIdMaskPaletteEntry };
7929
8007
  //# sourceMappingURL=index.js.map