|
|
|
|
@ -115,10 +115,15 @@ export const useVideoPlayer = ({ |
|
|
|
|
const [isPausedTime, setIsPausedTime] = useState(false) |
|
|
|
|
const [pausedProgress, setPausedProgress] = useState(0) |
|
|
|
|
|
|
|
|
|
const getActiveChapter = useCallback( |
|
|
|
|
(index: number = activeChapterIndex) => chapters[index], |
|
|
|
|
[chapters, activeChapterIndex], |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
const chaptersDuration = useDuration(chapters) |
|
|
|
|
|
|
|
|
|
const duration = (isLive && chapters[0]?.isFullMatchChapter) |
|
|
|
|
? fullMatchDuration |
|
|
|
|
? fullMatchDuration - getActiveChapter().startOffsetMs |
|
|
|
|
: chaptersDuration |
|
|
|
|
|
|
|
|
|
const { |
|
|
|
|
@ -133,11 +138,6 @@ export const useVideoPlayer = ({ |
|
|
|
|
onPlaylistSelect(matchPlaylists.match[0]) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const getActiveChapter = useCallback( |
|
|
|
|
(index: number = activeChapterIndex) => chapters[index], |
|
|
|
|
[chapters, activeChapterIndex], |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
const { |
|
|
|
|
isFullscreen, |
|
|
|
|
onFullscreenClick, |
|
|
|
|
@ -245,7 +245,7 @@ export const useVideoPlayer = ({ |
|
|
|
|
setIsLiveTime(true) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const liveProgressMs = Math.max(duration - 30000, 0) |
|
|
|
|
const liveProgressMs = Math.max(fullMatchDuration - 30000, 0) |
|
|
|
|
setPlayerState({ playedProgress: liveProgressMs, seek: liveProgressMs / 1000 }) |
|
|
|
|
if (liveProgressMs > 0) setIsLiveTime(false) |
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
|
|
@ -333,7 +333,7 @@ export const useVideoPlayer = ({ |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
|
|
}, [isLive]) |
|
|
|
|
}, [isLive, chaptersProps[0].startOffsetMs]) |
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
if (((isLive || chapters[0].duration === chaptersProps[0].duration) |
|
|
|
|
|