From 7b57a66d45d78acc15d4bc54f36306a639fe7de8 Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Wed, 19 Jun 2024 06:09:49 -0600 Subject: [PATCH] Various UI tweaks (#12061) --- web/src/components/player/JSMpegPlayer.tsx | 7 +++++-- web/src/components/player/LivePlayer.tsx | 13 ++++++++++++- web/src/pages/Live.tsx | 13 ++++++++++++- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/web/src/components/player/JSMpegPlayer.tsx b/web/src/components/player/JSMpegPlayer.tsx index fd2a5382a..dc21d7d27 100644 --- a/web/src/components/player/JSMpegPlayer.tsx +++ b/web/src/components/player/JSMpegPlayer.tsx @@ -1,8 +1,9 @@ import { baseUrl } from "@/api/baseUrl"; import { useResizeObserver } from "@/hooks/resize-observer"; +import { cn } from "@/lib/utils"; // @ts-expect-error we know this doesn't have types import JSMpeg from "@cycjimmy/jsmpeg-player"; -import React, { useEffect, useMemo, useRef, useId } from "react"; +import React, { useEffect, useMemo, useRef, useId, useState } from "react"; type JSMpegPlayerProps = { className?: string; @@ -26,6 +27,7 @@ export default function JSMpegPlayer({ const videoRef = useRef(null); const internalContainerRef = useRef(null); const onPlayingRef = useRef(onPlaying); + const [showCanvas, setShowCanvas] = useState(false); const selectedContainerRef = useMemo( () => containerRef ?? internalContainerRef, @@ -101,6 +103,7 @@ export default function JSMpegPlayer({ audio: false, videoBufferSize: 1024 * 1024 * 4, onPlay: () => { + setShowCanvas(true); onPlayingRef.current?.(); }, }, @@ -110,7 +113,7 @@ export default function JSMpegPlayer({ return (
-
+
void; @@ -275,6 +276,16 @@ export default function LivePlayer({ />
+ {offline && !showStillWithoutActivity && ( +
+

+ {capitalizeFirstLetter(cameraConfig.name)} is offline +

+ +

No frames have been received, check error logs

+
+ )} +
{autoLive && !offline && @@ -282,7 +293,7 @@ export default function LivePlayer({ ((showStillWithoutActivity && !liveReady) || liveReady) && ( )} - {offline && ( + {offline && showStillWithoutActivity && ( diff --git a/web/src/pages/Live.tsx b/web/src/pages/Live.tsx index 5cee2c6ca..fc2a2bf8f 100644 --- a/web/src/pages/Live.tsx +++ b/web/src/pages/Live.tsx @@ -2,6 +2,7 @@ import { useFullscreen } from "@/hooks/use-fullscreen"; import { useHashState, usePersistedOverlayState, + useSearchEffect, } from "@/hooks/use-overlay-state"; import { FrigateConfig } from "@/types/frigateConfig"; import LiveBirdseyeView from "@/views/live/LiveBirdseyeView"; @@ -16,11 +17,21 @@ function Live() { // selection const [selectedCameraName, setSelectedCameraName] = useHashState(); - const [cameraGroup] = usePersistedOverlayState( + const [cameraGroup, setCameraGroup] = usePersistedOverlayState( "cameraGroup", "default" as string, ); + useSearchEffect("group", (cameraGroup) => { + if (config && cameraGroup) { + const group = config.camera_groups[cameraGroup]; + + if (group) { + setCameraGroup(cameraGroup); + } + } + }); + // fullscreen const mainRef = useRef(null);