mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
fix birdseye fullscreen (#11625)
This commit is contained in:
parent
9e8202874e
commit
37dd3fc25b
@ -49,7 +49,7 @@ export default function JSMpegPlayer({
|
|||||||
selectedContainerRef.current?.clientHeight,
|
selectedContainerRef.current?.clientHeight,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: aspectRatio > fitAspect
|
: aspectRatio >= fitAspect
|
||||||
? Math.floor(containerWidth / aspectRatio)
|
? Math.floor(containerWidth / aspectRatio)
|
||||||
: Math.floor(containerWidth / aspectRatio) / 1.5;
|
: Math.floor(containerWidth / aspectRatio) / 1.5;
|
||||||
const finalHeight = stretch
|
const finalHeight = stretch
|
||||||
|
@ -48,12 +48,22 @@ export default function LiveBirdseyeView() {
|
|||||||
|
|
||||||
const containerAspectRatio = useMemo(() => {
|
const containerAspectRatio = useMemo(() => {
|
||||||
if (!containerRef.current) {
|
if (!containerRef.current) {
|
||||||
return windowAspectRatio;
|
return windowAspectRatio ?? 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return containerRef.current.clientWidth / containerRef.current.clientHeight;
|
return containerRef.current.clientWidth / containerRef.current.clientHeight;
|
||||||
}, [windowAspectRatio, containerRef]);
|
}, [windowAspectRatio, containerRef]);
|
||||||
|
|
||||||
|
const constrainedAspectRatio = useMemo<number>(() => {
|
||||||
|
if (isMobile || fullscreen) {
|
||||||
|
return cameraAspectRatio;
|
||||||
|
} else {
|
||||||
|
return containerAspectRatio < cameraAspectRatio
|
||||||
|
? containerAspectRatio
|
||||||
|
: cameraAspectRatio;
|
||||||
|
}
|
||||||
|
}, [cameraAspectRatio, containerAspectRatio, fullscreen]);
|
||||||
|
|
||||||
const growClassName = useMemo(() => {
|
const growClassName = useMemo(() => {
|
||||||
if (isMobile) {
|
if (isMobile) {
|
||||||
if (isPortrait) {
|
if (isPortrait) {
|
||||||
@ -90,16 +100,6 @@ export default function LiveBirdseyeView() {
|
|||||||
return "mse";
|
return "mse";
|
||||||
}, [config]);
|
}, [config]);
|
||||||
|
|
||||||
const aspectRatio = useMemo<number>(() => {
|
|
||||||
if (isMobile || fullscreen) {
|
|
||||||
return cameraAspectRatio;
|
|
||||||
} else {
|
|
||||||
return containerAspectRatio < cameraAspectRatio
|
|
||||||
? containerAspectRatio
|
|
||||||
: cameraAspectRatio;
|
|
||||||
}
|
|
||||||
}, [cameraAspectRatio, containerAspectRatio, fullscreen]);
|
|
||||||
|
|
||||||
if (!config) {
|
if (!config) {
|
||||||
return <ActivityIndicator />;
|
return <ActivityIndicator />;
|
||||||
}
|
}
|
||||||
@ -163,7 +163,7 @@ export default function LiveBirdseyeView() {
|
|||||||
<div
|
<div
|
||||||
className={growClassName}
|
className={growClassName}
|
||||||
style={{
|
style={{
|
||||||
aspectRatio: aspectRatio,
|
aspectRatio: constrainedAspectRatio,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<BirdseyeLivePlayer
|
<BirdseyeLivePlayer
|
||||||
|
Loading…
Reference in New Issue
Block a user