supervision-js
    Preparing search index...

    Interface LiveWritableDetectionFrameSource

    Writable detection source that also supports live ingestion.

    createWritableDetectionFrameSource returns this shape. Consumers that only implement the historical WritableDetectionFrameSource contract stay assignable to it, so live ingestion is an added capability rather than a required one.

    interface LiveWritableDetectionFrameSource {
        loadFrames(
            startTime: number,
            endTime: number,
            options?: DetectionFrameLoadOptions,
        ): Promise<readonly DetectionFrame[]>;
        getChangesSince?(
            version: number,
            ranges: readonly DetectionFrameSourceVersionRange[],
        ): DetectionFrameSourceChanges;
        destroy?(): void;
        datasetId: string;
        appendFrames(
            frames: readonly DetectionFrame[],
        ): Promise<ColdDetectionFrameStoreWriteSummary>;
        replaceFrames(
            frames: readonly DetectionFrame[],
        ): Promise<ColdDetectionFrameStoreWriteSummary>;
        clear(): Promise<void>;
        waitForRange(range: DetectionFrameSourceVersionRange): Promise<void>;
        getAvailableRanges(): readonly DetectionFrameSourceVersionRange[];
        getSummary(): ColdDetectionFrameStoreWriteSummary | null;
        getVersion(range?: DetectionFrameSourceVersionRange): number;
        appendLiveFrame(
            frame: DetectionFrame,
        ): Promise<ColdDetectionFrameStoreWriteSummary>;
        finalizeCoverage(
            endTime: number,
        ): Promise<ColdDetectionFrameStoreWriteSummary | null>;
    }

    Hierarchy (View Summary)

    Index
    datasetId: string
    • Load semantic detection frames for the requested media-time range.

      Sources should return detection data, not renderer artifacts. Implementers should prefer sorted frames and avoid mutating returned frames after handing them to the renderer. options is additive context; ignoring it stays correct for any source that does not compose other sources.

      Parameters

      Returns Promise<readonly DetectionFrame[]>

    • Optional coverage hook. Resolve when the source has enough data to answer loadFrames for the requested range.

      Playback awaits it under an enabled detection playback gate, which a session with appendable detections gets by default; otherwise a caller that wants to wait awaits it itself. A composed source fans it out to the entries it composes.

      Returns Promise<void>

    • Optional monotonically increasing source version. Buffered timelines use this to refresh only when the current range changed. Sources that can revise an existing frame must implement this hook; without it, overlapping frame identities are treated as immutable across rolling window loads.

      Parameters

      Returns number

    • Append the newest live frame with latest-frame/hold-until-next semantics.

      The frame is written with an open-ended hold, and the previously held live frame is closed at this frame's mediaTime. At most two frames are written, so append cost does not grow with retained history. Writes are serialized internally and a frame older than the newest accepted live frame is dropped, so the newest causal result always wins.

      Parameters

      Returns Promise<ColdDetectionFrameStoreWriteSummary>

    • Close the final frame's coverage at a known end of media.

      A container can declare a duration beyond the last decoded sample, and a live frame is deliberately held open past the data it describes. Finalizing sets the latest frame's exclusive end to endTime, extending or shortening it as needed, so the source stops answering for time past the end of media. The readers this serves are waitForRange and the buffered window's own coverage arithmetic. It is idempotent and returns the current summary when there is nothing to change.

      Parameters

      • endTime: number

      Returns Promise<ColdDetectionFrameStoreWriteSummary | null>