Skip to content

Commit

Permalink
feat: seek video on non played ones, make videos paused when not curr…
Browse files Browse the repository at this point in the history
…ent story
  • Loading branch information
JonatanSalas committed Dec 8, 2020
1 parent e14e5f6 commit a2fbada
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/StoryDetailItem/hook.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@ export const useStoryDetailItem = ({
useEffect(() => {
if (isCurrentStory) {
setPaused(false);
} else {
setPaused(true);
setProgress(0);
videoRef.current?.seek(0);
}
}, [isCurrentStory]);
}, [isCurrentStory, videoRef]);

const mute = () => setMuted((m) => !m);

Expand Down
1 change: 1 addition & 0 deletions src/components/StoryDetailItem/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export const StoryDetailItem = React.forwardRef<any, StoryDetailItemProps>(
muted={muted}
controls={false}
resizeMode="cover"
playInBackground={false}
style={styles.container}
source={getVideoSource(story)}
paused={paused}
Expand Down

0 comments on commit a2fbada

Please sign in to comment.