integrate debug view

This commit is contained in:
Nicolas Mowen 2025-09-29 13:20:04 -06:00
parent a39f4b8192
commit cd8adcaaf4

View File

@ -110,6 +110,7 @@ import { useIsAdmin } from "@/hooks/use-is-admin";
import { Trans, useTranslation } from "react-i18next"; import { Trans, useTranslation } from "react-i18next";
import { useDocDomain } from "@/hooks/use-doc-domain"; import { useDocDomain } from "@/hooks/use-doc-domain";
import PtzControlPanel from "@/components/overlay/PtzControlPanel"; import PtzControlPanel from "@/components/overlay/PtzControlPanel";
import ObjectSettingsView from "../settings/ObjectSettingsView";
type LiveCameraViewProps = { type LiveCameraViewProps = {
config?: FrigateConfig; config?: FrigateConfig;
@ -271,6 +272,7 @@ export default function LiveCameraView({
); );
const [showStats, setShowStats] = useState(false); const [showStats, setShowStats] = useState(false);
const [debug, setDebug] = useState(false);
const [fullResolution, setFullResolution] = useState<VideoResolutionType>({ const [fullResolution, setFullResolution] = useState<VideoResolutionType>({
width: 0, width: 0,
@ -421,7 +423,11 @@ export default function LiveCameraView({
); );
return ( return (
<TransformWrapper minScale={1.0} wheel={{ smoothStep: 0.005 }}> <TransformWrapper
minScale={1.0}
wheel={{ smoothStep: 0.005 }}
disabled={debug}
>
<Toaster position="top-center" closeButton={true} /> <Toaster position="top-center" closeButton={true} />
<div <div
ref={mainRef} ref={mainRef}
@ -593,10 +599,66 @@ export default function LiveCameraView({
supportsAudioOutput={supportsAudioOutput} supportsAudioOutput={supportsAudioOutput}
supports2WayTalk={supports2WayTalk} supports2WayTalk={supports2WayTalk}
cameraEnabled={cameraEnabled} cameraEnabled={cameraEnabled}
debug={debug}
setDebug={setDebug}
/> />
</div> </div>
</div> </div>
<div id="player-container" className="size-full" ref={containerRef}> {!debug ? (
<div id="player-container" className="size-full" ref={containerRef}>
<TransformComponent
wrapperStyle={{
width: "100%",
height: "100%",
}}
contentStyle={{
position: "relative",
width: "100%",
height: "100%",
padding: "8px",
}}
>
<div
className={`flex flex-col items-center justify-center ${growClassName}`}
ref={clickOverlayRef}
onClick={handleOverlayClick}
style={{
aspectRatio: constrainedAspectRatio,
}}
>
<LivePlayer
key={camera.name}
className={`${fullscreen ? "*:rounded-none" : ""}`}
windowVisible
showStillWithoutActivity={false}
cameraConfig={camera}
playAudio={audio}
playInBackground={playInBackground ?? false}
showStats={showStats}
micEnabled={mic}
iOSCompatFullScreen={isIOS}
preferredLiveMode={preferredLiveMode}
useWebGL={true}
streamName={streamName ?? ""}
pip={pip}
containerRef={containerRef}
setFullResolution={setFullResolution}
onError={handleError}
/>
</div>
</TransformComponent>
{camera?.audio?.enabled_in_config &&
audioTranscriptionState == "ON" &&
transcription != null && (
<div
ref={transcriptionRef}
className="text-md scrollbar-container absolute bottom-4 left-1/2 max-h-[15vh] w-[75%] -translate-x-1/2 overflow-y-auto rounded-lg bg-black/70 p-2 text-white md:w-[50%]"
>
{transcription}
</div>
)}
</div>
) : (
<TransformComponent <TransformComponent
wrapperStyle={{ wrapperStyle={{
width: "100%", width: "100%",
@ -606,49 +668,11 @@ export default function LiveCameraView({
position: "relative", position: "relative",
width: "100%", width: "100%",
height: "100%", height: "100%",
padding: "8px",
}} }}
> >
<div <ObjectSettingsView selectedCamera={camera.name} />
className={`flex flex-col items-center justify-center ${growClassName}`}
ref={clickOverlayRef}
onClick={handleOverlayClick}
style={{
aspectRatio: constrainedAspectRatio,
}}
>
<LivePlayer
key={camera.name}
className={`${fullscreen ? "*:rounded-none" : ""}`}
windowVisible
showStillWithoutActivity={false}
cameraConfig={camera}
playAudio={audio}
playInBackground={playInBackground ?? false}
showStats={showStats}
micEnabled={mic}
iOSCompatFullScreen={isIOS}
preferredLiveMode={preferredLiveMode}
useWebGL={true}
streamName={streamName ?? ""}
pip={pip}
containerRef={containerRef}
setFullResolution={setFullResolution}
onError={handleError}
/>
</div>
</TransformComponent> </TransformComponent>
{camera?.audio?.enabled_in_config && )}
audioTranscriptionState == "ON" &&
transcription != null && (
<div
ref={transcriptionRef}
className="text-md scrollbar-container absolute bottom-4 left-1/2 max-h-[15vh] w-[75%] -translate-x-1/2 overflow-y-auto rounded-lg bg-black/70 p-2 text-white md:w-[50%]"
>
{transcription}
</div>
)}
</div>
</div> </div>
{camera.onvif.host != "" && ( {camera.onvif.host != "" && (
<div className="flex flex-col items-center justify-center"> <div className="flex flex-col items-center justify-center">
@ -719,6 +743,8 @@ type FrigateCameraFeaturesProps = {
supportsAudioOutput: boolean; supportsAudioOutput: boolean;
supports2WayTalk: boolean; supports2WayTalk: boolean;
cameraEnabled: boolean; cameraEnabled: boolean;
debug: boolean;
setDebug: (debug: boolean) => void;
}; };
function FrigateCameraFeatures({ function FrigateCameraFeatures({
camera, camera,
@ -739,6 +765,8 @@ function FrigateCameraFeatures({
supportsAudioOutput, supportsAudioOutput,
supports2WayTalk, supports2WayTalk,
cameraEnabled, cameraEnabled,
debug,
setDebug,
}: FrigateCameraFeaturesProps) { }: FrigateCameraFeaturesProps) {
const { t } = useTranslation(["views/live", "components/dialog"]); const { t } = useTranslation(["views/live", "components/dialog"]);
const { getLocaleDocUrl } = useDocDomain(); const { getLocaleDocUrl } = useDocDomain();
@ -1228,17 +1256,22 @@ function FrigateCameraFeatures({
})} })}
</p> </p>
</div> </div>
<div <div className="flex flex-col gap-1">
className="flex cursor-pointer flex-col gap-1" <div className="flex items-center justify-between">
onClick={() => <Label
navigate(`/settings?page=debug&camera=${camera.name}`) className="mx-0 cursor-pointer text-primary"
} htmlFor="debug"
> >
<div className="flex items-center justify-between text-sm font-medium leading-none"> {t("streaming.debugView", {
{t("streaming.debugView", { ns: "components/dialog",
ns: "components/dialog", })}
})} </Label>
<LuExternalLink className="ml-2 inline-flex size-5" /> <Switch
className="ml-1"
id="debug"
checked={debug}
onCheckedChange={(checked) => setDebug(checked)}
/>
</div> </div>
</div> </div>
</div> </div>