supervision 0.1.7 → 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 (182) 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/detections/chunked-detection-frame-source.d.ts.map +1 -1
  4. package/dist/index.d.ts +8 -4
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +9281 -5038
  7. package/dist/index.js.map +1 -1
  8. package/dist/mask-preparation.worker.js +409 -185
  9. package/dist/mask-preparation.worker.js.map +1 -1
  10. package/dist/media/display-pixel-ratio.d.ts +15 -0
  11. package/dist/media/display-pixel-ratio.d.ts.map +1 -0
  12. package/dist/media/engine-import-failure.d.ts +16 -0
  13. package/dist/media/engine-import-failure.d.ts.map +1 -0
  14. package/dist/media/media-errors.d.ts +6 -0
  15. package/dist/media/media-errors.d.ts.map +1 -1
  16. package/dist/media/media-normalization.d.ts.map +1 -1
  17. package/dist/media/media-probe.d.ts.map +1 -1
  18. package/dist/media/media-source-state.d.ts.map +1 -1
  19. package/dist/media/media-source.d.ts +17 -0
  20. package/dist/media/media-source.d.ts.map +1 -1
  21. package/dist/media/mediabunny-media-source.d.ts.map +1 -1
  22. package/dist/media/video-engine-media-source.d.ts +54 -0
  23. package/dist/media/video-engine-media-source.d.ts.map +1 -0
  24. package/dist/media/video-engine-media-source.js +3 -0
  25. package/dist/media/video-engine-media-source.js.map +1 -0
  26. package/dist/playback/media-playback-controller.d.ts +7 -1
  27. package/dist/playback/media-playback-controller.d.ts.map +1 -1
  28. package/dist/render-preparation/mask-frame-artifact.d.ts +48 -12
  29. package/dist/render-preparation/mask-frame-artifact.d.ts.map +1 -1
  30. package/dist/render-preparation/mask-frame-compositor.d.ts +12 -5
  31. package/dist/render-preparation/mask-frame-compositor.d.ts.map +1 -1
  32. package/dist/render-preparation/mask-frame-preparer.d.ts.map +1 -1
  33. package/dist/render-preparation/mask-preparation-worker-count.d.ts +4 -4
  34. package/dist/render-preparation/mask-preparation-worker-protocol.d.ts +13 -3
  35. package/dist/render-preparation/mask-preparation-worker-protocol.d.ts.map +1 -1
  36. package/dist/render-preparation/prepared-render-window.d.ts +44 -2
  37. package/dist/render-preparation/prepared-render-window.d.ts.map +1 -1
  38. package/dist/render-preparation/prepared-window-timeline.d.ts +2 -6
  39. package/dist/render-preparation/prepared-window-timeline.d.ts.map +1 -1
  40. package/dist/renderers/injected-pixi.d.ts +38 -0
  41. package/dist/renderers/injected-pixi.d.ts.map +1 -0
  42. package/dist/renderers/mask-palette.d.ts +14 -0
  43. package/dist/renderers/mask-palette.d.ts.map +1 -0
  44. package/dist/renderers/mask-vertex.d.ts +14 -0
  45. package/dist/renderers/mask-vertex.d.ts.map +1 -0
  46. package/dist/renderers/media-renderer-core.d.ts +9 -0
  47. package/dist/renderers/media-renderer-core.d.ts.map +1 -1
  48. package/dist/renderers/media-renderer-scene.d.ts +50 -2
  49. package/dist/renderers/media-renderer-scene.d.ts.map +1 -1
  50. package/dist/renderers/media-renderer-state.d.ts +20 -1
  51. package/dist/renderers/media-renderer-state.d.ts.map +1 -1
  52. package/dist/renderers/media-renderer-transport.d.ts +72 -0
  53. package/dist/renderers/media-renderer-transport.d.ts.map +1 -0
  54. package/dist/renderers/pixi-box-layer.d.ts +5 -0
  55. package/dist/renderers/pixi-box-layer.d.ts.map +1 -1
  56. package/dist/renderers/pixi-focus-layer.d.ts +19 -2
  57. package/dist/renderers/pixi-focus-layer.d.ts.map +1 -1
  58. package/dist/renderers/pixi-frame-present.d.ts +77 -0
  59. package/dist/renderers/pixi-frame-present.d.ts.map +1 -0
  60. package/dist/renderers/pixi-id-mask-shader.d.ts +6 -25
  61. package/dist/renderers/pixi-id-mask-shader.d.ts.map +1 -1
  62. package/dist/renderers/pixi-interaction-layer.d.ts.map +1 -1
  63. package/dist/renderers/pixi-interaction-presentation-layer.d.ts +12 -2
  64. package/dist/renderers/pixi-interaction-presentation-layer.d.ts.map +1 -1
  65. package/dist/renderers/pixi-mask-halo.d.ts +18 -23
  66. package/dist/renderers/pixi-mask-halo.d.ts.map +1 -1
  67. package/dist/renderers/pixi-mask-layer.d.ts +94 -32
  68. package/dist/renderers/pixi-mask-layer.d.ts.map +1 -1
  69. package/dist/renderers/pixi-media-scene.d.ts +67 -0
  70. package/dist/renderers/pixi-media-scene.d.ts.map +1 -1
  71. package/dist/renderers/pixi-polygon-layer.d.ts +9 -2
  72. package/dist/renderers/pixi-polygon-layer.d.ts.map +1 -1
  73. package/dist/renderers/pixi-region-coverage-mask.d.ts +62 -0
  74. package/dist/renderers/pixi-region-coverage-mask.d.ts.map +1 -0
  75. package/dist/renderers/pixi-region-effect.d.ts +42 -0
  76. package/dist/renderers/pixi-region-effect.d.ts.map +1 -0
  77. package/dist/renderers/pixi-region-layer.d.ts +43 -2
  78. package/dist/renderers/pixi-region-layer.d.ts.map +1 -1
  79. package/dist/renderers/pixi-shader-lifecycle.d.ts +14 -0
  80. package/dist/renderers/pixi-shader-lifecycle.d.ts.map +1 -0
  81. package/dist/renderers/pixi-vector-layer.d.ts.map +1 -1
  82. package/dist/renderers/prepared-annotation-window.d.ts +47 -0
  83. package/dist/renderers/prepared-annotation-window.d.ts.map +1 -0
  84. package/dist/renderers/presented-frame-channel.d.ts +138 -0
  85. package/dist/renderers/presented-frame-channel.d.ts.map +1 -0
  86. package/dist/renderers/scene-render-scheduler.d.ts +20 -0
  87. package/dist/renderers/scene-render-scheduler.d.ts.map +1 -0
  88. package/dist/sessions/media-session-defaults.d.ts +10 -6
  89. package/dist/sessions/media-session-defaults.d.ts.map +1 -1
  90. package/dist/sessions/media-session-media.d.ts.map +1 -1
  91. package/dist/sessions/media-session-state.d.ts.map +1 -1
  92. package/dist/sessions/media-session.d.ts.map +1 -1
  93. package/dist/tracking.worker.js +73 -4
  94. package/dist/tracking.worker.js.map +1 -1
  95. package/dist/types/media-normalization.d.ts +34 -0
  96. package/dist/types/media-normalization.d.ts.map +1 -1
  97. package/dist/types/media-renderer.d.ts +31 -1
  98. package/dist/types/media-renderer.d.ts.map +1 -1
  99. package/dist/types/media-session.d.ts +89 -15
  100. package/dist/types/media-session.d.ts.map +1 -1
  101. package/dist/types/render-preparation.d.ts +149 -5
  102. package/dist/types/render-preparation.d.ts.map +1 -1
  103. package/dist/video-engine-media-source-CUXnOJOV.js +450 -0
  104. package/dist/video-engine-media-source-CUXnOJOV.js.map +1 -0
  105. package/dist/web-video-engine/analysis-session.d.ts +75 -0
  106. package/dist/web-video-engine/analysis.d.ts +6 -0
  107. package/dist/web-video-engine/analysis.js +1850 -0
  108. package/dist/web-video-engine/cache-budget.d.ts +18 -0
  109. package/dist/web-video-engine/canvas-sink-scrub-cursor.d.ts +89 -0
  110. package/dist/web-video-engine/clock.d.ts +82 -0
  111. package/dist/web-video-engine/constants.d.ts +261 -0
  112. package/dist/web-video-engine/create-scrub-cursor.d.ts +65 -0
  113. package/dist/web-video-engine/decode-resolution.d.ts +114 -0
  114. package/dist/web-video-engine/decode-scheduler.d.ts +371 -0
  115. package/dist/web-video-engine/decode-session.d.ts +283 -0
  116. package/dist/web-video-engine/decode-source.d.ts +258 -0
  117. package/dist/web-video-engine/diagnostics-store.d.ts +17 -0
  118. package/dist/web-video-engine/diagnostics.d.ts +316 -0
  119. package/dist/web-video-engine/embedded-engine-worker.d.ts +1 -0
  120. package/dist/web-video-engine/engine-core.d.ts +269 -0
  121. package/dist/web-video-engine/engine.d.ts +25 -0
  122. package/dist/web-video-engine/engine.js +912 -0
  123. package/dist/web-video-engine/engine.worker.d.ts +1 -0
  124. package/dist/web-video-engine/engine.worker.js +33624 -0
  125. package/dist/web-video-engine/frame-cache.d.ts +236 -0
  126. package/dist/web-video-engine/frame-extractor.d.ts +27 -0
  127. package/dist/web-video-engine/frame-timeline-DreEwsRY.js +616 -0
  128. package/dist/web-video-engine/frame-timeline.d.ts +80 -0
  129. package/dist/web-video-engine/frame-walker.d.ts +73 -0
  130. package/dist/web-video-engine/index.d.ts +13 -0
  131. package/dist/web-video-engine/index.d.ts.map +1 -0
  132. package/dist/web-video-engine/index.js +3 -0
  133. package/dist/web-video-engine/index.js.map +1 -0
  134. package/dist/web-video-engine/key-packet.d.ts +64 -0
  135. package/dist/web-video-engine/keyframe-index.d.ts +90 -0
  136. package/dist/web-video-engine/mirror-store.d.ts +55 -0
  137. package/dist/web-video-engine/renderer.d.ts +93 -0
  138. package/dist/web-video-engine/rotation.d.ts +34 -0
  139. package/dist/web-video-engine/scrub-controller.d.ts +375 -0
  140. package/dist/web-video-engine/scrub-cursor.d.ts +347 -0
  141. package/dist/web-video-engine/scrub-trajectory.d.ts +29 -0
  142. package/dist/web-video-engine/source-residency.d.ts +91 -0
  143. package/dist/web-video-engine/trace-recorder.d.ts +163 -0
  144. package/dist/web-video-engine/types.d.ts +200 -0
  145. package/dist/web-video-engine/video-engine.d.ts +437 -0
  146. package/dist/web-video-engine/webgpu-renderer.d.ts +61 -0
  147. package/dist/web-video-engine/worker-bridge.d.ts +11 -0
  148. package/dist/web-video-engine/worker-dispatch.d.ts +16 -0
  149. package/dist/web-video-engine/worker-protocol.d.ts +282 -0
  150. package/node_modules/supervision-js-core/dist/detections/buffered-detection-timeline.d.ts.map +1 -1
  151. package/node_modules/supervision-js-core/dist/detections/composite-detection-frame-source.d.ts.map +1 -1
  152. package/node_modules/supervision-js-core/dist/index.d.ts +5 -4
  153. package/node_modules/supervision-js-core/dist/index.d.ts.map +1 -1
  154. package/node_modules/supervision-js-core/dist/index.js +1167 -280
  155. package/node_modules/supervision-js-core/dist/index.js.map +1 -1
  156. package/node_modules/supervision-js-core/dist/styles/default-annotation-presentation.d.ts.map +1 -1
  157. package/node_modules/supervision-js-core/dist/styles/interaction-style.d.ts +4 -36
  158. package/node_modules/supervision-js-core/dist/styles/interaction-style.d.ts.map +1 -1
  159. package/node_modules/supervision-js-core/dist/styles/polyline-style.d.ts +5 -0
  160. package/node_modules/supervision-js-core/dist/styles/polyline-style.d.ts.map +1 -1
  161. package/node_modules/supervision-js-core/dist/types/annotation-renderer.d.ts +92 -7
  162. package/node_modules/supervision-js-core/dist/types/annotation-renderer.d.ts.map +1 -1
  163. package/node_modules/supervision-js-core/dist/types/detection-timeline.d.ts +191 -17
  164. package/node_modules/supervision-js-core/dist/types/detection-timeline.d.ts.map +1 -1
  165. package/node_modules/supervision-js-core/dist/types/media-rendering.d.ts +83 -5
  166. package/node_modules/supervision-js-core/dist/types/media-rendering.d.ts.map +1 -1
  167. package/node_modules/supervision-js-core/dist/types/polyline-style.d.ts +2 -0
  168. package/node_modules/supervision-js-core/dist/types/polyline-style.d.ts.map +1 -1
  169. package/node_modules/supervision-js-core/dist/types/session-lifecycle.d.ts +32 -0
  170. package/node_modules/supervision-js-core/dist/types/session-lifecycle.d.ts.map +1 -1
  171. package/node_modules/supervision-js-core/dist/utils/detection-conversions.d.ts.map +1 -1
  172. package/node_modules/supervision-js-core/dist/utils/detection-frames.d.ts +5 -0
  173. package/node_modules/supervision-js-core/dist/utils/detection-frames.d.ts.map +1 -1
  174. package/node_modules/supervision-js-core/dist/utils/detection-masks.d.ts +9 -0
  175. package/node_modules/supervision-js-core/dist/utils/detection-masks.d.ts.map +1 -1
  176. package/node_modules/supervision-js-core/dist/utils/detection-ranges.d.ts +18 -0
  177. package/node_modules/supervision-js-core/dist/utils/detection-ranges.d.ts.map +1 -0
  178. package/node_modules/supervision-js-core/dist/utils/id-mask-frame.d.ts +34 -2
  179. package/node_modules/supervision-js-core/dist/utils/id-mask-frame.d.ts.map +1 -1
  180. package/node_modules/supervision-js-core/dist/utils/wait-bound.d.ts +7 -0
  181. package/node_modules/supervision-js-core/dist/utils/wait-bound.d.ts.map +1 -0
  182. package/package.json +24 -3
@@ -0,0 +1,269 @@
1
+ import { type MediaClock } from "./clock";
2
+ import type { FrameId, FrameLanding } from "./frame-timeline";
3
+ import { type EngineDiagnostics } from "./diagnostics";
4
+ import { type SeekIntent } from "./scrub-cursor";
5
+ import { type EngineTrace } from "./trace-recorder";
6
+ import { type EngineReadySnapshot } from "./types";
7
+ import { type DiagnosticsEvent, type EngineLoadConfig, type MirrorEvent, type PresentedFrameEvent, type SerializedViewport } from "./worker-protocol";
8
+ export interface EngineCoreOptions {
9
+ /** Sink for broadcast state. The worker host serializes each event onto
10
+ * the state plane; tests collect them to assert transitions. */
11
+ emit: (event: MirrorEvent) => void;
12
+ /** Sink for the diagnostics broadcast (the non-mirror 'diag' arm). Optional:
13
+ * when absent the broadcaster has nowhere to post, so a consumer that never
14
+ * wires it pays nothing. The worker host wires it to the same postMessage. */
15
+ emitDiagnostics?: (event: DiagnosticsEvent) => void;
16
+ /** Sink for the pixel plane, which carries frames only in "frames"
17
+ * presentation mode. The VideoFrame is handed over on the transfer list, so
18
+ * a host wiring this to postMessage detaches the worker's reference by
19
+ * posting it. Unwired there is no receiver, so the core closes each frame
20
+ * instead of leaking it. */
21
+ emitPresentedFrame?: (event: PresentedFrameEvent, transfer: Transferable[]) => void;
22
+ /** Clock seam. Defaults to the wall-clock PerformanceMediaClock; tests
23
+ * inject a fake so they can drive media time deterministically. */
24
+ clock?: MediaClock;
25
+ }
26
+ /**
27
+ * The engine, with every main-thread concern removed. Owns the clock, cursor,
28
+ * and render controller; runs entirely inside the worker. It never touches the
29
+ * DOM, a React store, the playhead, or the imperative handle.
30
+ *
31
+ * It speaks two languages. Broadcast state (time, frame index, status,
32
+ * duration, seeking) leaves through the `emit` callback. Command results that
33
+ * the main thread cannot predict (load metadata, the frame a step lands on)
34
+ * are method return values the worker host correlates back to the caller.
35
+ *
36
+ * Time is emitted only while playing. Paused positions are owned by the main
37
+ * thread (written optimistically on scrub, or applied from step's return), so
38
+ * the core never emits a competing time that would yank a settled playhead.
39
+ */
40
+ export declare class EngineCore {
41
+ private readonly emit;
42
+ private readonly emitDiagnostics;
43
+ private readonly emitPresentedFrame;
44
+ private readonly clock;
45
+ private cursor;
46
+ private residency;
47
+ private controller;
48
+ private canvas;
49
+ private viewport;
50
+ /** The box the host said it paints these frames into, kept from the load
51
+ * command. Under "frames" presentation nothing ever measures a canvas here,
52
+ * so this is the only display geometry the engine is ever given. */
53
+ private displayBox;
54
+ private metadata;
55
+ /**
56
+ * The decoder failure the runtime has given up on, latched. Nothing the
57
+ * transport is asked to do afterwards can decode a frame, so nothing it is
58
+ * asked to do may report otherwise: a play() that answered "playing" over a
59
+ * decoder that had already been condemned is how a source with one unusable
60
+ * entry point read as healthy for the rest of the session.
61
+ */
62
+ private decodeFailure;
63
+ private presentation;
64
+ private durationMs;
65
+ private paintSeq;
66
+ private playing;
67
+ /** The frame the last step landed on. A serialized burst resolves each
68
+ * step before its rAF paints, so getLastPaintedMs lags by one or more
69
+ * steps; basing the next step on the actual landing keeps every step in a
70
+ * burst advancing exactly one frame instead of re-stepping a stale base. */
71
+ private lastStepLanded;
72
+ /** Where the current seek's walk actually landed, known once a crisp frame
73
+ * for it has painted. A requested time is not a frame time: it comes from a
74
+ * marker rail or a pointer, so it usually sits between two samples. Walking
75
+ * backward from it reaches the sample already on screen and the press reads
76
+ * as dead. Null until that crisp paint arrives, so a step pressed before it
77
+ * still falls back to the clock. */
78
+ private seekLanded;
79
+ /** The seek still waiting on that paint, or null when none is. Every paint
80
+ * the engine makes runs through this latch, and the render loop paints one
81
+ * frame per animation frame from a stash a previous seek may have filled,
82
+ * so without the target on it any leftover frame answers for the seek in
83
+ * flight and publishes itself as the playhead. */
84
+ private awaitedSeek;
85
+ private seekGeneration;
86
+ /** Wall stamp of a seek being served by re-anchoring the playback walk, or
87
+ * null when no such seek is waiting on its crisp frame. */
88
+ private playSeekStartedAtMs;
89
+ private playSeeks;
90
+ private playSeekSamples;
91
+ private playSeekSumMs;
92
+ private playSeekMaxMs;
93
+ /** The frame the last paint put up, for the diagnostics screen readout. */
94
+ private lastPaintedId;
95
+ /** Last frame the host confirmed reached its display surface. */
96
+ private lastHostFrame;
97
+ /** Rejects an older refresh that completes after a newer one in one epoch. */
98
+ private lastHostPaintSeq;
99
+ /** Mirrors WebVideoEngine's interactive-seek latch: true when a drag paused a
100
+ * playing engine, so endInteractiveSeek knows to resume. */
101
+ private resumeAfterInteractiveSeek;
102
+ /** Worker-realm broadcast timer handle, or null when diagnostics are off. */
103
+ private diagnosticsTimer;
104
+ /** Wall time the cursor was first seen draining a seek, or null while it is
105
+ * not. How long a state has lasted is a diagnostics question, so it is
106
+ * timed here rather than on the scheduler, whose clock is the seam tests
107
+ * drive latency measurements through. */
108
+ private drainingSinceMs;
109
+ private readonly paintRateMeter;
110
+ private readonly presentedRateMeter;
111
+ /** Lazily allocated on traceArm, freed on disarm; zero memory off. */
112
+ private traceRecorder;
113
+ /** The last assembled trace, kept after disarm so a stopped capture stays
114
+ * downloadable until the next arm. Null while armed or never captured. */
115
+ private stoppedTrace;
116
+ constructor(options: EngineCoreOptions);
117
+ /**
118
+ * Receives the transferred display canvas and its measured box. Stored
119
+ * even when the controller does not exist yet (bindCanvas can arrive
120
+ * before load) and bound as soon as load builds the controller. Passing
121
+ * null tears the binding down and stops the render loop.
122
+ */
123
+ setCanvas(canvas: OffscreenCanvas | null, viewport?: SerializedViewport): void;
124
+ load(config: EngineLoadConfig): Promise<EngineReadySnapshot>;
125
+ play(): void;
126
+ pause(): void;
127
+ togglePlayback(): void;
128
+ /**
129
+ * Sets how fast media time runs against wall time. The clock re-anchors, so
130
+ * a change mid-playback bends the slope without moving the playhead, and the
131
+ * decode-ahead buffer keeps its frames: they are positions in media time,
132
+ * which a rate change does not touch. Applied while paused it simply waits,
133
+ * since a paused clock advances at no rate at all.
134
+ *
135
+ * Throws on a rate outside the supported forward range.
136
+ */
137
+ setPlaybackRate(rate: number): void;
138
+ getPlaybackRate(): number;
139
+ /** Fire-and-forget seek onto a named frame. Emits no playhead: the main
140
+ * thread snapped the gesture and wrote it. Paints a cache preview, then
141
+ * walks the cursor. */
142
+ scrub(frameIndex: number, intent?: SeekIntent): void;
143
+ /** Moves a running playback walk to `tSec`. The clock is already there. */
144
+ private reanchorPlayback;
145
+ /** Closes the wait of a seek served by re-anchoring, at the crisp paint that
146
+ * ends it. A seek that walked the cursor leaves no stamp; the scheduler
147
+ * times those. Stopping the transport abandons the wait: its frame can
148
+ * still paint minutes later, and the idle time between is not a wait
149
+ * anyone had, so the seek keeps its count and loses its sample. */
150
+ private closePlaySeekWait;
151
+ commit(frameIndex: number): Promise<FrameLanding | null>;
152
+ seekToKey(timeMs: number): Promise<FrameLanding | null>;
153
+ /**
154
+ * Moves one frame along the source in presentation order and returns where
155
+ * it landed, or null at either end. Only the worker knows which frame a
156
+ * decode produced, so the landing is the command's return value. The stepped
157
+ * frame paints worker-side via the controller and emits a paint like any
158
+ * other.
159
+ */
160
+ step(direction: 1 | -1): Promise<FrameLanding | null>;
161
+ /** Append a runtime event to the trace ring, stamped with worker-clock time
162
+ * since arm. Predicted-false and free when no trace is armed. */
163
+ private pushTraceEvent;
164
+ /** Broadcast a status transition and record it on the trace ring, so an
165
+ * exported trace shows the playback-state timeline alongside paints/seeks. */
166
+ private emitStatus;
167
+ /**
168
+ * The runtime can no longer deliver pixels, whether decoding stopped or the
169
+ * frames handoff failed. Stop the transport first, then report, so the status
170
+ * a consumer sees and what the engine is doing agree.
171
+ */
172
+ private handleTerminalFailure;
173
+ /** Says the failure again for whoever just asked the transport to move. A
174
+ * consumer that only listens for changes has already been told; one that
175
+ * reads the status after its own command has to find the same answer. */
176
+ private republishFailure;
177
+ beginInteractiveSeek(): void;
178
+ endInteractiveSeek(): void;
179
+ dispose(): Promise<void>;
180
+ /** True only when the cursor exists and reports settled. Mirrors
181
+ * WebVideoEngine.isIdle for tests; the facade derives its own from state. */
182
+ isIdle(): boolean;
183
+ /** Engine diagnostics snapshot (renderer, track facts, scheduler stats), or
184
+ * null before load. The scheduler field is null on the uncached cursor. */
185
+ getStats(): EngineDiagnostics | null;
186
+ private observeSeekIdle;
187
+ private handleEnded;
188
+ private awaitSeekLanding;
189
+ private isCurrentSeek;
190
+ private forgetSeekLanding;
191
+ private abandonAwaitedSeek;
192
+ /** Ends an impossible landing. Awaitable movement rejects with the engine's
193
+ * terminal error; a scrub has no consumer, so it is released quietly. */
194
+ private failAwaitedSeek;
195
+ /** Releases the latch of a seek that has already answered its caller. The
196
+ * landing rode back on the return value, so a paint arriving after it would
197
+ * move the playhead to somewhere the caller was never told about. */
198
+ private closeSeekLanding;
199
+ /**
200
+ * Whether this paint is the landing of the seek waiting on one.
201
+ *
202
+ * An exact walk answers at or before the frame it aimed at, and no further
203
+ * back than the sample next to it, so the target falls inside the answering
204
+ * frame's own span. That span is the whole test: a frame decoded for some
205
+ * earlier position sits outside it however recently it was painted.
206
+ */
207
+ private answersAwaitedSeek;
208
+ /** The frame table of the loaded source. Reached only from paths that have
209
+ * already established a cursor, which is what carries it. */
210
+ private timeline;
211
+ /**
212
+ * Points the background walk at where the viewer is, as a byte offset. The
213
+ * file's own byte layout is not exposed, so this reads position as a share of
214
+ * duration: enough to order the walk outward from the playhead, and wrong by
215
+ * at most the amount the bitrate varies.
216
+ */
217
+ private aimResidency;
218
+ private onPaint;
219
+ /** Makes only a frame the host actually rendered authoritative for playback
220
+ * time and pause settlement. An older navigation or refresh cannot move the
221
+ * clock backward after a newer frame has won. */
222
+ acknowledgePresentedFrame(paintSeq: number, frameId: FrameId, navigationGeneration: number): void;
223
+ private beginPresentationGeneration;
224
+ /**
225
+ * Posts one frame with the identity of the paint it came from, in the same
226
+ * message. With no sink wired there is no receiver, so the frame is closed
227
+ * here: the controller has already let go of it, and a frame left open pins
228
+ * a decoder buffer.
229
+ */
230
+ private present;
231
+ /**
232
+ * Starts the worker-realm broadcast timer at hz (default BROADCAST_HZ) and
233
+ * flips the controller's per-rAF counter gate on. Decode-independent: the
234
+ * timer callback does synchronous reads plus one post, never an await and
235
+ * never the sink, so it runs between event-loop tasks, not inside a decode.
236
+ */
237
+ diagnosticsStart(hz?: number): void;
238
+ diagnosticsStop(): void;
239
+ /** Lazily allocate the trace rings and begin capturing. windowMs sizes the
240
+ * snapshot ring alone: the event ring is fed by paints and gestures at no
241
+ * fixed rate, so wall clock cannot size it. */
242
+ traceArm(windowMs: number): void;
243
+ /** Stop capturing and free the rings, but keep the assembled trace so it can
244
+ * still be exported. A record-then-stop-then-download flow would otherwise
245
+ * lose the capture, since stop used to null the recorder outright. */
246
+ traceDisarm(): void;
247
+ /** The current capture if still armed, else the last stopped capture. Non
248
+ * destructive so a download can be retried; a new arm clears the stopped one. */
249
+ traceExport(): EngineTrace | null;
250
+ /**
251
+ * Assembles ONE snapshot and posts it as the 'diag' event. When a trace is
252
+ * armed, the SAME reference is ring-appended, so there is no second
253
+ * serialization. Synchronous: reads current stats, never awaits, never paints.
254
+ */
255
+ private broadcastDiagnostics;
256
+ private assembleSnapshot;
257
+ private statusString;
258
+ /**
259
+ * CSS width the picture occupies inside the box the host declared, native
260
+ * aspect fitted into it, or null when no box was declared. A portrait source
261
+ * in a landscape box paints far narrower than the box, so the fit is what the
262
+ * ratio has to be measured against.
263
+ */
264
+ private paintedBoxCssWidth;
265
+ /** The ratio whichever side measured one reported, or null when neither did.
266
+ * The engine has no window of its own to read it off. */
267
+ private devicePixelRatio;
268
+ private traceEnvironment;
269
+ }
@@ -0,0 +1,25 @@
1
+ export { WebVideoEngine } from "./video-engine";
2
+ export type { WebVideoEngineHandle, WebVideoEngineOptions, } from "./video-engine";
3
+ export { SourceKind } from "./types";
4
+ export type { BlobVideoSource, StreamVideoSource, UrlSourceReadConfig, UrlVideoSource, VideoMetadata, VideoSource, } from "./types";
5
+ export { PlaybackStatus } from "./types";
6
+ export type { EngineChannel, EngineReadySnapshot, PaintSeq, PlaybackState, } from "./types";
7
+ export type { PresentationMode } from "./types";
8
+ export type { PresentedFrame } from "./worker-protocol";
9
+ export type { PresentedFrameHandler } from "./video-engine";
10
+ export type { FrameQuality } from "./scrub-cursor";
11
+ export type { Rotation } from "./rotation";
12
+ export { FrameTimeline } from "./frame-timeline";
13
+ export type { FrameId, FrameLanding, FrameTimelineData, TickRate, } from "./frame-timeline";
14
+ export type { SeekIntent } from "./scrub-cursor";
15
+ export type { SeekTarget } from "./video-engine";
16
+ export { PLAYBACK_RATE } from "./constants";
17
+ export { asFps, asPaintSeq, asSec } from "./types";
18
+ export type { Fps, Sec } from "./types";
19
+ export { cappedResolution, displayBoxResolution, nativeResolution, viewportResolution, } from "./decode-resolution";
20
+ export type { DecodeResolutionStrategy, DisplayBoxResolutionOptions, ViewportResolutionOptions, } from "./decode-resolution";
21
+ export { WebVideoEngineError, WebVideoEngineErrorCode } from "./types";
22
+ export type { Warning, WarningSeverity } from "./diagnostics";
23
+ export type { DiagnosticsSnapshot, SourceResidencyDiagnostics, } from "./diagnostics";
24
+ export type { SourceResidencyConfig } from "./worker-protocol";
25
+ export { DIAGNOSTICS, TRACE_RING_BOUNDS } from "./constants";