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

Fix aspect ratio video box size in Safari #1383

Merged
merged 3 commits into from
Jun 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 38 additions & 18 deletions src/main/VideoPlayers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -399,27 +399,47 @@ export const VideoPlayer = React.forwardRef<VideoPlayerForwardRef, VideoPlayerPr
...(last) && { borderBottomRightRadius: "5px" },
});

const videoPlayerWrapperStyles = css({
height: "100%",
width: "100%",
display: "flex",

// For single video, center!
...(first && last) && { justifyContent: "center" },

// For multi videos, first from right side, sitting on end
...(first && !last) && { justifyContent: "end" },

// For multi videos, last from right side, sitting on start
...(last && !first) && { justifyContent: "start" },

// For multi videos, in between, fit content and center!
...(!first && !last) && { justifyContent: "center", flexBasis: "fit-content" },
});

const render = () => {
if (!errorState) {
return (
<ReactPlayer url={url}
css={[backgroundBoxStyle(theme), reactPlayerStyle]}
ref={ref}
width="unset"
height="unset"
playing={isPlaying}
volume={volume}
muted={!isPrimary || isMuted}
onProgress={onProgressCallback}
progressInterval={100}
onReady={onReadyCallback}
onPlay={onPlay}
onEnded={onEndedCallback}
onError={onErrorCallback}
tabIndex={-1}
config={playerConfig}
disablePictureInPicture
/>
<div css={videoPlayerWrapperStyles}>
<ReactPlayer url={url}
css={[backgroundBoxStyle(theme), reactPlayerStyle]}
ref={ref}
width="unset"
height="100%"
playing={isPlaying}
volume={volume}
muted={!isPrimary || isMuted}
onProgress={onProgressCallback}
progressInterval={100}
onReady={onReadyCallback}
onPlay={onPlay}
onEnded={onEndedCallback}
onError={onErrorCallback}
tabIndex={-1}
config={playerConfig}
disablePictureInPicture
/>
</div>
);
} else {
return (
Expand Down
Loading