fix birdseye fullscreen (#11625)

This commit is contained in:
Josh Hawkins 2024-05-29 14:18:51 -05:00 committed by GitHub
parent 9e8202874e
commit 37dd3fc25b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 13 deletions

View File

@ -49,7 +49,7 @@ export default function JSMpegPlayer({
selectedContainerRef.current?.clientHeight,
),
)
: aspectRatio > fitAspect
: aspectRatio >= fitAspect
? Math.floor(containerWidth / aspectRatio)
: Math.floor(containerWidth / aspectRatio) / 1.5;
const finalHeight = stretch

View File

@ -48,12 +48,22 @@ export default function LiveBirdseyeView() {
const containerAspectRatio = useMemo(() => {
if (!containerRef.current) {
return windowAspectRatio;
return windowAspectRatio ?? 0;
}
return containerRef.current.clientWidth / containerRef.current.clientHeight;
}, [windowAspectRatio, containerRef]);
const constrainedAspectRatio = useMemo<number>(() => {
if (isMobile || fullscreen) {
return cameraAspectRatio;
} else {
return containerAspectRatio < cameraAspectRatio
? containerAspectRatio
: cameraAspectRatio;
}
}, [cameraAspectRatio, containerAspectRatio, fullscreen]);
const growClassName = useMemo(() => {
if (isMobile) {
if (isPortrait) {
@ -90,16 +100,6 @@ export default function LiveBirdseyeView() {
return "mse";
}, [config]);
const aspectRatio = useMemo<number>(() => {
if (isMobile || fullscreen) {
return cameraAspectRatio;
} else {
return containerAspectRatio < cameraAspectRatio
? containerAspectRatio
: cameraAspectRatio;
}
}, [cameraAspectRatio, containerAspectRatio, fullscreen]);
if (!config) {
return <ActivityIndicator />;
}
@ -163,7 +163,7 @@ export default function LiveBirdseyeView() {
<div
className={growClassName}
style={{
aspectRatio: aspectRatio,
aspectRatio: constrainedAspectRatio,
}}
>
<BirdseyeLivePlayer