-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into screen-share-modification
- Loading branch information
Showing
21 changed files
with
476 additions
and
226 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
158 changes: 158 additions & 0 deletions
158
packages/roomkit-react/src/Prebuilt/components/HMSVideo/PlayPauseSeekControls.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
import React from 'react'; | ||
import { useMedia } from 'react-use'; | ||
import { BackwardArrowIcon, ForwardArrowIcon } from '@100mslive/react-icons'; | ||
import { Box, Flex } from '../../../Layout'; | ||
import { Text } from '../../../Text'; | ||
import { config } from '../../../Theme'; | ||
import { PlayPauseButton } from './PlayPauseButton'; | ||
import { SeekControl } from './SeekControl'; | ||
import { useIsLandscape } from '../../common/hooks'; | ||
|
||
// desktop buttons | ||
export const PlayPauseSeekControls = ({ | ||
isPaused, | ||
onSeekTo, | ||
}: { | ||
isPaused: boolean; | ||
onSeekTo: (value: number) => void; | ||
}) => { | ||
return ( | ||
<> | ||
<SeekControl | ||
onClick={e => { | ||
e.stopPropagation(); | ||
onSeekTo(-10); | ||
}} | ||
title="backward" | ||
> | ||
<BackwardArrowIcon width={20} height={20} /> | ||
</SeekControl> | ||
<PlayPauseButton isPaused={isPaused} /> | ||
<SeekControl | ||
onClick={e => { | ||
e.stopPropagation(); | ||
onSeekTo(10); | ||
}} | ||
title="forward" | ||
> | ||
<ForwardArrowIcon width={20} height={20} /> | ||
</SeekControl> | ||
</> | ||
); | ||
}; | ||
|
||
// overlay handlers | ||
export const PlayPauseSeekOverlayControls = ({ | ||
isPaused, | ||
showControls, | ||
hoverControlsVisible, | ||
}: { | ||
isPaused: boolean; | ||
showControls: boolean; | ||
hoverControlsVisible: { | ||
seekBackward: boolean; | ||
seekForward: boolean; | ||
pausePlay: boolean; | ||
}; | ||
}) => { | ||
const isMobile = useMedia(config.media.md); | ||
const isLandscape = useIsLandscape(); | ||
|
||
if (!isMobile && !isLandscape) { | ||
// show desktopOverflow icons | ||
return ( | ||
<> | ||
<Flex | ||
css={{ | ||
bg: 'rgba(0, 0, 0, 0.6)', | ||
r: '$round', | ||
size: '$24', | ||
visibility: hoverControlsVisible.seekBackward ? `` : `hidden`, | ||
opacity: hoverControlsVisible.seekBackward ? `1` : '0', | ||
}} | ||
direction="column" | ||
align="center" | ||
> | ||
<SeekControl title="backward"> | ||
<BackwardArrowIcon width={52} height={52} /> | ||
</SeekControl> | ||
<Text variant="body2" css={{ fontWeight: '$regular' }}> | ||
10 secs | ||
</Text> | ||
</Flex> | ||
<Box | ||
css={{ | ||
bg: 'rgba(0, 0, 0, 0.6)', | ||
r: '$round', | ||
visibility: hoverControlsVisible.pausePlay ? `` : `hidden`, | ||
opacity: hoverControlsVisible.pausePlay ? `1` : '0', | ||
}} | ||
> | ||
<PlayPauseButton isPaused={isPaused} width={48} height={48} /> | ||
</Box> | ||
<Flex | ||
css={{ | ||
bg: 'rgba(0, 0, 0, 0.6)', | ||
r: '$round', | ||
size: '$24', | ||
visibility: hoverControlsVisible.seekForward ? `` : `hidden`, | ||
opacity: hoverControlsVisible.seekForward ? `1` : '0', | ||
}} | ||
direction="column" | ||
align="center" | ||
> | ||
<SeekControl title="forward"> | ||
<ForwardArrowIcon width={52} height={52} /> | ||
</SeekControl> | ||
<Text variant="body2" css={{ fontWeight: '$regular' }}> | ||
10 secs | ||
</Text> | ||
</Flex> | ||
</> | ||
); | ||
} | ||
|
||
return ( | ||
<Flex | ||
align="center" | ||
justify="center" | ||
css={{ | ||
position: 'absolute', | ||
bg: '#00000066', | ||
display: 'inline-flex', | ||
gap: '$2', | ||
zIndex: 1, | ||
size: '100%', | ||
visibility: showControls ? `` : `hidden`, | ||
opacity: showControls ? `1` : '0', | ||
}} | ||
> | ||
<SeekControl | ||
title="backward" | ||
css={{ | ||
visibility: hoverControlsVisible.seekBackward ? `` : `hidden`, | ||
opacity: hoverControlsVisible.seekBackward ? `1` : '0', | ||
}} | ||
> | ||
<BackwardArrowIcon width={32} height={32} /> | ||
</SeekControl> | ||
<Box | ||
css={{ | ||
bg: 'rgba(0, 0, 0, 0.6)', | ||
r: '$round', | ||
}} | ||
> | ||
<PlayPauseButton isPaused={isPaused} width={48} height={48} /> | ||
</Box> | ||
<SeekControl | ||
title="forward" | ||
css={{ | ||
visibility: hoverControlsVisible.seekForward ? `` : `hidden`, | ||
opacity: hoverControlsVisible.seekForward ? `1` : '0', | ||
}} | ||
> | ||
<ForwardArrowIcon width={32} height={32} /> | ||
</SeekControl> | ||
</Flex> | ||
); | ||
}; |
4 changes: 2 additions & 2 deletions
4
...uilt/components/HMSVideo/SeekControls.tsx → ...built/components/HMSVideo/SeekControl.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.