pds-dev-kit-web-test 2.5.387 → 2.5.391
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/dist/src/sub/DynamicLayout/mock_video_cb.js +1 -1
- package/dist/src/sub/DynamicLayout/mocks.js +1 -1
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/VideoPlayer/VideoPlayer.js +16 -4
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/VideoPlayer/helper.d.ts +4 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/VideoPlayer/helper.js +25 -0
- package/package.json +1 -1
@@ -21,7 +21,7 @@ exports.MOCK_VIDEO_CB = {
|
|
21
21
|
CB_CONTENT_PROP_VIDEO_SPEC_ENDTIME: 5,
|
22
22
|
CB_CONTENT_PROP_VIDEO_SPEC_MPLAY: true,
|
23
23
|
CB_CONTENT_PROP_VIDEO_SPEC_REPLAY: true,
|
24
|
-
CB_CONTENT_PROP_VIDEO_SPEC_SELECTOR: '
|
24
|
+
CB_CONTENT_PROP_VIDEO_SPEC_SELECTOR: 'https://publ-upload-dev.s3.ap-northeast-2.amazonaws.com/VSMP4z4pf20250529100121192-6ncx7.mp4?fallbackUrl=publ-upload-dev.s3.ap-northeast-2.amazonaws.com%2F6ce235e9-c103-4ba4-9a3d-f276f703f406.mp4',
|
25
25
|
CB_CONTENT_PROP_VIDEO_SPEC_STARTTIME: 0,
|
26
26
|
CB_CONTENT_PROP_VIDEO_SPEC_THUMB: '',
|
27
27
|
CB_CONTENT_PROP_VIDEO_SPEC_TYPE: 'FILE',
|
@@ -29,6 +29,7 @@ var styled_components_1 = __importDefault(require("styled-components"));
|
|
29
29
|
var S_CB_AnimationObserverBox_1 = require("../components/S_CB_AnimationObserverBox");
|
30
30
|
var S_CB_BoxWithShadow_1 = require("../components/S_CB_BoxWithShadow");
|
31
31
|
var S_HiddenCover_1 = require("../components/S_HiddenCover");
|
32
|
+
var helper_1 = require("./helper");
|
32
33
|
function VideoPlayer(props) {
|
33
34
|
var _a = (0, react_1.useContext)(dynamicLayoutContext_1.dynamicLayoutContext), device = _a.device, mode = _a.mode;
|
34
35
|
var CB_CONTENT_PROP_VIDEO = props.CB_CONTENT_PROP_VIDEO;
|
@@ -55,11 +56,19 @@ function VideoPlayer(props) {
|
|
55
56
|
var CB_CONTENT_PROP_VIDEO_SPEC_SELECTOR = CB_CONTENT_PROP_VIDEO.CB_CONTENT_PROP_VIDEO_SPEC_SELECTOR, CB_CONTENT_PROP_VIDEO_SPEC_STARTTIME = CB_CONTENT_PROP_VIDEO.CB_CONTENT_PROP_VIDEO_SPEC_STARTTIME, CB_CONTENT_PROP_VIDEO_SPEC_THUMB = CB_CONTENT_PROP_VIDEO.CB_CONTENT_PROP_VIDEO_SPEC_THUMB, CB_CONTENT_PROP_VIDEO_SPEC_MAUTOPLAY = CB_CONTENT_PROP_VIDEO.CB_CONTENT_PROP_VIDEO_SPEC_MAUTOPLAY, CB_CONTENT_PROP_VIDEO_SPEC_AUTOPLAY = CB_CONTENT_PROP_VIDEO.CB_CONTENT_PROP_VIDEO_SPEC_AUTOPLAY;
|
56
57
|
var shouldAutoplay = (CB_CONTENT_PROP_VIDEO_SPEC_AUTOPLAY && device === 'DESKTOP') ||
|
57
58
|
(CB_CONTENT_PROP_VIDEO_SPEC_MAUTOPLAY && device === 'MOBILE');
|
58
|
-
var getVideoSrc = function () {
|
59
|
-
return CB_CONTENT_PROP_VIDEO_SPEC_SELECTOR;
|
60
|
-
};
|
61
59
|
var videoRef = (0, react_1.useRef)(null);
|
62
60
|
var _e = (0, react_1.useState)(false), videoLoaded = _e[0], setVideoLoaded = _e[1];
|
61
|
+
var _f = (0, react_1.useState)(function () {
|
62
|
+
return (0, helper_1.parseTargetUrl)(CB_CONTENT_PROP_VIDEO_SPEC_SELECTOR).encodedURL;
|
63
|
+
}), videoURL = _f[0], setVideoURL = _f[1];
|
64
|
+
var onVideoError = function () {
|
65
|
+
var fallbackURL = (0, helper_1.parseTargetUrl)(CB_CONTENT_PROP_VIDEO_SPEC_SELECTOR).fallbackURL;
|
66
|
+
var isFallbackURL = fallbackURL === videoURL;
|
67
|
+
if (fallbackURL && !isFallbackURL) {
|
68
|
+
setVideoURL(fallbackURL);
|
69
|
+
return;
|
70
|
+
}
|
71
|
+
};
|
63
72
|
var onLoadedMetadata = function () {
|
64
73
|
setVideoLoaded(true);
|
65
74
|
};
|
@@ -103,6 +112,9 @@ function VideoPlayer(props) {
|
|
103
112
|
observer.disconnect();
|
104
113
|
};
|
105
114
|
}, [videoLoaded, isEditMode, shouldAutoplay]);
|
115
|
+
(0, react_1.useEffect)(function () {
|
116
|
+
setVideoURL((0, helper_1.parseTargetUrl)(CB_CONTENT_PROP_VIDEO_SPEC_SELECTOR).encodedURL);
|
117
|
+
}, [CB_CONTENT_PROP_VIDEO_SPEC_SELECTOR]);
|
106
118
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [isEditModeAndHidden && (0, jsx_runtime_1.jsx)(S_HiddenCover_1.S_HiddenCover, {}), (0, jsx_runtime_1.jsx)(S_CB_AnimationObserverBox_1.S_CB_AnimationObserverBox, __assign({ ref: hasEffect ? cbRef : null, effectVisibleStyle: effectVisibleStyle }, { children: (0, jsx_runtime_1.jsxs)(S_CB_BoxWithShadow_1.S_CB_BoxWithShadow, __assign({ className: "cb-layout-box", normalStyle: __assign(__assign(__assign(__assign({}, propsStyle), layoutStyle), effectCssProperties), bgColorStyle), hoverStyle: __assign(__assign({}, propsHoverStyle), bgColorHoverStyle), cbStylePropsShadowSpecs: CB_STYLE_PROP_SHADOW, device: device }, { children: [isEditMode && ((0, jsx_runtime_1.jsx)("div", __assign({ style: {
|
107
119
|
position: 'absolute',
|
108
120
|
top: '50%',
|
@@ -113,7 +125,7 @@ function VideoPlayer(props) {
|
|
113
125
|
alignItems: 'center',
|
114
126
|
justifyContent: 'center',
|
115
127
|
transform: 'translate(-50%, -50%)'
|
116
|
-
} }, { children: (0, jsx_runtime_1.jsx)(Icon_1.Icon, { iconName: "ic_video_play_circle", fillType: "fill", colorKey: "ui_cpnt_icon_sys_white", size: 48 }) }))), (0, jsx_runtime_1.jsxs)(S_Video, __assign({ muted: true, playsInline: true, controls: !isEditMode, isEditMode: isEditMode, ref: videoRef, poster: CB_CONTENT_PROP_VIDEO_SPEC_THUMB, onLoadedMetadata: onLoadedMetadata, onPlay: onPlay }, { children: [(0, jsx_runtime_1.jsx)("source", { src:
|
128
|
+
} }, { children: (0, jsx_runtime_1.jsx)(Icon_1.Icon, { iconName: "ic_video_play_circle", fillType: "fill", colorKey: "ui_cpnt_icon_sys_white", size: 48 }) }))), (0, jsx_runtime_1.jsxs)(S_Video, __assign({ muted: true, playsInline: true, controls: !isEditMode, isEditMode: isEditMode, ref: videoRef, poster: CB_CONTENT_PROP_VIDEO_SPEC_THUMB, onLoadedMetadata: onLoadedMetadata, onPlay: onPlay, onError: onVideoError, "data-src": CB_CONTENT_PROP_VIDEO_SPEC_SELECTOR }, { children: [(0, jsx_runtime_1.jsx)("source", { src: videoURL }), "Your browser does not support the video tag."] }), videoURL + CB_CONTENT_PROP_VIDEO_SPEC_THUMB)] })) }))] }));
|
117
129
|
}
|
118
130
|
function getBGColorStyles(props, device) {
|
119
131
|
var availableSpecCodes = [
|
@@ -0,0 +1,25 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.parseTargetUrl = void 0;
|
4
|
+
function parseTargetUrl(url) {
|
5
|
+
var _a = url.split('?'), encodedURL = _a[0], query = _a[1];
|
6
|
+
if (!query) {
|
7
|
+
return {
|
8
|
+
encodedURL: encodedURL,
|
9
|
+
fallbackURL: null
|
10
|
+
};
|
11
|
+
}
|
12
|
+
var params = new URLSearchParams(query);
|
13
|
+
var fallbackUrl = params.get('fallbackUrl');
|
14
|
+
if (!fallbackUrl) {
|
15
|
+
return {
|
16
|
+
encodedURL: encodedURL,
|
17
|
+
fallbackURL: null
|
18
|
+
};
|
19
|
+
}
|
20
|
+
return {
|
21
|
+
encodedURL: encodedURL,
|
22
|
+
fallbackURL: "http://".concat(fallbackUrl)
|
23
|
+
};
|
24
|
+
}
|
25
|
+
exports.parseTargetUrl = parseTargetUrl;
|