Revert "feat(in-132): videoplayer bugfix"

This reverts commit 44e70269ba.
pull/1/head
Andrei Dekterev 3 years ago
parent 6c4bb15a4a
commit c18009f2d8
  1. 4
      src/features/MatchPage/store/hooks/index.tsx
  2. 6
      src/features/StreamPlayer/hooks/index.tsx
  3. 18
      src/features/StreamPlayer/hooks/useHlsPlayer.tsx

@ -57,11 +57,11 @@ export const useMatchPage = () => {
let getIntervalMatch: ReturnType<typeof setInterval>
if (matchProfile?.live && !matchProfile.youtube_link) {
getIntervalMatch = setInterval(
() => getMatchInfo(sportType, matchId).then(setMatchProfile), 5000,
() => getMatchInfo(sportType, matchId).then(setMatchProfile), 1000 * 60 * 3,
)
}
return () => clearInterval(getIntervalMatch)
})
}, [matchProfile, sportType, matchId])
const {
events,

@ -102,11 +102,7 @@ export const useVideoPlayer = ({
const { url } = chapters[0] ?? { url: '' }
const numberOfChapters = size(chapters)
const { hls, videoRef } = useHlsPlayer({
isLive,
resumeFrom,
src: url,
})
const { hls, videoRef } = useHlsPlayer(url, resumeFrom)
const [isLiveTime, setIsLiveTime] = useState(false)
const [isPausedTime, setIsPausedTime] = useState(false)
const [pausedProgress, setPausedProgress] = useState(0)

@ -9,17 +9,7 @@ import isNumber from 'lodash/isNumber'
import { streamConfig } from '../config'
type useHlsPlayerType = {
isLive?: boolean,
resumeFrom?: number,
src: string,
}
export const useHlsPlayer = ({
isLive,
resumeFrom,
src,
}: useHlsPlayerType) => {
export const useHlsPlayer = (src: string, resumeFrom?: number) => {
const hls = useMemo(() => {
if (!Hls.isSupported()) return null
@ -29,11 +19,7 @@ export const useHlsPlayer = ({
}
return new Hls(newStreamConfig)
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [
resumeFrom,
src,
isLive,
])
}, [resumeFrom, src])
const videoRef = useRef<HTMLVideoElement>(null)

Loading…
Cancel
Save