From 5fce52a9fa238dc180004d61e9057e57bd88f83b Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Sun, 23 Mar 2025 13:33:45 -0500 Subject: [PATCH] ensure we always use an available stream --- web/src/views/live/DraggableGridLayout.tsx | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/web/src/views/live/DraggableGridLayout.tsx b/web/src/views/live/DraggableGridLayout.tsx index 2fc21357d..b80f59b27 100644 --- a/web/src/views/live/DraggableGridLayout.tsx +++ b/web/src/views/live/DraggableGridLayout.tsx @@ -549,9 +549,20 @@ export default function DraggableGridLayout({ } else { grow = "aspect-video"; } - const streamName = - currentGroupStreamingSettings?.[camera.name]?.streamName || - Object.values(camera.live.streams)[0]; + const availableStreams = camera.live.streams || {}; + const firstStreamEntry = Object.values(availableStreams)[0] || ""; + + const streamNameFromSettings = + currentGroupStreamingSettings?.[camera.name]?.streamName || ""; + const streamExists = + streamNameFromSettings && + Object.values(availableStreams).includes( + streamNameFromSettings, + ); + + const streamName = streamExists + ? streamNameFromSettings + : firstStreamEntry; const autoLive = currentGroupStreamingSettings?.[camera.name]?.streamType !== "no-streaming";