mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-06-04 01:16:52 +02:00
UI improvements (#11429)
* Respect classname when no preview is found * Don't check for go2rtc info if camera is not restramed * Show error banner when playback fails * Add keyboard shortcut for fullscreen
This commit is contained in:
parent
171a142adb
commit
c1560308bf
@ -285,6 +285,14 @@ export default function HlsVideoPlayer({
|
|||||||
) {
|
) {
|
||||||
setLoadedMetadata(false);
|
setLoadedMetadata(false);
|
||||||
setUseHlsCompat(true);
|
setUseHlsCompat(true);
|
||||||
|
} else {
|
||||||
|
toast.error(
|
||||||
|
// @ts-expect-error code does exist
|
||||||
|
`Failed to play recordings (error ${e.target.error.code}): ${e.target.error.message}`,
|
||||||
|
{
|
||||||
|
position: "top-center",
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
@ -82,7 +82,12 @@ export default function PreviewPlayer({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex size-full items-center justify-center rounded-lg text-white md:rounded-2xl">
|
<div
|
||||||
|
className={cn(
|
||||||
|
"flex size-full items-center justify-center rounded-lg text-white md:rounded-2xl",
|
||||||
|
className,
|
||||||
|
)}
|
||||||
|
>
|
||||||
No Preview Found
|
No Preview Found
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -143,6 +143,11 @@ export default function VideoControls({
|
|||||||
onSeek(10);
|
onSeek(10);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case "f":
|
||||||
|
if (setFullscreen && down && !repeat) {
|
||||||
|
setFullscreen(!fullscreen);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case "m":
|
case "m":
|
||||||
if (setMuted && down && !repeat && video) {
|
if (setMuted && down && !repeat && video) {
|
||||||
setMuted(!muted);
|
setMuted(!muted);
|
||||||
@ -157,10 +162,10 @@ export default function VideoControls({
|
|||||||
},
|
},
|
||||||
// only update when preview only changes
|
// only update when preview only changes
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
[video, isPlaying, onSeek],
|
[video, isPlaying, fullscreen, setFullscreen, onSeek],
|
||||||
);
|
);
|
||||||
useKeyboardListener(
|
useKeyboardListener(
|
||||||
hotKeys ? ["ArrowLeft", "ArrowRight", "m", " "] : [],
|
hotKeys ? ["ArrowLeft", "ArrowRight", "f", "m", " "] : [],
|
||||||
onKeyboardShortcut,
|
onKeyboardShortcut,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ function Live() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (selectedCamera) {
|
if (selectedCamera) {
|
||||||
return <LiveCameraView camera={selectedCamera} />;
|
return <LiveCameraView config={config} camera={selectedCamera} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -20,7 +20,7 @@ import {
|
|||||||
import { TooltipProvider } from "@/components/ui/tooltip";
|
import { TooltipProvider } from "@/components/ui/tooltip";
|
||||||
import { useResizeObserver } from "@/hooks/resize-observer";
|
import { useResizeObserver } from "@/hooks/resize-observer";
|
||||||
import useKeyboardListener from "@/hooks/use-keyboard-listener";
|
import useKeyboardListener from "@/hooks/use-keyboard-listener";
|
||||||
import { CameraConfig } from "@/types/frigateConfig";
|
import { CameraConfig, FrigateConfig } from "@/types/frigateConfig";
|
||||||
import { LiveStreamMetadata, VideoResolutionType } from "@/types/live";
|
import { LiveStreamMetadata, VideoResolutionType } from "@/types/live";
|
||||||
import { CameraPtzInfo } from "@/types/ptz";
|
import { CameraPtzInfo } from "@/types/ptz";
|
||||||
import { RecordingStartingPoint } from "@/types/record";
|
import { RecordingStartingPoint } from "@/types/record";
|
||||||
@ -75,9 +75,13 @@ import { TransformWrapper, TransformComponent } from "react-zoom-pan-pinch";
|
|||||||
import useSWR from "swr";
|
import useSWR from "swr";
|
||||||
|
|
||||||
type LiveCameraViewProps = {
|
type LiveCameraViewProps = {
|
||||||
|
config?: FrigateConfig;
|
||||||
camera: CameraConfig;
|
camera: CameraConfig;
|
||||||
};
|
};
|
||||||
export default function LiveCameraView({ camera }: LiveCameraViewProps) {
|
export default function LiveCameraView({
|
||||||
|
config,
|
||||||
|
camera,
|
||||||
|
}: LiveCameraViewProps) {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { isPortrait } = useMobileOrientation();
|
const { isPortrait } = useMobileOrientation();
|
||||||
const mainRef = useRef<HTMLDivElement | null>(null);
|
const mainRef = useRef<HTMLDivElement | null>(null);
|
||||||
@ -86,8 +90,17 @@ export default function LiveCameraView({ camera }: LiveCameraViewProps) {
|
|||||||
|
|
||||||
// supported features
|
// supported features
|
||||||
|
|
||||||
|
const isRestreamed = useMemo(
|
||||||
|
() =>
|
||||||
|
config &&
|
||||||
|
Object.keys(config.go2rtc.streams || {}).includes(
|
||||||
|
camera.live.stream_name,
|
||||||
|
),
|
||||||
|
[camera, config],
|
||||||
|
);
|
||||||
|
|
||||||
const { data: cameraMetadata } = useSWR<LiveStreamMetadata>(
|
const { data: cameraMetadata } = useSWR<LiveStreamMetadata>(
|
||||||
`go2rtc/streams/${camera.live.stream_name}`,
|
isRestreamed ? `go2rtc/streams/${camera.live.stream_name}` : null,
|
||||||
{
|
{
|
||||||
revalidateOnFocus: false,
|
revalidateOnFocus: false,
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user