refactor(2152): play stream from playbackURL

keep-around/c838b5b01bd082034322cb3ffedddb6953cc450e
Mirlan 4 years ago
parent 454f2e8df6
commit c838b5b01b
  1. 5
      src/features/MatchPage/components/LiveMatch/hooks/index.tsx
  2. 4
      src/requests/getMatchInfo.tsx

@ -35,7 +35,10 @@ export const useLiveMatch = (profile: MatchInfo) => {
onPlaylistSelect: handlePlaylistClick, onPlaylistSelect: handlePlaylistClick,
resume: resume ?? fromStartIfStreamPaused, resume: resume ?? fromStartIfStreamPaused,
selectedPlaylist, selectedPlaylist,
streamUrl: `${API_ROOT}/video/stream/${sportType}/${matchId}.m3u8`, streamUrl: (
profile?.playbackUrl
|| `${API_ROOT}/video/stream/${sportType}/${matchId}.m3u8`
),
...usePlayerProgressReporter(), ...usePlayerProgressReporter(),
...useLastPlayPosition(), ...useLastPlayPosition(),
} }

@ -22,6 +22,7 @@ export type MatchInfo = {
date: string, date: string,
has_video: boolean, has_video: boolean,
live: boolean, live: boolean,
playbackUrl?: string,
storage: boolean, storage: boolean,
sub: boolean, sub: boolean,
team1: Team, team1: Team,
@ -33,8 +34,7 @@ export type MatchInfo = {
}, },
} | null } | null
export const getMatchInfo = (sportId: number, matchId: number) export const getMatchInfo = (sportId: number, matchId: number): Promise<MatchInfo> => {
: Promise<MatchInfo> => {
const config = { const config = {
body: { body: {
params: { params: {

Loading…
Cancel
Save