--- type: decision tags: [parking, camera, ui, booth, video, hikvision] sources: [] updated: 2026-11-17 status: settled --- # Camera Live View — Booth Camera Tiles The booth operator can open a small tile per camera from the [[device-status-monitoring|device footer]] and watch that camera live while a vehicle is in front of it. **BUILT 2026-11-17**; verified end to end against the two park-lab cameras through the real server and in a browser (not yet in the [[desktop-shell-tauri|desktop shell]] — see *Not yet verified*). ## What the user asked for (2026-11-17) - The camera chips in the footer are clickable; a click opens that camera's tile in the bottom right, about 15 % of the screen wide. A second camera's tile stacks to the **left** of the first. - A tile closes with ✕; which tiles are open is a **user preference** (restored on login). - A tile rests on the **latest entry/exit snapshot** of that camera; when the camera's vehicle events reach the booth, it shows **live video**. - (2026-11-17, second round) Live shows a **pulsing green LIVE badge**. A click on the picture opens a **large view** that streams **live on demand** — car or no car — with a **Live / Snapshot switch**, so a camera-started stream can be stopped to look at the last snapshot and a snapshot can be switched to live. Closing the large view returns the tile to automatic: a stream the user started stops; a stream the camera started carries on in the tile. ### When the stream stops A tile streams while its camera is active — **30 s after the camera's last vehicle push** (`LANE_BUSY_TTL_MS`, shared with the lane lights; the camera re-pushes every 1–3 s while a car moves and every 15–25 s while it stands, so a waiting car keeps it live) — or while the large view is open on Live. It also stops on ✕, logout, or a dropped booth feed (resumes on reconnect). The camera session closes 5 s after the last viewer anywhere stops (RTSP TEARDOWN). No upper bound. The large live view is the 640×360 sub-stream scaled up; the Snapshot side shows the stored evidence still (full resolution when the camera's snapshot stream is Main). ## Decision | Question | Choice | Why | |---|---|---| | Video source | The camera's **sub-stream (x02) set to MJPEG**, pulled over **RTSP** | The G2 firmware answers the HTTP MJPEG preview (`/ISAPI/Streaming/channels/102/httpPreview`) with `notSupport`; RTSP offers MJPEG as RTP/JPEG (RFC 2435). Every MJPEG frame is a whole picture, so a view is live ~150 ms after connect — H.264 would wait for a keyframe (every 2.5–4 s on these cameras) and need a decoder. | | Where it runs | **In the server process**, as a driver capability (`LiveStreamDevice`) in `packages/devices` | No sidecar container (camera config + `localAddress` already live in the DB; the [[device-adapter-pattern]] keeps the protocol in the driver). The server reassembles JPEG frames from RTP packets — about 450 small packets/s for two cameras; it never decodes or re-encodes. | | Fan-out | **One RTSP session per camera**, shared by every viewer, torn down 5 s after the last leaves | A camera has few stream slots and the [[lane-presence-and-anpr-entry|ANPR loop]] pulls stills from the same unit. | | Delivery to the page | A **WebSocket per open tile** (`/api/cameras/:id/live`), one JPEG per binary message, **latest frame only**, capped at 10 fps per viewer | Works in the desktop shell, whose webview cannot carry the session cookie on an ``/`