Share the K1 live scene template and preserve idle media channels

This commit is contained in:
DCCONSTRUCTIONS
2026-09-07 16:38:39 +03:00
parent 309bdf759e
commit fa8ac760a1
49 changed files with 2813 additions and 2126 deletions
@@ -151,9 +151,21 @@ class NodeK1Sensor:
await self.peers.close(params.get("peer_id"))
return {"ok": True}
if action == "offer":
if item["snapshot"]["acquisition"] != "streaming":
raise ValueError("Acquisition is not active")
return await self.peers.offer(params)
acquisition_id = item["control"]["acquisition_id"]
if (item["snapshot"]["acquisition"] != "streaming" or not acquisition_id
or params.get("acquisition_id") != acquisition_id):
raise ValueError("Acquisition is not active or changed")
answer = await self.peers.offer(params)
# Signalling may outlive STOP or a replacement acquisition. Retire
# that disposable preview instead of attaching it to another run.
current = project_sensor(await self.raw_state(), node_id)
if (current is None or current["snapshot"]["acquisition"] != "streaming"
or current["snapshot"]["context"]["session_id"]
!= command["session"]["session_id"]
or current["control"]["acquisition_id"] != acquisition_id):
await self.peers.close(answer["peer_id"])
raise ValueError("Acquisition changed during preview signalling")
return answer
async with self.bridge.lock:
if datetime.fromisoformat(command["deadline_at"]) <= datetime.now(UTC):
raise ValueError("Command expired before dispatch")