supervision-js
    Preparing search index...

    Interface DetectionBufferOptions

    interface DetectionBufferOptions {
        selectionMode?: DetectionFrameSelectionMode;
        frameRate?: number;
        frameIndexOriginTime?: number;
        enabled?: boolean | (() => boolean);
        bufferAheadSeconds?: number;
        bufferBehindSeconds?: number;
        refreshIntervalSeconds?: number;
        playbackGate?: DetectionPlaybackGateOptions;
    }

    Hierarchy (View Summary)

    Index

    Selection strategy for matching media playback time to detection frames.

    frameRate?: number

    Nominal inference frame rate, and the grid step NearestFrameIndex falls back to. With two or more indexed frames buffered the step is measured from their own media times, so a rate that disagrees with the clip's real one cannot walk selection off the grid.

    frameIndexOriginTime?: number

    Media timestamp for inference frame index 0.

    Selection does not read this. Each buffered frame carries the media time its index sits at, which states the same thing without an origin to extrapolate from.

    enabled?: boolean | (() => boolean)

    Whether the window keeps loading, asked again every time a load is about to start.

    Loading stays on when this is unset, so a host that hides its annotations while keeping them buffered behaves as it always has. Turned off, nothing is fetched: no rolling prefetch, no per-frame prepare, and no playback gate wait. The window already loaded is kept and still answers selectFrame, so turning it back on resumes from where it stopped instead of reloading ground it still holds.

    A predicate is read at each of those points rather than captured, which is how a host drives this from state that changes while the timeline lives without rebuilding it and throwing the window away.

    bufferAheadSeconds?: number

    Seconds of detections to keep loaded ahead of playback.

    bufferBehindSeconds?: number

    Seconds of detections to keep loaded behind playback.

    refreshIntervalSeconds?: number

    Minimum media-time movement before the hot detection window is rebuilt.

    This governs refreshes of ground the window already covers. A media time the window does not cover loads immediately whatever this says, so raising it costs coverage nothing and only reduces repeated work.

    A session defaults it to 2.5 seconds for a file, whose detections do not change while it plays, and to 0.25 seconds for a stream, where the source gains data under the window. A renderer created directly leaves it unset, which refreshes whenever the playhead moves.

    Hold playback until detections cover the frame about to be presented.

    Off by default: the picture moves first, and a frame the buffered window does not cover presents without annotations until a later load reaches it. Enabled, a gated prepare awaits the source's waitForRange for the requested lookahead before it loads, so playback stalls rather than showing an unannotated frame.

    A media source the renderer pulls decoded samples from stalls in the renderer's own sample pump, frame by frame. A source that presents its own frames owns the playhead and the renderer follows it; the browser package's video-engine source, openVideoEngineMediaSource, is that kind of source, and it is the one most hosts render video through. There the renderer stops the producer instead: coverage is awaited before it is asked to run, and again whenever it reaches a frame the source cannot answer for yet, which it resumes from on its own once the coverage arrives.