Skip to content

Commit 15306a5

Browse files
committed
fix: progress reset issue fixed
1 parent b9f54f0 commit 15306a5

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

src/components/Slider.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ import { sliderStyles } from './styles';
66
interface SliderProps {
77
style?: ViewStyle;
88
duration: number;
9-
thumbs: number[];
9+
thumbs: [number, number];
1010
playbackTime: number;
11-
playbackDuration: number;
1211
tintColor?: string;
1312
onSlidingComplete: (segment: number[], value: number) => void;
1413
}
@@ -18,7 +17,6 @@ function Slider({
1817
duration,
1918
thumbs,
2019
playbackTime,
21-
playbackDuration,
2220
onSlidingComplete,
2321
tintColor,
2422
}: SliderProps) {
@@ -37,7 +35,7 @@ function Slider({
3735
])}
3836
minimumTrackTintColor={tintColor}
3937
renderMinimumTrackComponent={() => (
40-
<ProgressBar value={playbackTime / playbackDuration} />
38+
<ProgressBar value={playbackTime / thumbs[1]} />
4139
)}
4240
onSlidingComplete={onSlidingComplete}
4341
renderThumbComponent={() => (

src/components/VideoTrimmer.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ function VideoTrimmer(props: VideoTrimmerProps, ref: Ref<unknown>) {
3232
onSelected,
3333
} = props;
3434
const [playbackTime, setPlaybackTime] = useState<number>(0);
35-
const [playableDuration, setPlayableDuration] = useState<number>(0);
3635
const [duration, setDuration] = useState<number>(0);
3736
const [thumbs, setThumbs] = useState<[number, number]>([0, 0]);
3837
const videoRef = React.useRef<VideoRef | null>(null);
@@ -80,15 +79,11 @@ function VideoTrimmer(props: VideoTrimmerProps, ref: Ref<unknown>) {
8079
seek(thumbs[0]);
8180
};
8281

83-
const onProgress = ({
84-
currentTime,
85-
playableDuration: playableDurationTemp,
86-
}: OnProgressData) => {
82+
const onProgress = ({ currentTime }: OnProgressData) => {
8783
if (currentTime > thumbs[1]) {
8884
seek(thumbs[0]);
8985
}
9086
setPlaybackTime(currentTime);
91-
setPlayableDuration(playableDurationTemp);
9287
};
9388

9489
return (
@@ -109,7 +104,6 @@ function VideoTrimmer(props: VideoTrimmerProps, ref: Ref<unknown>) {
109104
thumbs={thumbs}
110105
duration={duration}
111106
playbackTime={playbackTime}
112-
playbackDuration={playableDuration}
113107
onSlidingComplete={onSlidingComplete}
114108
tintColor={tintColor}
115109
/>

0 commit comments

Comments
 (0)