Skip to content

Commit b14c545

Browse files
committed
fix(reader): support video type of HTML5
1 parent 365fb1a commit b14c545

File tree

1 file changed

+10
-10
lines changed
  • clients/web/src/components/video

1 file changed

+10
-10
lines changed

clients/web/src/components/video/video.js

+10-10
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,19 @@ const videoWrapper = css`
1717
}
1818
`
1919

20-
const getVideoType = (type) => {
20+
const getVideo = ({ type, vid, src }) => {
2121
switch (type) {
2222
case '1':
2323
case 'YOUTUBE': {
24-
return 'https://www.youtube-nocookie.com/embed/'
24+
return `https://www.youtube-nocookie.com/embed/${vid}?autoplay=0&dnt=1`
2525
}
2626
case '2':
2727
case '3':
2828
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
3033
}
3134
default: {
3235
break
@@ -35,20 +38,17 @@ const getVideoType = (type) => {
3538
}
3639

3740
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)
4242

43-
return (
43+
return videoSrc ? (
4444
<div className={videoWrapper}>
4545
<iframe
4646
className="player"
4747
title="pocket-video-frame"
48-
src={src}
48+
src={videoSrc}
4949
frameBorder="0"
5050
allow="accelerometer; clipboard-write; encrypted-media; gyroscope; modestbranding; picture-in-picture"
5151
allowFullScreen></iframe>
5252
</div>
53-
)
53+
) : null
5454
}

0 commit comments

Comments
 (0)