pds-dev-kit-web 1.9.2 → 1.9.4
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.
|
@@ -86,7 +86,7 @@ function Background() {
|
|
|
86
86
|
if (backgroundMediaType !== 'YOUTUBE')
|
|
87
87
|
return;
|
|
88
88
|
setYoutubeSize(getResponsiveYoutubeSize());
|
|
89
|
-
}, [getResponsiveYoutubeSize]);
|
|
89
|
+
}, [getResponsiveYoutubeSize, backgroundMediaSrc]);
|
|
90
90
|
(0, react_1.useEffect)(function () {
|
|
91
91
|
if (backgroundMediaType !== 'YOUTUBE')
|
|
92
92
|
return;
|
|
@@ -85,6 +85,13 @@ function YouTubeIframe(_a) {
|
|
|
85
85
|
});
|
|
86
86
|
(_a = event.target) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
87
87
|
}, []);
|
|
88
|
+
var handleCrossOriginError = (0, react_1.useCallback)(function () {
|
|
89
|
+
if (!playerRef.current)
|
|
90
|
+
return;
|
|
91
|
+
playerRef.current.destroy();
|
|
92
|
+
setError(null);
|
|
93
|
+
onYouTubeIframeAPIReady();
|
|
94
|
+
}, [playerRef.current, setError]);
|
|
88
95
|
var onYouTubeIframeAPIReady = (0, react_1.useCallback)(function () {
|
|
89
96
|
if (!videoId || !PLAYER_ID) {
|
|
90
97
|
return;
|
|
@@ -147,22 +154,32 @@ function YouTubeIframe(_a) {
|
|
|
147
154
|
if (!playerRef.current)
|
|
148
155
|
return;
|
|
149
156
|
if (!videoId) {
|
|
150
|
-
|
|
157
|
+
try {
|
|
158
|
+
(_a = playerRef.current) === null || _a === void 0 ? void 0 : _a.stopVideo();
|
|
159
|
+
}
|
|
160
|
+
catch (_b) {
|
|
161
|
+
handleCrossOriginError();
|
|
162
|
+
}
|
|
151
163
|
return;
|
|
152
164
|
}
|
|
153
165
|
if (videoId !== prevVideoId) {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
+
try {
|
|
167
|
+
playerRef.current.loadVideoById({
|
|
168
|
+
videoId: videoId,
|
|
169
|
+
playerVars: {
|
|
170
|
+
playsinline: 1,
|
|
171
|
+
autoplay: 1,
|
|
172
|
+
controls: 0,
|
|
173
|
+
iv_load_policy: 3,
|
|
174
|
+
listType: 'playlist',
|
|
175
|
+
playlist: videoId,
|
|
176
|
+
loop: 1
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
catch (_c) {
|
|
181
|
+
handleCrossOriginError();
|
|
182
|
+
}
|
|
166
183
|
}
|
|
167
184
|
}, [playerRef, videoId, prevVideoId, onYouTubeIframeAPIReady]);
|
|
168
185
|
/**
|
package/package.json
CHANGED
package/release-note.md
CHANGED