mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-07-30 13:48:07 +02:00
Revert go2rtc call checks for enabled camera state (#17355)
* Revert "Fix camera enabled check (#17331)" This reverts commit1e45f63a7c
. * Revert "Fix webUI generating HTTP500s when camera disabled (#17305)" This reverts commit644faaf65b
.
This commit is contained in:
parent
7e8b3c389d
commit
983dd87ffb
@ -1,5 +1,4 @@
|
|||||||
import { useState, useCallback, useEffect, useMemo } from "react";
|
import { useState, useCallback, useEffect, useMemo } from "react";
|
||||||
import { useCameraActivity } from "@/hooks/use-camera-activity";
|
|
||||||
import { IoIosWarning } from "react-icons/io";
|
import { IoIosWarning } from "react-icons/io";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import {
|
import {
|
||||||
@ -24,7 +23,6 @@ import { Checkbox } from "@/components/ui/checkbox";
|
|||||||
import { Label } from "@/components/ui/label";
|
import { Label } from "@/components/ui/label";
|
||||||
import {
|
import {
|
||||||
FrigateConfig,
|
FrigateConfig,
|
||||||
CameraConfig,
|
|
||||||
GroupStreamingSettings,
|
GroupStreamingSettings,
|
||||||
StreamType,
|
StreamType,
|
||||||
} from "@/types/frigateConfig";
|
} from "@/types/frigateConfig";
|
||||||
@ -65,11 +63,6 @@ export function CameraStreamingDialog({
|
|||||||
|
|
||||||
// metadata
|
// metadata
|
||||||
|
|
||||||
// camera enabled state
|
|
||||||
const { enabled: isCameraEnabled } = useCameraActivity(
|
|
||||||
config?.cameras[camera] ?? ({} as CameraConfig),
|
|
||||||
);
|
|
||||||
|
|
||||||
const isRestreamed = useMemo(
|
const isRestreamed = useMemo(
|
||||||
() =>
|
() =>
|
||||||
config &&
|
config &&
|
||||||
@ -78,7 +71,7 @@ export function CameraStreamingDialog({
|
|||||||
);
|
);
|
||||||
|
|
||||||
const { data: cameraMetadata } = useSWR<LiveStreamMetadata>(
|
const { data: cameraMetadata } = useSWR<LiveStreamMetadata>(
|
||||||
isCameraEnabled && isRestreamed ? `go2rtc/streams/${streamName}` : null,
|
isRestreamed ? `go2rtc/streams/${streamName}` : null,
|
||||||
{
|
{
|
||||||
revalidateOnFocus: false,
|
revalidateOnFocus: false,
|
||||||
},
|
},
|
||||||
|
@ -112,7 +112,6 @@ import {
|
|||||||
SelectTrigger,
|
SelectTrigger,
|
||||||
} from "@/components/ui/select";
|
} from "@/components/ui/select";
|
||||||
import { usePersistence } from "@/hooks/use-persistence";
|
import { usePersistence } from "@/hooks/use-persistence";
|
||||||
import { useCameraActivity } from "@/hooks/use-camera-activity";
|
|
||||||
import { Label } from "@/components/ui/label";
|
import { Label } from "@/components/ui/label";
|
||||||
import { Switch } from "@/components/ui/switch";
|
import { Switch } from "@/components/ui/switch";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
@ -143,12 +142,8 @@ export default function LiveCameraView({
|
|||||||
const [{ width: windowWidth, height: windowHeight }] =
|
const [{ width: windowWidth, height: windowHeight }] =
|
||||||
useResizeObserver(window);
|
useResizeObserver(window);
|
||||||
|
|
||||||
// camera enabled state
|
|
||||||
const { enabled: isCameraEnabled } = useCameraActivity(
|
|
||||||
config?.cameras[camera.name] ?? ({} as CameraConfig),
|
|
||||||
);
|
|
||||||
|
|
||||||
// supported features
|
// supported features
|
||||||
|
|
||||||
const [streamName, setStreamName] = usePersistence<string>(
|
const [streamName, setStreamName] = usePersistence<string>(
|
||||||
`${camera.name}-stream`,
|
`${camera.name}-stream`,
|
||||||
Object.values(camera.live.streams)[0],
|
Object.values(camera.live.streams)[0],
|
||||||
@ -162,7 +157,7 @@ export default function LiveCameraView({
|
|||||||
);
|
);
|
||||||
|
|
||||||
const { data: cameraMetadata } = useSWR<LiveStreamMetadata>(
|
const { data: cameraMetadata } = useSWR<LiveStreamMetadata>(
|
||||||
isCameraEnabled && isRestreamed ? `go2rtc/streams/${streamName}` : null,
|
isRestreamed ? `go2rtc/streams/${streamName}` : null,
|
||||||
{
|
{
|
||||||
revalidateOnFocus: false,
|
revalidateOnFocus: false,
|
||||||
},
|
},
|
||||||
@ -197,6 +192,10 @@ export default function LiveCameraView({
|
|||||||
);
|
);
|
||||||
}, [cameraMetadata]);
|
}, [cameraMetadata]);
|
||||||
|
|
||||||
|
// camera enabled state
|
||||||
|
const { payload: enabledState } = useEnabledState(camera.name);
|
||||||
|
const cameraEnabled = enabledState === "ON";
|
||||||
|
|
||||||
// click overlay for ptzs
|
// click overlay for ptzs
|
||||||
|
|
||||||
const [clickOverlay, setClickOverlay] = useState(false);
|
const [clickOverlay, setClickOverlay] = useState(false);
|
||||||
@ -522,7 +521,7 @@ export default function LiveCameraView({
|
|||||||
setPip(false);
|
setPip(false);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
disabled={!isCameraEnabled}
|
disabled={!cameraEnabled}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{supports2WayTalk && (
|
{supports2WayTalk && (
|
||||||
@ -544,7 +543,7 @@ export default function LiveCameraView({
|
|||||||
setAudio(true);
|
setAudio(true);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
disabled={!isCameraEnabled}
|
disabled={!cameraEnabled}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{supportsAudioOutput && preferredLiveMode != "jsmpeg" && (
|
{supportsAudioOutput && preferredLiveMode != "jsmpeg" && (
|
||||||
@ -561,7 +560,7 @@ export default function LiveCameraView({
|
|||||||
t("button.cameraAudio", { ns: "common" })
|
t("button.cameraAudio", { ns: "common" })
|
||||||
}
|
}
|
||||||
onClick={() => setAudio(!audio)}
|
onClick={() => setAudio(!audio)}
|
||||||
disabled={!isCameraEnabled}
|
disabled={!cameraEnabled}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<FrigateCameraFeatures
|
<FrigateCameraFeatures
|
||||||
@ -583,7 +582,7 @@ export default function LiveCameraView({
|
|||||||
setLowBandwidth={setLowBandwidth}
|
setLowBandwidth={setLowBandwidth}
|
||||||
supportsAudioOutput={supportsAudioOutput}
|
supportsAudioOutput={supportsAudioOutput}
|
||||||
supports2WayTalk={supports2WayTalk}
|
supports2WayTalk={supports2WayTalk}
|
||||||
cameraEnabled={isCameraEnabled ?? false}
|
cameraEnabled={cameraEnabled}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</TooltipProvider>
|
</TooltipProvider>
|
||||||
|
Loading…
Reference in New Issue
Block a user