Skip to content

Commit

Permalink
fix: remove useless isPlaying, fix hide/show controls video
Browse files Browse the repository at this point in the history
  • Loading branch information
WaDadidou committed Nov 6, 2023
1 parent 1cbe259 commit 942ed7a
Show file tree
Hide file tree
Showing 6 changed files with 193 additions and 150 deletions.
23 changes: 13 additions & 10 deletions packages/components/FilePreview/AudioView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,8 @@ export const AudioView: React.FC<{
const selectedNetwork = useSelectedNetworkInfo();
const userInfo = useNSUserInfo(authorId);
const { isDAO } = useIsDAO(authorId);
const {
media,
isPlaying,
handlePlayPause,
loadAndPlaySoundsQueue,
playbackStatus,
} = useMediaPlayer();
const { media, handlePlayPause, loadAndPlaySoundsQueue, playbackStatus } =
useMediaPlayer();
const isInMediaPlayer = useMemo(
() => media?.postId === postId,
[media?.postId, postId]
Expand Down Expand Up @@ -107,7 +102,9 @@ export const AudioView: React.FC<{
activeOpacity={0.9}
style={{
backgroundColor:
isInMediaPlayer && isPlaying ? secondaryColor : neutral00,
isInMediaPlayer && playbackStatus?.isPlaying
? secondaryColor
: neutral00,
height: 40,
width: 40,
borderRadius: 30,
Expand All @@ -116,10 +113,16 @@ export const AudioView: React.FC<{
}}
>
<SVG
source={isInMediaPlayer && isPlaying ? pauseSVG : playSVG}
source={
isInMediaPlayer && playbackStatus?.isPlaying ? pauseSVG : playSVG
}
width={24}
height={24}
color={isInMediaPlayer && isPlaying ? neutral00 : secondaryColor}
color={
isInMediaPlayer && playbackStatus?.isPlaying
? neutral00
: secondaryColor
}
/>
</TouchableOpacity>

Expand Down
5 changes: 3 additions & 2 deletions packages/components/mediaPlayer/MediaPlayerBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export const MediaPlayerBar: FC<{
const { contentWidth } = useMaxResolution();
const isMobile = useIsMobile();
const {
isPlaying,
handlePlayPause,
media,
isRandom,
Expand Down Expand Up @@ -113,7 +112,9 @@ export const MediaPlayerBar: FC<{
<CustomPressable onPress={handlePlayPause} disabled={!media}>
<SVG
source={
isPlaying && !playbackStatus?.didJustFinish ? PauseIcon : PlayIcon
playbackStatus?.isPlaying && !playbackStatus?.didJustFinish
? PauseIcon
: PlayIcon
}
height={28}
width={28}
Expand Down
3 changes: 1 addition & 2 deletions packages/components/mediaPlayer/MediaPlayerBarMobile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export const MediaPlayerBarMobile: FC<{
style?: StyleProp<ViewStyle>;
}> = ({ style }) => {
const {
isPlaying,
handlePlayPause,
media,
isRandom,
Expand Down Expand Up @@ -96,7 +95,7 @@ export const MediaPlayerBarMobile: FC<{
<CustomPressable onPress={handlePlayPause} disabled={!media}>
<SVG
source={
isPlaying && !playbackStatus?.didJustFinish
playbackStatus?.isPlaying && !playbackStatus?.didJustFinish
? PauseIcon
: PlayIcon
}
Expand Down
Loading

0 comments on commit 942ed7a

Please sign in to comment.