File tree 1 file changed +10
-10
lines changed
clients/web/src/components/video
1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -17,16 +17,19 @@ const videoWrapper = css`
17
17
}
18
18
`
19
19
20
- const getVideoType = ( type ) => {
20
+ const getVideo = ( { type, vid , src } ) => {
21
21
switch ( type ) {
22
22
case '1' :
23
23
case 'YOUTUBE' : {
24
- return ' https://www.youtube-nocookie.com/embed/'
24
+ return ` https://www.youtube-nocookie.com/embed/${ vid } ?autoplay=0&dnt=1`
25
25
}
26
26
case '2' :
27
27
case '3' :
28
28
case 'VIMEO' : {
29
- return 'https://player.vimeo.com/video/'
29
+ return `https://player.vimeo.com/video/${ vid } ?autoplay=0&dnt=1`
30
+ }
31
+ case 'HTML5' : {
32
+ return src
30
33
}
31
34
default : {
32
35
break
@@ -35,20 +38,17 @@ const getVideoType = (type) => {
35
38
}
36
39
37
40
export const Video = ( { videoData } ) => {
38
- const id = videoData . vid
39
- const type = videoData . type
40
- const videoType = getVideoType ( type )
41
- const src = `${ videoType } ${ id } ?autoplay=0&dnt=1`
41
+ const videoSrc = getVideo ( videoData )
42
42
43
- return (
43
+ return videoSrc ? (
44
44
< div className = { videoWrapper } >
45
45
< iframe
46
46
className = "player"
47
47
title = "pocket-video-frame"
48
- src = { src }
48
+ src = { videoSrc }
49
49
frameBorder = "0"
50
50
allow = "accelerometer; clipboard-write; encrypted-media; gyroscope; modestbranding; picture-in-picture"
51
51
allowFullScreen > </ iframe >
52
52
</ div >
53
- )
53
+ ) : null
54
54
}
You can’t perform that action at this time.
0 commit comments