parent
3143190333
commit
8f80dfe3db
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,43 @@ |
||||
import YouTube from 'react-youtube' |
||||
|
||||
import { PlayerWrapper } from '../../styled' |
||||
import { useVideoPlayer, Props } from '../../hooks' |
||||
|
||||
export const YoutubePlayer = (props: Props) => { |
||||
const { profile } = props |
||||
|
||||
const { |
||||
onMouseMove, |
||||
onPlayerClick, |
||||
onTouchEnd, |
||||
onTouchStart, |
||||
playing, |
||||
wrapperRef, |
||||
} = useVideoPlayer(props) |
||||
|
||||
const youtube_link = profile?.youtube_link || '' |
||||
const key = youtube_link.slice(32, youtube_link.length) |
||||
|
||||
return ( |
||||
<PlayerWrapper |
||||
ref={wrapperRef} |
||||
playing={playing} |
||||
onClick={onPlayerClick} |
||||
onMouseMove={onMouseMove} |
||||
onTouchStart={onTouchStart} |
||||
onTouchEnd={onTouchEnd} |
||||
> |
||||
<YouTube |
||||
videoId={key} |
||||
opts={{ |
||||
height: String(wrapperRef.current?.clientHeight), |
||||
playerVars: { |
||||
autoplay: 1, |
||||
modestbranding: 1, |
||||
}, |
||||
width: String(wrapperRef.current?.clientWidth), |
||||
}} |
||||
/> |
||||
</PlayerWrapper> |
||||
) |
||||
} |
||||
Loading…
Reference in new issue