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
45 lines (41 loc) · 973 Bytes
/
index.tsx
File metadata and controls
45 lines (41 loc) · 973 Bytes
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
import * as React from 'react'
import { Wrapper, Video, Backdrop, Loader, Iframe } from './elements'
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="560"
height="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