camera-streams
Camera streams — device-scoped facade over the system stream-broker.
Camera streams — device-scoped facade over the system stream-broker.
Mirrors the slice of broker state relevant to a single device:
getCameraStreams(): the pool of physical streams published for this device. UI uses it to populate the "Camera Stream" dropdown under each quality section.getBrokerStreams(): the (up to 3) profile slotshigh/mid/lowwith their current assignment + runtime status. UI uses it for the WebRTC quality picker, recording target selection, etc.
Registered for every camera device that has at least one published cam stream. The provider is owned by the stream-broker addon; reads go against the broker's in-memory registries. Mutations (assign / unassign / publish / retract) do NOT live here — they stay on the system stream-broker cap so cross-device / addon-driven flows keep a single namespace.
At a glance
| Capability | camera-streams |
| Provided by | An addon wraps the device and provides it. It is bound to a device through the device bindings and can be bound automatically to compatible devices. |
| Active providers per device | one |
| Device types | camera |
| Source | packages/types/src/capabilities/camera-streams.cap.ts |
Methods
Every method takes the device id (deviceId) to address the device; the input tables below list the other fields.
| Method | Kind | Required of a provider | Access |
|---|---|---|---|
getCameraStreams | query | yes | default |
getBrokerStreams | query | yes | default |
getRtspEntries | query | yes | default |
getProfileRtspEntries | query | yes | default |
pickStream | query | yes | default |
getCameraStreams
query
Input
No fields besides deviceId.
Output
({ camStreamId: string; deviceId: number; kind: "pull-rtsp" | "pull-rtmp" | "pull-http" | "pull-flv" | "pull-rfc4571" | "push-annexb" | "derived"; url?: string; codec?: string; resolution?: { width: number; height: numbe…
getBrokerStreams
query
Input
No fields besides deviceId.
Output
({ deviceId: number; profile: "high" | "mid" | "low"; brokerId: string; sourceCamStreamId: string | null; status: "unassigned" | "idle" | "connecting" | "streaming" | "error"; resolution?: { width: number; height: number…
getRtspEntries
query
Per-device RAW RTSP restream entries — one per published camStream that has RTSP restream enabled (native:main, rtsp:sub, …).
LIVE-VIEW ONLY. This is the surface the device-details stream picker uses so an operator can hit each physical stream directly. Programmatic / external consumers (HAP, Alexa, ha-mqtt, recording) MUST use getProfileRtspEntries instead — picking from raw variants makes two consumers of the same camera land on two different physical pulls (e.g. Reolink native:main vs rtsp:main) and trips the camera's concurrent-session limit.
Input
| Field | Type | Required | Description |
|---|---|---|---|
hostname | string | no | Override hostname embedded in returned URLs. Defaults to the broker's bound address. |
Output
({ brokerId: string; url: string; mutedUrl: string; enabled: boolean; codec?: string; resolution?: { width: number; height: number } })[]
getProfileRtspEntries
query
Per-device PROFILE RTSP restream entries — one per ASSIGNED profile slot (high/mid/low). Each entry's url is a profile-keyed broker restream that aliases the profile's assigned source broker, so HAP / Alexa / recording / WebRTC all converge on the broker's single on-demand pull for that profile. This is the supported exporter-facing surface; the raw getRtspEntries is live-view only. Returns [] for a device with no assigned profiles (cold-start before first publish).
Input
| Field | Type | Required | Description |
|---|---|---|---|
hostname | string | no | Override hostname embedded in returned URLs. Defaults to the broker's bound address. |
Output
({ profile: "high" | "mid" | "low"; brokerId: string; url: string; mutedUrl: string; enabled: boolean; codec?: string; resolution?: { width: number; height: number } })[]
pickStream
query
"Best source stream for these decode constraints". Returns the camStreamId the caller should dial (or null when no stream matches). See PickStreamRequirementsSchema for the filter shape and PickStreamPreferencesSchema for the ranking inputs.
Returning null instructs the caller to fall back to its existing path (derived-broker transcode, profile-slot pick, etc.) — the picker NEVER ranks derived:* candidates as a "match" because its whole job is to avoid the transcode.
Input
| Field | Type | Required | Description |
|---|---|---|---|
requirements | { acceptCodecs?: ("h264" | "h265" | "hevc" | "av1" | "mjpeg" | "vp8" | "vp9")[]; minHeight?: number; maxHeight?: number; minWidth?: number; excludeDerived?: boolean; requireSiblingCodec?: ("h264" | "h265" | "hevc" | "av1… | yes | |
preferences | { preferredProviders?: string[]; resolutionPreference?: "highest" | "lowest"; targetHeight?: number } | no |
Output
| Field | Type | Required | Description |
|---|---|---|---|
camStreamId | string | yes | |
codec | string | no | |
resolution | { width: number; height: number } | no | |
transcodes | boolean | yes | |
reason | string | yes | |
profile | "high" | "mid" | "low" | no | |
brokerId | string | no | |
url | string | no | |
fps | number | no | |
fpsSource | "published" | "measured" | no |
Runtime state
The state Dominevo keeps for each device with this capability, readable without calling the provider.
Per-device live stream-broker state. Persistent settings (RTSP tokens, profile assignments, pre-buffer config, RTSP-enabled toggles, streamingDebug) stay in the broker's addon store — they survive restarts. The slice below carries ONLY what's truly runtime:
online— at least one profile slot is currently'streaming'. Drivers without a firmware liveness signal (RTSP, ONVIF…) can subscribe and mirror this intostate.deviceStatus.online.slotStatuses— currentProfileSlotStatusper profile, mirroring the runtime-mutable subset ofProfileSlot.slotErrors— last error message per profile (only set when the corresponding slot is in'error').lastChangedAt— freshness signal for consumers that want to reason about how stale the slice is.
Written by the stream-broker manager on every transition that affects these aggregates. Read via device.state.cameraStreams.<field> (BaseDevice proxy) or, cross-process, via device-state.getCapSlice({deviceId, capName: 'camera-streams'}). The cap's onChanged event fires automatically on each write so subscribers get push semantics for free.
| Field | Type | Required | Description |
|---|---|---|---|
online | boolean | yes | |
slotStatuses | { high?: "unassigned" | "idle" | "connecting" | "streaming" | "error"; mid?: "unassigned" | "idle" | "connecting" | "streaming" | "error"; low?: "unassigned" | "idle" | "connecting" | "streaming" | "error" } | yes | |
slotErrors | { high?: string; mid?: string; low?: string } | yes | |
lastChangedAt | number | yes |
Events
onCamStreamsChanged
Fires on publishCameraStream / retractCameraStream.
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | yes | |
camStreams | ({ camStreamId: string; deviceId: number; kind: "pull-rtsp" | "pull-rtmp" | "pull-http" | "pull-flv" | "pull-rfc4571" | "push-annexb" | "derived"; url?: string; codec?: string; resolution?: { width: number; height: numbe… | yes |
onProfileSlotsChanged
Fires on assignProfile / unassignProfile / runtime status change.
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | yes | |
profileSlots | ({ deviceId: number; profile: "high" | "mid" | "low"; brokerId: string; sourceCamStreamId: string | null; status: "unassigned" | "idle" | "connecting" | "streaming" | "error"; resolution?: { width: number; height: number… | yes |