Skip to content

Commit

Permalink
Add a frame component for the player
Browse files Browse the repository at this point in the history
  • Loading branch information
ronnyroeller committed Oct 20, 2023
1 parent c93354b commit 9d7d54a
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/components/frame/PlayerFrame.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { makeStyles } from 'tss-react/mui';

export const useStyles = makeStyles()(theme => ({
playerFrame: {
position: 'absolute',
top: 0,
right: 0,
bottom: 0,
left: 0,
borderWidth: 1,
borderStyle: 'solid',
borderColor: theme.palette.divider,
// Ensures border width is included in the element's total width and height
boxSizing: 'border-box',
// Ensures any interactions like clicks go through this overlay to the underlying elements
pointerEvents: 'none',
// Overlay player
zIndex: 2,
},
}));

export interface PlayerFrameProps {
className?: string;
}
/**
* The frame is overlaying the media. This allows for translucent frames.
*/
export function PlayerFrame({ className }: PlayerFrameProps) {
const { classes, cx } = useStyles();
return <div className={cx(className, classes.playerFrame)} />;
}
1 change: 1 addition & 0 deletions src/components/frame/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './PlayerFrame';
1 change: 1 addition & 0 deletions src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export * from './controls/Controls';
export * from './core-player/CorePlayer';
export * from './core-player/types';
export * from './draggable-popover/DraggablePopover';
export * from './frame';
export * from './pip-controls';
export * from './play-pause-animation/PauseAnimation';
export * from './play-pause-animation/PlayAnimation';
Expand Down
2 changes: 2 additions & 0 deletions src/components/media-player/MediaPlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { CenteredReplayButton } from '../centered-replay-button/CenteredReplayBu
import { Controls } from '../controls/Controls';
import { useControlsStyles } from '../controls/useControlsStyles';
import { CorePlayer, CorePlayerProps } from '../core-player/CorePlayer';
import { PlayerFrame } from '../frame';
import { PauseAnimation } from '../play-pause-animation/PauseAnimation';
import { PlayAnimation } from '../play-pause-animation/PlayAnimation';
import { ProgressBar } from '../progress-bar/ProgressBar';
Expand All @@ -41,6 +42,7 @@ export const MediaPlayer: FC<MediaPlayerProps> = memo(
const { controls } = useControlsStyles().classes;
return (
<CorePlayer isPipEnabled={isPipEnabled} {...corePlayerProps}>
<PlayerFrame />
<Grid className={controls}>
<CenteredPlayButton />
</Grid>
Expand Down

0 comments on commit 9d7d54a

Please sign in to comment.