fix(#1701): merge with new controls

keep-around/fdb88b04b32b9392e76795099e2ec47c9856b38b
Andrei Dekterev 3 years ago
parent 59d12396c5
commit 11cfad5212
  1. 1
      src/features/MatchPage/index.tsx
  2. 2
      src/features/MultiSourcePlayer/components/ProgressBar/styled.tsx
  3. 1
      src/features/MultiSourcePlayer/hooks/index.tsx
  4. 1
      src/features/MultiSourcePlayer/index.tsx
  5. 1
      src/features/StreamPlayer/components/Controls/index.tsx
  6. 1
      src/features/StreamPlayer/components/ProgressBar/index.tsx
  7. 40
      src/features/StreamPlayer/components/ProgressBar/styled.tsx
  8. 113
      src/features/StreamPlayer/styled.tsx

@ -65,7 +65,6 @@ const MatchPageComponent = () => {
const playFromScout = profile?.has_video && !profile?.live const playFromScout = profile?.has_video && !profile?.live
const playFromOTT = !profile?.has_video && (profile?.live || profile?.storage) const playFromOTT = !profile?.has_video && (profile?.live || profile?.storage)
// TODO Добавить попап 'Данный матч ещё не начался' // TODO Добавить попап 'Данный матч ещё не начался'
if (!isStarted && profile?.live === false) { if (!isStarted && profile?.live === false) {
const sportName = history.location.pathname.split('/')[1] const sportName = history.location.pathname.split('/')[1]

@ -1,5 +1,5 @@
import styled, { css } from 'styled-components/macro' import styled, { css } from 'styled-components/macro'
import { isMobileDevice } from '../../../../config/userAgent' import { isMobileDevice } from 'config/userAgent'
export const ProgressBarList = styled.div` export const ProgressBarList = styled.div`
flex-grow: 1; flex-grow: 1;

@ -13,6 +13,7 @@ import { useVolume } from 'features/VideoPlayer/hooks/useVolume'
import { useNoNetworkPopupStore } from 'features/NoNetworkPopup' import { useNoNetworkPopupStore } from 'features/NoNetworkPopup'
import { useEventListener, useObjectState } from 'hooks' import { useEventListener, useObjectState } from 'hooks'
import { MatchInfo } from 'requests' import { MatchInfo } from 'requests'
import { MatchInfo } from 'requests' import { MatchInfo } from 'requests'

@ -22,7 +22,6 @@ import { REWIND_SECONDS } from './config'
export const MultiSourcePlayer = (props: Props) => { export const MultiSourcePlayer = (props: Props) => {
const { profile } = props const { profile } = props
const { const {
activeChapterIndex, activeChapterIndex,
activePlayer, activePlayer,

@ -84,7 +84,6 @@ export const Controls = (props: ControlsProps) => {
isLive, isLive,
isStorage, isStorage,
]) ])
const progressBarElement = useMemo(() => { const progressBarElement = useMemo(() => {
if (isLive || isStorage) { if (isLive || isStorage) {
// return ( // return (

@ -15,7 +15,6 @@ export const ProgressBar = (props: Props) => {
playedProgressInPercent, playedProgressInPercent,
time, time,
} = useProgressBar(props) } = useProgressBar(props)
return ( return (
<ProgressBarList ref={progressBarRef}> <ProgressBarList ref={progressBarRef}>
<Chapters chapters={calculatedChapters} /> <Chapters chapters={calculatedChapters} />

@ -1,40 +1,13 @@
import styled, { css } from 'styled-components/macro' import styled, { css } from 'styled-components/macro'
import { isMobileDevice } from 'config/userAgent' import { isMobileDevice } from 'config/userAgent'
import { Wrapper } from '../TimeTooltip/styled' import { Wrapper } from '../TimeTooltip/styled'
export const ProgressBarList = styled.div` export const ProgressBarList = styled.div`
flex-grow: 1; flex-grow: 1;
height: 4px; height: 4px;
position: relative; position: relative;
background-color: rgba(255, 255, 255, 0.3);
cursor: pointer;
${isMobileDevice
? css`
height: 1px;
`
: ''}
`
export const LoadedProgress = styled.div`
position: absolute;
z-index: 1;
background-color: rgba(255, 255, 255, 0.6);
height: 100%;
`
export const PlayedProgress = styled.div`
position: absolute;
z-index: 2;
background-color: #CC0000;
height: 100%;
${isMobileDevice
? css`
background-color: #FFFFFF;
`
: ''}
` `
export const Scrubber = styled.div` export const Scrubber = styled.div`
@ -42,23 +15,24 @@ export const Scrubber = styled.div`
outline: none; outline: none;
position: absolute; position: absolute;
top: 0; top: 0;
transform: translate(-50%, -38%); transform: translate(-50%, -43%);
z-index: 3; z-index: 3;
width: 18px; width: 18px;
height: 18px; height: 18px;
background-color: #CC0000; background-color: #CC0000;
border-radius: 50%; border-radius: 50%;
cursor: pointer; cursor: pointer;
:hover ${Wrapper} { :hover ${Wrapper} {
visibility: visible; visibility: visible;
} }
${isMobileDevice ${isMobileDevice
? css` ? css`
width: 14px; width: 30px;
height: 14px; height: 30px;
background-color: #FFFFFF; background-clip: padding-box;
border: 10px solid transparent;
` `
: ''} : ''}
` `

@ -1,4 +1,4 @@
import styled, { css } from 'styled-components' import styled, { css } from 'styled-components/macro'
import { isMobileDevice } from 'config/userAgent' import { isMobileDevice } from 'config/userAgent'
@ -9,14 +9,6 @@ export const ControlsGradient = styled.div<{ isVisible?: boolean }>`
width: 100%; width: 100%;
pointer-events: none; pointer-events: none;
height: 145px; height: 145px;
${({ isVisible }) => (isMobileDevice
? css`
height: 100%;
background: ${(isVisible
? 'linear-gradient(0deg, rgba(0,0,0,0.7) 0%, rgba(255,255,255,0) 25%, rgba(255,255,255,0) 75%, rgba(0,0,0,0.7) 100%)'
: 'initial')}
` : '')}
` `
type HoverStylesProps = { type HoverStylesProps = {
@ -108,11 +100,9 @@ export const PlayerWrapper = styled.div<PlayStopProps>`
position: relative; position: relative;
background-color: #000; background-color: #000;
min-height: 100%; min-height: 100%;
:fullscreen { :fullscreen {
padding-top: 0; padding-top: 0;
} }
${supportsAspectRatio ${supportsAspectRatio
? css`aspect-ratio: 16 / 9;` ? css`aspect-ratio: 16 / 9;`
: css` : css`
@ -139,12 +129,7 @@ export const LoaderWrapper = styled.div<LoaderWrapperProps>`
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
z-index: 1; z-index: 1;
transition: opacity 0.3s ease-in-out; transition: opacity 0.3s ease-in-out;
opacity: ${({ buffering }) => (buffering ? 1 : 0)};
opacity: ${({ buffering }) => (
buffering
? 1
: 0
)};
` `
export const ButtonBase = styled.button` export const ButtonBase = styled.button`
@ -161,7 +146,7 @@ export const ButtonBase = styled.button`
const sizes = { const sizes = {
lg: 92, lg: 92,
sm: 29, sm: 24,
} }
type PlayStopProps = { type PlayStopProps = {
@ -179,18 +164,17 @@ export const PlayStop = styled(ButtonBase)<PlayStopProps>`
)}; )};
${({ size = 'sm' }) => ( ${({ size = 'sm' }) => (
css` css`
width: ${sizes[size]}px; width: ${sizes[size]}px;
height: ${sizes[size]}px; height: ${sizes[size]}px;
` `
)}; )};
${isMobileDevice ${isMobileDevice
? css` ? css`
width: ${sizes.sm}px; width: 20%;
height: ${sizes.sm}px; height: 60%;
margin-right: 0; margin-right: 0;
padding: 0; padding: 0;
` `
: ''}; : ''};
` `
@ -214,13 +198,12 @@ export const Fullscreen = styled(ButtonBase)<FullscreenProps>`
? 'url(/images/player-fullscreen-off.svg)' ? 'url(/images/player-fullscreen-off.svg)'
: 'url(/images/player-fullscreen-on.svg)' : 'url(/images/player-fullscreen-on.svg)'
)}; )};
${isMobileDevice ${isMobileDevice
? css` ? css`
width: 20px; width: 20px;
height: 18px; height: 18px;
margin-left: 15px; margin-left: 15px;
` `
: ''}; : ''};
` `
@ -249,26 +232,23 @@ export const Backward = styled(ButtonBase)<ButtonProps>`
font-weight: normal; font-weight: normal;
${({ size = 'sm' }) => ( ${({ size = 'sm' }) => (
css` css`
width: ${rewindButtonSizes.sides[size]}px; width: ${rewindButtonSizes.sides[size]}px;
height: ${rewindButtonSizes.sides[size]}px; height: ${rewindButtonSizes.sides[size]}px;
font-size: ${rewindButtonSizes.fontSizes[size]}px; font-size: ${rewindButtonSizes.fontSizes[size]}px;
` `
)} )}
display: ${({ isHidden }) => (isHidden ? 'none' : 'block')}; display: ${({ isHidden }) => (isHidden ? 'none' : 'block')};
${isMobileDevice ${isMobileDevice
? css` ? css`
width: ${rewindButtonSizes.sides.sm}px; width: 15%;
height: ${rewindButtonSizes.sides.sm}px; font-size: 14px;
font-size: ${rewindButtonSizes.fontSizes.sm}px; margin-right: 6px;
` `
: ''}; : ''};
` `
export const Forward = styled(Backward)` export const Forward = styled(Backward)`
background-image: url(/images/player-forward.svg); background-image: url(/images/player-forward.svg);
margin-left: 10px;
margin-right: 0;
` `
type PlaybackTimeProps = { type PlaybackTimeProps = {
@ -280,14 +260,13 @@ export const PlaybackTime = styled.span<PlaybackTimeProps>`
font-weight: 600; font-weight: 600;
font-size: 16px; font-size: 16px;
color: #fff; color: #fff;
${isMobileDevice ${isMobileDevice
? css` ? css`
margin-left: 5px; margin-left: 5px;
font-size: 10px; font-size: 10px;
width: 100px; width: 100px;
white-space: nowrap; white-space: nowrap;
` `
: ''}; : ''};
` `
@ -306,13 +285,12 @@ export const CenterControls = styled.div<CenterControlsProps>`
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
transition: opacity 0.3s ease-in-out; transition: opacity 0.3s ease-in-out;
opacity: ${({ playing }) => (playing ? 0 : 1)}; opacity: ${({ playing }) => (playing ? 0 : 1)};
pointer-events: ${({ playing }) => (playing ? 'none' : 'auto')}; pointer-events: ${({ playing }) => (playing ? 'none' : 'auto')};
${isMobileDevice ${isMobileDevice
? css` ? css`
width: 135px; width: 70%;
` `
: ''}; : ''};
` `
@ -326,15 +304,10 @@ export const LiveBtn = styled(ButtonBase)`
padding: 4.5px 8px; padding: 4.5px 8px;
background-color: #CC0000; background-color: #CC0000;
border-radius: 1.3px; border-radius: 1.3px;
` ${isMobileDevice
? css`
export const TeamsDetailsWrapper = styled.div` `
position: absolute; : ''};
top: 20px;
left: 15px;
font-size: 16px;
color: #FFFFFF;
z-index: 50;
` `
export const ChaptersText = styled.span` export const ChaptersText = styled.span`
@ -343,7 +316,6 @@ export const ChaptersText = styled.span`
font-size: 16px; font-size: 16px;
color: #fff; color: #fff;
text-align: center; text-align: center;
${isMobileDevice ${isMobileDevice
? css` ? css`
margin: 0 5px; margin: 0 5px;
@ -361,18 +333,16 @@ export const Prev = styled(ButtonBase)<PrevProps>`
width: 29px; width: 29px;
height: 28px; height: 28px;
background-image: url(/images/player-prev.svg); background-image: url(/images/player-prev.svg);
${({ disabled }) => ( ${({ disabled }) => (
disabled disabled
? 'opacity: 0.5;' ? 'opacity: 0.5;'
: '' : ''
)} )}
${isMobileDevice ${isMobileDevice
? css` ? css`
width: 20px; width: 20px;
height: 20px; height: 20px;
` `
: ''}; : ''};
` `
@ -380,3 +350,12 @@ export const Next = styled(Prev)`
margin-right: 10px; margin-right: 10px;
transform: rotate(180deg); transform: rotate(180deg);
` `
export const TeamsDetailsWrapper = styled.div`
position: absolute;
top: 20px;
left: 15px;
font-size: 16px;
color: #FFFFFF;
z-index: 50;
`

Loading…
Cancel
Save