UNPKG

homebridge-unifi-protect

Version:

Homebridge UniFi Protect plugin providing complete HomeKit integration for the entire UniFi Protect ecosystem with full support for most features including HomeKit Secure Video, multiple controllers, blazing fast performance, and much more.

36 lines 2.2 kB
export type StreamSource = "buffer" | "bufferDegraded" | "rtsp" | "unavailable"; export interface StreamSourceDecision { kick: boolean; source: StreamSource; } /** * Resolve which transport a live view draws from, given the camera's current facts. Pure and exhaustively testable. * * The ordered decision, first applicable step winning: * * 1. Seed: buffer-backed livestreaming serves live views when the toggle is on and the camera is capable; otherwise direct RTSP. * 2. A/B test (internal development only): swap the chosen transport. * 3. Package cameras prefer the buffered API path when recording, regardless of the toggle; it only matters when the seed picked RTSP. * 4. AV1 cannot stream over RTSP. If we would otherwise pick RTSP for an AV1 camera, redirect to the buffer path when one exists, else the stream is unavailable. * 5. Buffer-liveness fallback: when the buffer is wanted but not running, an AV1 camera rides a transient session on the substrate channel ("bufferDegraded") and * any other codec falls back to RTSP; each wakes the supervisor to revive the standing buffer behind the fallback. * 6. Otherwise, direct RTSP. * * @param input.abTestFlip - Whether the internal A/B test is active for this request (flips the chosen transport). * @param input.bufferStarted - Whether the standing timeshift buffer is currently running. * @param input.hasRecordingDemand - Whether HomeKit Secure Video recording is currently active. * @param input.isPackageCamera - Whether this is the doorbell's package camera. * @param input.usesTimeshiftLivestream - Whether buffer-backed livestreaming is enabled and the camera is capable of it. * @param input.videoCodec - The camera's negotiated video codec (only "av1" changes the decision). * * @returns The resolved {@link StreamSourceDecision}. */ export declare function resolveSessionSource(input: { abTestFlip: boolean; bufferStarted: boolean; hasRecordingDemand: boolean; isPackageCamera: boolean; usesTimeshiftLivestream: boolean; videoCodec: string; }): StreamSourceDecision; //# sourceMappingURL=stream-source-policy.d.ts.map