pds-dev-kit-web-test 2.5.373 → 2.5.375
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.
@@ -51,15 +51,14 @@ function VideoPlayer(props) {
|
|
51
51
|
: CB_EFFECT_PROP_ENTANIM['CB_EFFECT_PROP_ENTANIM_SPEC_TYPE:MOBILE'] === 'NONE';
|
52
52
|
var hasEffect = !isNoneEffectType;
|
53
53
|
var effectVisibleStyle = hasEffect ? { opacity: isVisible ? 1 : 0 } : {};
|
54
|
-
var
|
55
|
-
|
56
|
-
|
57
|
-
// CB_CONTENT_PROP_VIDEO_SPEC_ENDTIME,
|
58
|
-
CB_CONTENT_PROP_VIDEO_SPEC_THUMB = CB_CONTENT_PROP_VIDEO.CB_CONTENT_PROP_VIDEO_SPEC_THUMB;
|
54
|
+
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;
|
55
|
+
var shouldAutoplay = CB_CONTENT_PROP_VIDEO_SPEC_AUTOPLAY ||
|
56
|
+
(CB_CONTENT_PROP_VIDEO_SPEC_MAUTOPLAY && device === 'MOBILE');
|
59
57
|
var getVideoSrc = function () {
|
60
58
|
return CB_CONTENT_PROP_VIDEO_SPEC_SELECTOR;
|
61
59
|
};
|
62
60
|
var videoRef = (0, react_1.useRef)(null);
|
61
|
+
var _d = (0, react_1.useState)(false), videoLoaded = _d[0], setVideoLoaded = _d[1];
|
63
62
|
var onLoadedMetadata = function () {
|
64
63
|
var video = videoRef.current;
|
65
64
|
if (!video || isEditMode) {
|
@@ -68,9 +67,32 @@ function VideoPlayer(props) {
|
|
68
67
|
if (typeof CB_CONTENT_PROP_VIDEO_SPEC_STARTTIME === 'number') {
|
69
68
|
video.currentTime = CB_CONTENT_PROP_VIDEO_SPEC_STARTTIME;
|
70
69
|
}
|
71
|
-
|
72
|
-
video.play();
|
70
|
+
setVideoLoaded(true);
|
73
71
|
};
|
72
|
+
(0, react_1.useEffect)(function () {
|
73
|
+
var video = videoRef.current;
|
74
|
+
if (!video || isEditMode || !videoLoaded || !shouldAutoplay) {
|
75
|
+
return;
|
76
|
+
}
|
77
|
+
var handleIntersection = function (entries) {
|
78
|
+
entries.forEach(function (entry) {
|
79
|
+
if (entry.isIntersecting) {
|
80
|
+
video.muted = true;
|
81
|
+
video.play().catch(function () { });
|
82
|
+
}
|
83
|
+
else {
|
84
|
+
video.pause();
|
85
|
+
}
|
86
|
+
});
|
87
|
+
};
|
88
|
+
var observer = new IntersectionObserver(handleIntersection, {
|
89
|
+
threshold: 0.2
|
90
|
+
});
|
91
|
+
observer.observe(video);
|
92
|
+
return function () {
|
93
|
+
observer.disconnect();
|
94
|
+
};
|
95
|
+
}, [videoLoaded, isEditMode, shouldAutoplay]);
|
74
96
|
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: {
|
75
97
|
position: 'absolute',
|
76
98
|
top: '50%',
|
@@ -81,7 +103,7 @@ function VideoPlayer(props) {
|
|
81
103
|
alignItems: 'center',
|
82
104
|
justifyContent: 'center',
|
83
105
|
transform: 'translate(-50%, -50%)'
|
84
|
-
} }, { 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, controls: !isEditMode, isEditMode: isEditMode, ref: videoRef, poster: CB_CONTENT_PROP_VIDEO_SPEC_THUMB,
|
106
|
+
} }, { 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, controls: !isEditMode, isEditMode: isEditMode, ref: videoRef, poster: CB_CONTENT_PROP_VIDEO_SPEC_THUMB, onLoadedMetadata: onLoadedMetadata }, { children: [(0, jsx_runtime_1.jsx)("source", { src: getVideoSrc(), type: "video/mp4" }), "Your browser does not support the video tag."] }), CB_CONTENT_PROP_VIDEO_SPEC_SELECTOR)] })) }))] }));
|
85
107
|
}
|
86
108
|
function getBGColorStyles(props, device) {
|
87
109
|
var availableSpecCodes = [
|
@@ -102,10 +102,9 @@ export type CB_STYLE_PROP_COLOR_SPECS = CB_STYLE_PROP_COLOR_SPECS_BASE & {
|
|
102
102
|
};
|
103
103
|
export type CB_CONTENT_PROP_VIDEO = {
|
104
104
|
CB_CONTENT_PROP_VIDEO_SPEC_CONNECTDATA: STRING_PLAIN;
|
105
|
-
CB_CONTENT_PROP_VIDEO_SPEC_ENDTIME: number;
|
106
|
-
CB_CONTENT_PROP_VIDEO_SPEC_MPLAY: boolean;
|
107
|
-
CB_CONTENT_PROP_VIDEO_SPEC_REPLAY: boolean;
|
108
105
|
CB_CONTENT_PROP_VIDEO_SPEC_SELECTOR: string;
|
106
|
+
CB_CONTENT_PROP_VIDEO_SPEC_AUTOPLAY: string;
|
107
|
+
CB_CONTENT_PROP_VIDEO_SPEC_MAUTOPLAY: string;
|
109
108
|
CB_CONTENT_PROP_VIDEO_SPEC_STARTTIME: number;
|
110
109
|
CB_CONTENT_PROP_VIDEO_SPEC_THUMB: string;
|
111
110
|
CB_CONTENT_PROP_VIDEO_SPEC_TYPE: 'FILE' | 'URL';
|