diff --git a/frontend/src/components/player/AudioPlayer.tsx b/frontend/src/components/player/AudioPlayer.tsx index 1745548..fe445ab 100644 --- a/frontend/src/components/player/AudioPlayer.tsx +++ b/frontend/src/components/player/AudioPlayer.tsx @@ -115,7 +115,7 @@ export default function AudioPlayer() { : `${m}:${sec.toString().padStart(2, '0')}` } - const currentChapter = chapters.findLast?.((c: any) => currentTime >= c.start) || chapters[0] + const currentChapter = [...chapters].reverse().find((c: any) => currentTime >= c.start) || chapters[0] const addBookmark = async () => { if (!item) return diff --git a/frontend/src/components/player/ChapterList.tsx b/frontend/src/components/player/ChapterList.tsx index a270e9a..aef3200 100644 --- a/frontend/src/components/player/ChapterList.tsx +++ b/frontend/src/components/player/ChapterList.tsx @@ -17,7 +17,10 @@ export default function ChapterList({ chapters, currentTime, onSeek }: Props) { : `${m}:${sec.toString().padStart(2, '0')}` } - const active = chapters.findLastIndex?.((c) => currentTime >= c.start) ?? -1 + let active = -1 + for (let i = 0; i < chapters.length; i++) { + if (currentTime >= chapters[i].start) active = i + } return (