forked from cerebral/overmind
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.tsx
More file actions
46 lines (42 loc) · 1.05 KB
/
index.tsx
File metadata and controls
46 lines (42 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import * as React from 'react'
import { Wrapper, Video, Backdrop, Loader, Iframe } from './elements'
import { viewport } from '../../utils'
type Props = {
url: string
}
// https://www.youtube.com/watch?v=RA1_cCgEWws
class VideoPlayer extends React.Component<Props> {
node: HTMLElement
componentDidMount() {
setTimeout(() => {
this.node.style.opacity = '1'
})
}
render() {
return (
<Wrapper
innerRef={(node) => {
this.node = node
}}
>
<Backdrop href="/videos" />
<Video>
<Loader>loading video...</Loader>
<Iframe
width={viewport.isMobile ? '300' : '560'}
height={viewport.isMobile ? '169' : '315'}
src={
this.props.url.replace('watch?v=', 'embed/') +
'?rel=0&showinfo=0'
}
frameBorder="0"
// @ts-ignore
allow="autoplay; encrypted-media"
allowFullScreen
/>
</Video>
</Wrapper>
)
}
}
export default VideoPlayer