Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI improvements #11429

Merged
merged 4 commits into from
May 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Prev Previous commit
Next Next commit
Don't check for go2rtc info if camera is not restramed
  • Loading branch information
NickM-27 committed May 19, 2024
commit 66a903bf9d64172c067f48570b410b5975780167
2 changes: 1 addition & 1 deletion web/src/pages/Live.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function Live() {
}

if (selectedCamera) {
return <LiveCameraView camera={selectedCamera} />;
return <LiveCameraView config={config} camera={selectedCamera} />;
}

return (
Expand Down
19 changes: 16 additions & 3 deletions web/src/views/live/LiveCameraView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
import { TooltipProvider } from "@/components/ui/tooltip";
import { useResizeObserver } from "@/hooks/resize-observer";
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 { CameraPtzInfo } from "@/types/ptz";
import { RecordingStartingPoint } from "@/types/record";
Expand Down Expand Up @@ -75,9 +75,13 @@ import { TransformWrapper, TransformComponent } from "react-zoom-pan-pinch";
import useSWR from "swr";

type LiveCameraViewProps = {
config?: FrigateConfig;
camera: CameraConfig;
};
export default function LiveCameraView({ camera }: LiveCameraViewProps) {
export default function LiveCameraView({
config,
camera,
}: LiveCameraViewProps) {
const navigate = useNavigate();
const { isPortrait } = useMobileOrientation();
const mainRef = useRef<HTMLDivElement | null>(null);
Expand All @@ -86,8 +90,17 @@ export default function LiveCameraView({ camera }: LiveCameraViewProps) {

// supported features

const isRestreamed = useMemo(
() =>
config &&
Object.keys(config.go2rtc.streams || {}).includes(
camera.live.stream_name,
),
[camera, config],
);

const { data: cameraMetadata } = useSWR<LiveStreamMetadata>(
`go2rtc/streams/${camera.live.stream_name}`,
isRestreamed ? `go2rtc/streams/${camera.live.stream_name}` : null,
{
revalidateOnFocus: false,
},
Expand Down