fix(#2572): add video player for highlights
parent
ea4879f761
commit
aba2bc10f9
@ -0,0 +1,43 @@ |
||||
import { useRef } from 'react' |
||||
|
||||
import { VideoPlayer } from 'features/VideoPlayer' |
||||
|
||||
import { readToken } from 'helpers' |
||||
|
||||
import { ScModal } from './styled' |
||||
|
||||
interface VideoPropsType { |
||||
isOpenPopupVideo: boolean, |
||||
setIsOpenPopupVideo: (open: boolean) => void, |
||||
} |
||||
|
||||
const urls = { |
||||
production: 'https://instat-stream-production.s3.eu-west-1.amazonaws.com/media/highlights/demo/demohighlight.mp4', |
||||
stage: 'https://instat-stream-staging.s3.eu-west-1.amazonaws.com/media/highlights/demo/demohighlight.mp4', |
||||
} |
||||
export const VideoHighlight = ({ |
||||
isOpenPopupVideo, |
||||
setIsOpenPopupVideo, |
||||
} :VideoPropsType) => { |
||||
const videoRef = useRef<HTMLVideoElement>(null) |
||||
return ( |
||||
// eslint-disable-next-line
|
||||
<ScModal |
||||
isOpen={isOpenPopupVideo} |
||||
close={() => setIsOpenPopupVideo(false)} |
||||
withCloseButton={false} |
||||
> |
||||
<VideoPlayer |
||||
width='100%' |
||||
height='100%' |
||||
src={`${urls.stage}?access_token=${readToken()}`} |
||||
ref={videoRef} |
||||
playing={Boolean(true)} |
||||
muted={false} |
||||
isFullscreen={false} |
||||
controls={Boolean(true)} |
||||
// crossOrigin='use-credentials'
|
||||
/> |
||||
</ScModal> |
||||
) |
||||
} |
||||
@ -0,0 +1,37 @@ |
||||
import styled, { css } from 'styled-components/macro' |
||||
|
||||
import { ModalWindow } from 'features/Modal/styled' |
||||
import { Modal as BaseModal } from 'features/Modal' |
||||
|
||||
import { isMobileDevice } from 'config/userAgent' |
||||
|
||||
export const ScModal = styled(BaseModal)` |
||||
background-color: rgba(0, 0, 0, 0.7); |
||||
|
||||
${ModalWindow} { |
||||
background-color: #333333; |
||||
border-radius: 5px; |
||||
display: flex; |
||||
justify-content: center; |
||||
align-items: center; |
||||
flex-direction: column; |
||||
padding: 50px; |
||||
width: 80vw; |
||||
height: 80vh; |
||||
|
||||
> * { |
||||
margin-bottom: 25px; |
||||
} |
||||
|
||||
${isMobileDevice |
||||
? css` |
||||
width: calc(100vw - 60px); |
||||
@media screen and (orientation: landscape){ |
||||
max-width: calc(100vw - 80px); |
||||
height: calc(100vh - 20px); |
||||
overflow: auto; |
||||
} |
||||
` |
||||
: ''}; |
||||
} |
||||
` |
||||
Loading…
Reference in new issue