Skip to content

Commit 5d7d7f2

Browse files
committed
fix: when switching video sources, persisting the trim selection
1 parent b31aa73 commit 5d7d7f2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/components/VideoTrimmer.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ function VideoTrimmerUI(props: VideoTrimmerProps, ref: Ref<unknown>) {
7676
const onLoad = (data: OnLoadData) => {
7777
// console.info('duration', data.duration);
7878
if (duration) {
79+
if (thumbs[0] !== 0) {
80+
seek(thumbs[0]);
81+
}
7982
return;
8083
}
8184
setDuration(data.duration);
@@ -85,7 +88,9 @@ function VideoTrimmerUI(props: VideoTrimmerProps, ref: Ref<unknown>) {
8588

8689
const onProgress = ({ currentTime }: OnProgressData) => {
8790
if (currentTime > thumbs[1]) {
88-
seek(thumbs[0]);
91+
if (loop) {
92+
seek(thumbs[0]);
93+
}
8994
}
9095
setPlaybackTime(currentTime);
9196
};

0 commit comments

Comments
 (0)