fix caption twinkle (#849)

This commit is contained in:
an-lee
2024-07-20 16:08:50 +08:00
committed by GitHub
parent 818fb8eb2b
commit fef5aac7b2

View File

@@ -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]);