diff --git a/web/src/components/player/LivePlayer.tsx b/web/src/components/player/LivePlayer.tsx index fbdff3200..fdcea8afc 100644 --- a/web/src/components/player/LivePlayer.tsx +++ b/web/src/components/player/LivePlayer.tsx @@ -17,6 +17,7 @@ import { cn } from "@/lib/utils"; type LivePlayerProps = { cameraRef?: (ref: HTMLDivElement | null) => void; + containerRef?: React.MutableRefObject; className?: string; cameraConfig: CameraConfig; preferredLiveMode?: LivePlayerMode; @@ -26,13 +27,14 @@ type LivePlayerProps = { micEnabled?: boolean; // only webrtc supports mic iOSCompatFullScreen?: boolean; pip?: boolean; + autoLive?: boolean; onClick?: () => void; setFullResolution?: React.Dispatch>; - containerRef?: React.MutableRefObject; }; export default function LivePlayer({ cameraRef = undefined, + containerRef, className, cameraConfig, preferredLiveMode, @@ -42,9 +44,9 @@ export default function LivePlayer({ micEnabled = false, iOSCompatFullScreen = false, pip, + autoLive = true, onClick, setFullResolution, - containerRef, }: LivePlayerProps) { // camera activity @@ -64,6 +66,10 @@ export default function LivePlayer({ const [liveReady, setLiveReady] = useState(false); useEffect(() => { + if (!autoLive) { + return; + } + if (!liveReady) { if (cameraActive && liveMode == "jsmpeg") { setLiveReady(true); @@ -77,7 +83,7 @@ export default function LivePlayer({ } // live mode won't change // eslint-disable-next-line react-hooks/exhaustive-deps - }, [cameraActive, liveReady]); + }, [autoLive, cameraActive, liveReady]); // camera still state @@ -91,18 +97,31 @@ export default function LivePlayer({ } if (activeMotion || activeTracking) { - return 200; + if (autoLive) { + return 200; + } else { + return 59000; + } } return 30000; - }, [liveReady, activeMotion, activeTracking, offline, windowVisible]); + }, [ + autoLive, + liveReady, + activeMotion, + activeTracking, + offline, + windowVisible, + ]); if (!cameraConfig) { return ; } let player; - if (liveMode == "webrtc") { + if (!autoLive) { + player = null; + } else if (liveMode == "webrtc") { player = ( (null); // recent events + const { payload: eventUpdate } = useFrigateReviews(); const { data: allEvents, mutate: updateEvents } = useSWR([ "review", @@ -92,6 +93,7 @@ export default function LiveDashboardView({ // camera live views + const [autoLiveView] = usePersistence("autoLiveView"); const [windowVisible, setWindowVisible] = useState(true); const visibilityListener = useCallback(() => { setWindowVisible(document.visibilityState == "visible"); diff --git a/web/src/views/settings/GeneralSettingsVIew.tsx b/web/src/views/settings/GeneralSettingsVIew.tsx index 57c110fb2..4f7ad94f0 100644 --- a/web/src/views/settings/GeneralSettingsVIew.tsx +++ b/web/src/views/settings/GeneralSettingsVIew.tsx @@ -49,6 +49,9 @@ export default function GeneralSettingsView() { document.title = "General Settings - Frigate"; }, []); + // settings + + const [autoLive, setAutoLive] = usePersistence("autoLiveView", true); const [playbackRate, setPlaybackRate] = usePersistence("playbackRate", 1); return ( @@ -60,7 +63,33 @@ export default function GeneralSettingsView() { General Settings -
+ + + + Dashboard + + +
+
+
+ + +
+
+

+ Automatically switch to live view when motion is detected. +

+
+
+
+ +
Stored Layouts
@@ -72,11 +101,15 @@ export default function GeneralSettingsView() {

-
- -
+
+ + + + Recordings Viewer + +
Default Playback Rate
@@ -107,26 +140,6 @@ export default function GeneralSettingsView() { -
-
-
Low Data Mode
-
-

- Not yet implemented. Default: disabled -

-
-
-
- {}} - /> - -
-
diff --git a/web/src/views/settings/MasksAndZonesView.tsx b/web/src/views/settings/MasksAndZonesView.tsx index 6fea1b91b..09e8343ac 100644 --- a/web/src/views/settings/MasksAndZonesView.tsx +++ b/web/src/views/settings/MasksAndZonesView.tsx @@ -9,7 +9,7 @@ import { useRef, useState, } from "react"; -import { PolygonCanvas } from "./PolygonCanvas"; +import { PolygonCanvas } from "@/components/settings/PolygonCanvas"; import { Polygon, PolygonType } from "@/types/canvas"; import { interpolatePoints, parseCoordinates } from "@/utils/canvasUtil"; import { Skeleton } from "@/components/ui/skeleton";