mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-11 13:45:25 +03:00
Only use resolution for main camera
This commit is contained in:
parent
abb9ed9edc
commit
e6ba4ab79d
@ -38,3 +38,6 @@ export type RecordingStartingPoint = {
|
|||||||
startTime: number;
|
startTime: number;
|
||||||
severity: ReviewSeverity;
|
severity: ReviewSeverity;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const ASPECT_VERTICAL_LAYOUT = 1.5;
|
||||||
|
export const ASPECT_WIDE_LAYOUT = 2;
|
||||||
|
|||||||
@ -42,6 +42,7 @@ import Logo from "@/components/Logo";
|
|||||||
import { Skeleton } from "@/components/ui/skeleton";
|
import { Skeleton } from "@/components/ui/skeleton";
|
||||||
import { FaVideo } from "react-icons/fa";
|
import { FaVideo } from "react-icons/fa";
|
||||||
import { VideoResolutionType } from "@/types/live";
|
import { VideoResolutionType } from "@/types/live";
|
||||||
|
import { ASPECT_VERTICAL_LAYOUT, ASPECT_WIDE_LAYOUT } from "@/types/record";
|
||||||
|
|
||||||
const SEGMENT_DURATION = 30;
|
const SEGMENT_DURATION = 30;
|
||||||
|
|
||||||
@ -215,19 +216,19 @@ export function RecordingView({
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cam == mainCamera && fullResolution.width && fullResolution.height) {
|
||||||
|
return fullResolution.width / fullResolution.height;
|
||||||
|
}
|
||||||
|
|
||||||
const camera = config.cameras[cam];
|
const camera = config.cameras[cam];
|
||||||
|
|
||||||
if (!camera) {
|
if (!camera) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fullResolution.width && fullResolution.height) {
|
return camera.detect.width / camera.detect.height;
|
||||||
return fullResolution.width / fullResolution.height;
|
|
||||||
} else {
|
|
||||||
return camera.detect.width / camera.detect.height;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
[config, fullResolution],
|
[config, fullResolution, mainCamera],
|
||||||
);
|
);
|
||||||
|
|
||||||
const mainCameraAspect = useMemo(() => {
|
const mainCameraAspect = useMemo(() => {
|
||||||
@ -235,9 +236,9 @@ export function RecordingView({
|
|||||||
|
|
||||||
if (!aspectRatio) {
|
if (!aspectRatio) {
|
||||||
return "normal";
|
return "normal";
|
||||||
} else if (aspectRatio > 2) {
|
} else if (aspectRatio > ASPECT_WIDE_LAYOUT) {
|
||||||
return "wide";
|
return "wide";
|
||||||
} else if (aspectRatio < 16 / 9) {
|
} else if (aspectRatio < ASPECT_VERTICAL_LAYOUT) {
|
||||||
return "tall";
|
return "tall";
|
||||||
} else {
|
} else {
|
||||||
return "normal";
|
return "normal";
|
||||||
|
|||||||
@ -167,7 +167,7 @@ export default function LiveCameraView({ camera }: LiveCameraViewProps) {
|
|||||||
if (isPortrait) {
|
if (isPortrait) {
|
||||||
return "absolute left-2 right-2 top-[50%] -translate-y-[50%]";
|
return "absolute left-2 right-2 top-[50%] -translate-y-[50%]";
|
||||||
} else {
|
} else {
|
||||||
if (aspect > 16 / 9) {
|
if (aspect > 1.5) {
|
||||||
return "p-2 absolute left-0 top-[50%] -translate-y-[50%]";
|
return "p-2 absolute left-0 top-[50%] -translate-y-[50%]";
|
||||||
} else {
|
} else {
|
||||||
return "p-2 absolute top-2 bottom-2 left-[50%] -translate-x-[50%]";
|
return "p-2 absolute top-2 bottom-2 left-[50%] -translate-x-[50%]";
|
||||||
@ -176,7 +176,7 @@ export default function LiveCameraView({ camera }: LiveCameraViewProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (fullscreen) {
|
if (fullscreen) {
|
||||||
if (aspect > 16 / 9) {
|
if (aspect > 1.5) {
|
||||||
return "absolute inset-x-2 top-[50%] -translate-y-[50%]";
|
return "absolute inset-x-2 top-[50%] -translate-y-[50%]";
|
||||||
} else {
|
} else {
|
||||||
return "absolute inset-y-2 left-[50%] -translate-x-[50%]";
|
return "absolute inset-y-2 left-[50%] -translate-x-[50%]";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user