Skip to content

Class: VideoSampler<T>

Defined in: aiui-intent-runtime/src/video.ts:148

The share cadence + toggle/pause state machine. One share is a start()stop() span, during which frames arrive at the interval with a seq counting from 0 (a new share resets it — the host bumps the share ordinal in parallel). pause()/resume() (window blur/focus) hold and continue sampling without ending the share, so a glance away doesn't drop the context and refocus picks it right back up.

Smart mode adds one rule on top: VideoSamplerDeps.shouldCapture vetoes a tick, and a vetoed tick is a non-event — no seq, no sendFrame, nothing in the transcript. The share's very first frame is exempt.

Type Parameters

T

T = Uint8Array

Constructors

Constructor

new VideoSampler<T>(deps): VideoSampler<T>

Defined in: aiui-intent-runtime/src/video.ts:163

Parameters

deps

VideoSamplerDeps<T>

Returns

VideoSampler<T>

Accessors

sharing

Get Signature

get sharing(): boolean

Defined in: aiui-intent-runtime/src/video.ts:172

True while a share is active (whether or not it is momentarily paused).

Returns

boolean

Methods

dispose()

dispose(): void

Defined in: aiui-intent-runtime/src/video.ts:226

Release the interval on unmount (does not emit an off event — the caller owns that).

Returns

void


pause()

pause(): void

Defined in: aiui-intent-runtime/src/video.ts:210

Window blur: hold sampling but stay "sharing" so a refocus can resume it.

Returns

void


resume()

resume(): void

Defined in: aiui-intent-runtime/src/video.ts:218

Window focus: continue sampling (same seq run) if the share is still on.

Returns

void


start()

start(): void

Defined in: aiui-intent-runtime/src/video.ts:177

Begin a share: reset the seq, sample immediately, then every intervalMs.

Returns

void


stop()

stop(): void

Defined in: aiui-intent-runtime/src/video.ts:203

End the share entirely (toggle off / thread-close / disarm).

Returns

void


takeMutedSkips()

takeMutedSkips(): boolean

Defined in: aiui-intent-runtime/src/video.ts:196

Did the mute swallow at least one frame since this was last called? Reads and clears, like the interaction gate it feeds: the caller (unmute) converts one outstanding debt into one frame, and a second unmute with nothing skipped in between must not buy a second one.

Returns

boolean