From 035fcd6d8653a7068e65a9a7180fe5f53c60aa5e Mon Sep 17 00:00:00 2001 From: an-lee Date: Sat, 20 Jul 2024 16:08:12 +0800 Subject: [PATCH] fix caption twinkle --- enjoy/src/renderer/components/medias/media-caption.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/enjoy/src/renderer/components/medias/media-caption.tsx b/enjoy/src/renderer/components/medias/media-caption.tsx index 5a0de7a6c..eb4a8d270 100644 --- a/enjoy/src/renderer/components/medias/media-caption.tsx +++ b/enjoy/src/renderer/components/medias/media-caption.tsx @@ -240,11 +240,13 @@ export const MediaCaption = () => { useEffect(() => { if (!caption) return; - const index = caption.timeline.findIndex( + let index = caption.timeline.findIndex( (w) => currentTime >= w.startTime && currentTime < w.endTime ); + if (index < 0) return; if (index !== activeIndex) { + console.log("setActiveIndex", index); setActiveIndex(index); } }, [currentTime, caption]);