Skip to content

Commit

Permalink
Merge pull request #1383 from elan-ev/eth-issue-316
Browse files Browse the repository at this point in the history
Fix aspect ratio video box size in Safari
  • Loading branch information
Arnei authored Jun 13, 2024
2 parents 44afe77 + 9374306 commit f9e0258
Showing 1 changed file with 38 additions and 18 deletions.
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

0 comments on commit f9e0258

Please sign in to comment.