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