pds-dev-kit-web-test 2.5.374 → 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.
@@ -58,6 +58,7 @@ function VideoPlayer(props) {
58
58
  return CB_CONTENT_PROP_VIDEO_SPEC_SELECTOR;
59
59
  };
60
60
  var videoRef = (0, react_1.useRef)(null);
61
+ var _d = (0, react_1.useState)(false), videoLoaded = _d[0], setVideoLoaded = _d[1];
61
62
  var onLoadedMetadata = function () {
62
63
  var video = videoRef.current;
63
64
  if (!video || isEditMode) {
@@ -66,12 +67,32 @@ function VideoPlayer(props) {
66
67
  if (typeof CB_CONTENT_PROP_VIDEO_SPEC_STARTTIME === 'number') {
67
68
  video.currentTime = CB_CONTENT_PROP_VIDEO_SPEC_STARTTIME;
68
69
  }
69
- // NOTE: 자동재생 프롭 생기면 변경.
70
- if (shouldAutoplay) {
71
- video.muted = true;
72
- video.play();
73
- }
70
+ setVideoLoaded(true);
74
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]);
75
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: {
76
97
  position: 'absolute',
77
98
  top: '50%',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pds-dev-kit-web-test",
3
- "version": "2.5.374",
3
+ "version": "2.5.375",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "main": "dist/index.js",