From 5b0fcd042839344cc73db376b45e7d5191417791 Mon Sep 17 00:00:00 2001 From: Rakov Roman Date: Mon, 17 Oct 2022 14:33:20 +0300 Subject: [PATCH] fix(#2903): fixed playing storage broadcast --- src/features/MatchPage/components/LiveMatch/helpers.tsx | 6 +++++- src/features/StreamPlayer/hooks/index.tsx | 8 +++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/features/MatchPage/components/LiveMatch/helpers.tsx b/src/features/MatchPage/components/LiveMatch/helpers.tsx index d5492b1f..df315409 100644 --- a/src/features/MatchPage/components/LiveMatch/helpers.tsx +++ b/src/features/MatchPage/components/LiveMatch/helpers.tsx @@ -23,7 +23,11 @@ const getFullMatchChapters = ( playlist: MatchPlaylistOption, ) => { const bound = find(profile?.video_bounds, { h: FULL_MATCH_BOUNDARY }) - const durationMs = (playlist.duration ?? 0) * 1000 + + const durationMs = (bound && !profile?.live) + ? ((playlist.duration ?? 0) - Number(bound.s)) * 1000 + : (playlist.duration ?? 0) * 1000 + return [ { duration: durationMs, diff --git a/src/features/StreamPlayer/hooks/index.tsx b/src/features/StreamPlayer/hooks/index.tsx index d099653e..87d8d721 100644 --- a/src/features/StreamPlayer/hooks/index.tsx +++ b/src/features/StreamPlayer/hooks/index.tsx @@ -303,13 +303,11 @@ export const useVideoPlayer = ({ const regURL = /\d{6,20}/gi useEffect(() => { - if ((isLive + if (((isLive || chapters[0].duration === chaptersProps[0].duration) && chapters[0]?.endOffsetMs === chaptersProps[0]?.endOffsetMs - && ( - chapters[0]?.url.match(regURL)?.[0] === chaptersProps[0]?.url.match(regURL)?.[0] - ) - ) + && chapters[0]?.url.match(regURL)?.[0] === chaptersProps[0]?.url.match(regURL)?.[0]) || (isEmpty(chapters) || isEmpty(chaptersProps))) return + setPlayerState({ ...initialState, chapters: chaptersProps,