feat: In Preview mode, you can jump in timeline to review the edits

In Preview mode, you can jump in timeline to review the edits, without having to listen to the full video.
This commit is contained in:
Yiannis Christodoulou
2025-06-11 04:12:24 +03:00
parent c989b1515e
commit 321287d009
3 changed files with 133 additions and 63 deletions
@@ -1035,6 +1035,23 @@ const useVideoTrimmer = () => {
};
}, [isPlayingSegments, currentSegmentIndex, clipSegments]);
// Effect to handle manual segment index updates during segments playback
useEffect(() => {
const handleSegmentIndexUpdate = (event: CustomEvent) => {
const { segmentIndex } = event.detail;
if (isPlayingSegments && segmentIndex !== currentSegmentIndex) {
logger.debug(`Updating current segment index from ${currentSegmentIndex} to ${segmentIndex}`);
setCurrentSegmentIndex(segmentIndex);
}
};
document.addEventListener('update-segment-index', handleSegmentIndexUpdate as EventListener);
return () => {
document.removeEventListener('update-segment-index', handleSegmentIndexUpdate as EventListener);
};
}, [isPlayingSegments, currentSegmentIndex]);
// Handle play segments
const handlePlaySegments = () => {
const video = videoRef.current;