Interface: VideoSamplerDeps<T>
Defined in: aiui-intent-runtime/src/video.ts:81
The pixel + delivery seams the VideoSampler drives. Generic in the captured payload T because the machine never looks inside one — it only asks "did a frame come back?". The host passes ShotPixels (thumb + JPEG bytes); the tests pass whatever is convenient.
Type Parameters
T
T = Uint8Array
Properties
intervalMs?
optionalintervalMs?:number| (() =>number)
Defined in: aiui-intent-runtime/src/video.ts:96
Sampling cadence in ms — a number, or a THUNK read before each tick so a live config change (the share's fps slider) takes effect on the very next frame without restarting the share. Defaults to VIDEO_SAMPLE_INTERVAL_MS.
Methods
captureFrame()
captureFrame():
Promise<T|undefined>
Defined in: aiui-intent-runtime/src/video.ts:87
Capture one downscaled JPEG frame of the shared screen, or undefined when the capture surface isn't available right now (grant denied/ended). Async: the first call may acquire the one-time display-capture grant.
Returns
Promise<T | undefined>
muted()?
optionalmuted():boolean
Defined in: aiui-intent-runtime/src/video.ts:131
Is the share muted (N)? Consulted LAST, after every other gate has already said "take this frame" — so muting is a pure veto on delivery and changes nothing about how the rest of the machine decides. A vetoed tick is recorded (see VideoSampler.takeMutedSkips) so unmuting can repay the frame it owes.
Returns
boolean
now()?
optionalnow():number
Defined in: aiui-intent-runtime/src/video.ts:133
Clock seam (Date.now).
Returns
number
rearm()?
optionalrearm():void
Defined in: aiui-intent-runtime/src/video.ts:123
Hand the gate back. Called when a tick consumed shouldCapture and then delivered no frame — the capture came back empty (grant lost, encode failed), or a pause() landed mid-encode and the frame was dropped.
shouldCapture is read-and-CLEAR, so without this the interaction that earned the frame is destroyed by the attempt: the next tick sees a closed gate, and a share sitting over a now-still screen never photographs the thing the user just did. Same rule the in-flight early return already follows — a tick that services nothing owes the next one a frame.
Omit where the gate consumes nothing (continuous mode) — there is no debt.
Returns
void
sendFrame()
sendFrame(
frame,pixels):void
Defined in: aiui-intent-runtime/src/video.ts:89
Deliver one captured frame.
Parameters
frame
pixels
T
Returns
void
shouldCapture()?
optionalshouldCapture():boolean
Defined in: aiui-intent-runtime/src/video.ts:109
Smart mode's gate, consulted once per tick (the first frame of a share excepted, which always fires): capture this frame? The host's policy — the intent client grants on an activity-aware cadence — and typically read-and-CLEAR: a grant consumes the state that earned it (rearm hands it back when the frame never delivers), so the machine calls it exactly once per tick, and only for ticks that actually get to decide. Omit for continuous mode.
A tick the gate declines is not a frame: seq doesn't advance and nothing reaches sendFrame, so a share sitting over a still screen is free.
Returns
boolean