@openeventkit/event-site 1.0.43 → 1.0.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -17,6 +17,10 @@ const checkVimeoVideo = (url) => {
|
|
|
17
17
|
return url.match(/https:\/\/(www\.)?(player\.)?vimeo.com\/(.*)/);
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
+
function checkYouTubeVideo(url) {
|
|
21
|
+
return url.match(/^(?:https?:\/\/)?(?:m\.|www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/);
|
|
22
|
+
}
|
|
23
|
+
|
|
20
24
|
const VideoComponent = ({ url, title, namespace, firstHalf, autoPlay, start }) => {
|
|
21
25
|
console.log({ url, title, namespace, firstHalf, autoPlay, start });
|
|
22
26
|
if (url) {
|
|
@@ -54,6 +58,23 @@ const VideoComponent = ({ url, title, namespace, firstHalf, autoPlay, start }) =
|
|
|
54
58
|
<VideoJSPlayer title={title} namespace={namespace} firstHalf={firstHalf} {...videoJsOptions} />
|
|
55
59
|
);
|
|
56
60
|
};
|
|
61
|
+
|
|
62
|
+
const customOptions = checkYouTubeVideo(url) ? {
|
|
63
|
+
techOrder: ["youtube"],
|
|
64
|
+
sources: [{
|
|
65
|
+
type: "video/youtube",
|
|
66
|
+
src: url
|
|
67
|
+
}],
|
|
68
|
+
youtube: {
|
|
69
|
+
ytControls: 0,
|
|
70
|
+
iv_load_policy: 1
|
|
71
|
+
},
|
|
72
|
+
}: {
|
|
73
|
+
sources: [{
|
|
74
|
+
src: url
|
|
75
|
+
}],
|
|
76
|
+
};
|
|
77
|
+
|
|
57
78
|
const videoJsOptions = {
|
|
58
79
|
autoplay: autoPlay,
|
|
59
80
|
/*
|
|
@@ -64,17 +85,10 @@ const VideoComponent = ({ url, title, namespace, firstHalf, autoPlay, start }) =
|
|
|
64
85
|
muted: !!autoPlay,
|
|
65
86
|
controls: true,
|
|
66
87
|
fluid: true,
|
|
67
|
-
techOrder: ["youtube"],
|
|
68
|
-
sources: [{
|
|
69
|
-
type: "video/youtube",
|
|
70
|
-
src: url
|
|
71
|
-
}],
|
|
72
|
-
youtube: {
|
|
73
|
-
ytControls: 0,
|
|
74
|
-
iv_load_policy: 1
|
|
75
|
-
},
|
|
76
88
|
playsInline: true,
|
|
89
|
+
...customOptions
|
|
77
90
|
};
|
|
91
|
+
|
|
78
92
|
return (
|
|
79
93
|
<VideoJSPlayer title={title} namespace={namespace} {...videoJsOptions} />
|
|
80
94
|
);
|