feat(cameras): large view opens in the tile's state (live tile → Live on the same stream, idle tile → Snapshot)
Build & push images / images (push) Successful in 3m56s
Build & push images / images (push) Successful in 3m56s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RZgP5oMncSaVmKRKk1UvN4
This commit is contained in:
@@ -12,10 +12,10 @@ import { createPlatformSocket } from "../lib/platform-ws.js";
|
|||||||
// chips in the device footer; docked bottom-right, the first opened rightmost and each
|
// chips in the device footer; docked bottom-right, the first opened rightmost and each
|
||||||
// next one to its left. A tile rests on the camera's newest entry/exit snapshot and
|
// next one to its left. A tile rests on the camera's newest entry/exit snapshot and
|
||||||
// switches to live video while that camera is seeing a vehicle (the server's per-camera
|
// switches to live video while that camera is seeing a vehicle (the server's per-camera
|
||||||
// activity, pushed over /api/ws). Clicking the picture opens a large view that streams
|
// activity, pushed over /api/ws). Clicking the picture opens a large view in the
|
||||||
// LIVE ON DEMAND (car or no car) with a Live / Snapshot switch; closing it returns the
|
// tile's state (live if the tile is live, else the snapshot), with a Live / Snapshot
|
||||||
// tile to automatic — a stream the user started stops, one the camera started carries
|
// switch that streams LIVE ON DEMAND, car or no car; closing it returns the tile to
|
||||||
// on. Live frames come over their own socket as JPEG binaries; only the newest frame is
|
// automatic — a stream the user started stops, one the camera started carries on. Live frames come over their own socket as JPEG binaries; only the newest frame is
|
||||||
// shown, and the tile and the large view share that one socket. Advisory viewing —
|
// shown, and the tile and the large view share that one socket. Advisory viewing —
|
||||||
// nothing here gates anything.
|
// nothing here gates anything.
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@ function CameraTile({
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
/** The camera is reporting a vehicle (server-side activity, 30 s after its last push). */
|
/** The camera is reporting a vehicle (server-side activity, 30 s after its last push). */
|
||||||
const active = useLiveStore((s) => s.activeCameras[deviceId] === true);
|
const active = useLiveStore((s) => s.activeCameras[deviceId] === true);
|
||||||
/** Large view open, and what the user picked in it (opens on "live"). */
|
/** Large view open, and what it shows (opens in the tile's state, then the user's pick). */
|
||||||
const [expanded, setExpanded] = useState(false);
|
const [expanded, setExpanded] = useState(false);
|
||||||
const [modalMode, setModalMode] = useState<"live" | "snapshot">("live");
|
const [modalMode, setModalMode] = useState<"live" | "snapshot">("live");
|
||||||
// Modal open → the user's choice rules; closed → automatic (live while a vehicle is in view).
|
// Modal open → the user's choice rules; closed → automatic (live while a vehicle is in view).
|
||||||
@@ -120,11 +120,13 @@ function CameraTile({
|
|||||||
✕
|
✕
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
{/* The picture is the expand control: a click opens the large view, live. */}
|
{/* The picture is the expand control: the large view opens showing what the tile
|
||||||
|
shows. Seeded from `active`, not from "a frame has arrived", so a camera-started
|
||||||
|
stream that is still connecting is not torn down by the click. */}
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setModalMode("live");
|
setModalMode(active ? "live" : "snapshot");
|
||||||
setExpanded(true);
|
setExpanded(true);
|
||||||
}}
|
}}
|
||||||
className="block w-full cursor-zoom-in"
|
className="block w-full cursor-zoom-in"
|
||||||
|
|||||||
@@ -21,10 +21,14 @@ verified end to end against the two park-lab cameras through the real server and
|
|||||||
- A tile rests on the **latest entry/exit snapshot** of that camera; when the camera's vehicle
|
- 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**.
|
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
|
- (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
|
**large view** with a **Live / Snapshot switch** whose Live streams **on demand** — car or no
|
||||||
switch**, so a camera-started stream can be stopped to look at the last snapshot and a
|
car — 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
|
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.
|
stream the user started stops; a stream the camera started carries on in the tile.
|
||||||
|
- (2026-11-17, third round) The large view **opens in the tile's state**: on Live when the camera
|
||||||
|
is active (the same stream carries on, no reconnect), else on the Snapshot. The choice then
|
||||||
|
holds while the view is open — a car leaving does not drop it to the snapshot, a car arriving
|
||||||
|
does not switch it to live.
|
||||||
|
|
||||||
### When the stream stops
|
### When the stream stops
|
||||||
|
|
||||||
@@ -111,7 +115,10 @@ resting on its camera's latest snapshot with direction and time; after the entry
|
|||||||
the entry tile went **LIVE** (live OSD clock); a reload restored both tiles; ✕ closed one and the
|
the entry tile went **LIVE** (live OSD clock); a reload restored both tiles; ✕ closed one and the
|
||||||
saved preference followed. Second round: the large view on an idle camera streamed live on
|
saved preference followed. Second round: the large view on an idle camera streamed live on
|
||||||
demand; Snapshot/Live switched both ways; closing it stopped the user's stream; on a camera-started
|
demand; Snapshot/Live switched both ways; closing it stopped the user's stream; on a camera-started
|
||||||
stream, Snapshot in the large view stopped it and closing the view resumed it in the tile.
|
stream, Snapshot in the large view stopped it and closing the view resumed it in the tile. Third round (no camera credentials
|
||||||
|
in that run, so no frames — the socket count and the switch state were checked): an idle tile opens
|
||||||
|
the large view on Snapshot with no socket; an active tile opens it on Live on the same socket (no
|
||||||
|
reconnect); the close rules held.
|
||||||
|
|
||||||
## Not yet verified
|
## Not yet verified
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user