fix(#1701): fix red line

keep-around/fdb88b04b32b9392e76795099e2ec47c9856b38b
Andrei Dekterev 4 years ago committed by Andrei Dekterev
parent 602050f347
commit 4330dd7d74
  1. 1
      src/features/MatchPage/store/hooks/useEvents.tsx
  2. 4
      src/features/MatchPopup/types.tsx
  3. 2
      src/features/StreamPlayer/components/ProgressBar/helpers/calculateChapterStyles/index.tsx
  4. 9
      src/features/StreamPlayer/hooks/index.tsx

@ -18,6 +18,7 @@ export const useEvents = () => {
sportType, sportType,
}).then(fetchLexics) }).then(fetchLexics)
.then(setEvents) .then(setEvents)
.catch(() => setEvents([]))
}, [ }, [
fetchLexics, fetchLexics,
matchId, matchId,

@ -38,8 +38,8 @@ export type SettingsBySport = Partial<Record<SportTypes, Settings>>
export const defaultSettings: Settings = { export const defaultSettings: Settings = {
episodeDuration: { episodeDuration: {
after: 20, after: 30,
before: 6, before: 10,
}, },
selectedActions: [], selectedActions: [],
selectedFormat: PlayerPlaylistFormats.ALL_MATCH_TIME, selectedFormat: PlayerPlaylistFormats.ALL_MATCH_TIME,

@ -49,7 +49,7 @@ export const calculateChapterStyles = ({
const activeChapter = { const activeChapter = {
...chapter, ...chapter,
loaded: calculateChapterProgress(loadedProgress, chapter), loaded: calculateChapterProgress(loadedProgress, chapter),
played: calculateChapterProgress(playedProgress, chapter), played: playedProgress * 100 / videoDuration,
width: chapter.isFullMatchChapter width: chapter.isFullMatchChapter
? 100 ? 100
: chapter.duration * 100 / videoDuration, : chapter.duration * 100 / videoDuration,

@ -121,7 +121,7 @@ export const useVideoPlayer = ({
const rewindForward = () => { const rewindForward = () => {
const chapter = getActiveChapter() const chapter = getActiveChapter()
const newProgress = playedProgress + REWIND_SECONDS * 1000 const newProgress = playedProgress + REWIND_SECONDS * 1000
if (newProgress <= chapter.duration) { if (newProgress <= chapter.duration || isLive) {
seekTo(chapter.startOffsetMs + newProgress) seekTo(chapter.startOffsetMs + newProgress)
} else if (isLastChapterPlaying) { } else if (isLastChapterPlaying) {
playNextChapter() playNextChapter()
@ -158,9 +158,6 @@ export const useVideoPlayer = ({
const onWaiting = () => { const onWaiting = () => {
setPlayerState({ buffering: true }) setPlayerState({ buffering: true })
if (!playing) {
setPlayerState({ buffering: false })
}
} }
const onPlaying = () => { const onPlaying = () => {
@ -221,6 +218,10 @@ export const useVideoPlayer = ({
useEffect(() => { useEffect(() => {
onPlayingChange(playing) onPlayingChange(playing)
if (playing) {
setPlayerState({ buffering: false })
}
// eslint-disable-next-line
}, [playing, onPlayingChange]) }, [playing, onPlayingChange])
useEffect(() => { useEffect(() => {

Loading…
Cancel
Save