Skip to content

Commit

Permalink
fix birdseye fullscreen (#11625)
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkeye217 authored May 29, 2024
1 parent 9e82028 commit 37dd3fc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion web/src/components/player/JSMpegPlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 12 additions & 12 deletions web/src/views/live/LiveBirdseyeView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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 />;
}
Expand Down Expand Up @@ -163,7 +163,7 @@ export default function LiveBirdseyeView() {
<div
className={growClassName}
style={{
aspectRatio: aspectRatio,
aspectRatio: constrainedAspectRatio,
}}
>
<BirdseyeLivePlayer
Expand Down

0 comments on commit 37dd3fc

Please sign in to comment.