diff --git a/src/features/StreamPlayer/hooks/index.tsx b/src/features/StreamPlayer/hooks/index.tsx index e3a764ca..b107383a 100644 --- a/src/features/StreamPlayer/hooks/index.tsx +++ b/src/features/StreamPlayer/hooks/index.tsx @@ -202,19 +202,22 @@ export const useVideoPlayer = ({ const chaptersDuration = useDuration(chapters) - const duration = useMemo(() => (( - isLive - && chapters[0]?.isFullMatchChapter - && Number.isFinite(videoRefDurationMs) - ) - ? videoRefDurationMs - getActiveChapter().startOffsetMs - : chaptersDuration - ), [ + const duration = useMemo(() => { + if (isLive && chapters[0]?.isFullMatchChapter) { + if (isIOS) { + return fullMatchDuration - getActiveChapter().startOffsetMs + } if (Number.isFinite(videoRefDurationMs)) { + return videoRefDurationMs - getActiveChapter().startOffsetMs + } + } + return chaptersDuration + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [ chapters, chaptersDuration, + fullMatchDuration, getActiveChapter, isLive, - videoRefDurationMs, ]) const { @@ -688,7 +691,7 @@ export const useVideoPlayer = ({ buffering, chapters, currentPlayingOrder, - duration: duration || videoRefDurationMs, + duration, isFirstChapterPlaying, isFullscreen, isLastChapterPlaying,