pds-dev-kit-web-test 2.5.382 → 2.5.384

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.
@@ -44,6 +44,7 @@ function VideoPlayer(props) {
44
44
  var entry = (0, hooks_1.useIntersectionObserver)(cbRef, { threshold: 0.2, freezeOnceVisible: false }, [
45
45
  index
46
46
  ]);
47
+ var _d = (0, react_1.useState)(false), videoStarted = _d[0], setVideoStarted = _d[1];
47
48
  var isVisible = !!(entry === null || entry === void 0 ? void 0 : entry.isIntersecting);
48
49
  var effectCssProperties = isVisible ? effect : {};
49
50
  var isNoneEffectType = device === 'DESKTOP'
@@ -58,16 +59,19 @@ function VideoPlayer(props) {
58
59
  return CB_CONTENT_PROP_VIDEO_SPEC_SELECTOR;
59
60
  };
60
61
  var videoRef = (0, react_1.useRef)(null);
61
- var _d = (0, react_1.useState)(false), videoLoaded = _d[0], setVideoLoaded = _d[1];
62
+ var _e = (0, react_1.useState)(false), videoLoaded = _e[0], setVideoLoaded = _e[1];
62
63
  var onLoadedMetadata = function () {
64
+ setVideoLoaded(true);
65
+ };
66
+ var onPlay = function () {
63
67
  var video = videoRef.current;
64
- if (!video || isEditMode) {
68
+ if (!video || isEditMode || videoStarted || shouldAutoplay) {
65
69
  return;
66
70
  }
67
71
  if (typeof CB_CONTENT_PROP_VIDEO_SPEC_STARTTIME === 'number') {
68
72
  video.currentTime = CB_CONTENT_PROP_VIDEO_SPEC_STARTTIME;
73
+ setVideoStarted(true);
69
74
  }
70
- setVideoLoaded(true);
71
75
  };
72
76
  (0, react_1.useEffect)(function () {
73
77
  var video = videoRef.current;
@@ -77,6 +81,9 @@ function VideoPlayer(props) {
77
81
  var handleIntersection = function (entries) {
78
82
  entries.forEach(function (entry) {
79
83
  if (entry.isIntersecting) {
84
+ if (typeof CB_CONTENT_PROP_VIDEO_SPEC_STARTTIME === 'number') {
85
+ video.currentTime = CB_CONTENT_PROP_VIDEO_SPEC_STARTTIME;
86
+ }
80
87
  video.muted = true;
81
88
  video.play().catch(function (err) {
82
89
  // eslint-disable-next-line no-console
@@ -106,7 +113,7 @@ function VideoPlayer(props) {
106
113
  alignItems: 'center',
107
114
  justifyContent: 'center',
108
115
  transform: 'translate(-50%, -50%)'
109
- } }, { 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 + CB_CONTENT_PROP_VIDEO_SPEC_THUMB)] })) }))] }));
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: getVideoSrc(), type: "video/mp4" }), "Your browser does not support the video tag."] }), CB_CONTENT_PROP_VIDEO_SPEC_SELECTOR + CB_CONTENT_PROP_VIDEO_SPEC_THUMB)] })) }))] }));
110
117
  }
111
118
  function getBGColorStyles(props, device) {
112
119
  var availableSpecCodes = [
@@ -121,7 +128,7 @@ function getBGColorStyles(props, device) {
121
128
  ];
122
129
  return (0, colorUtil_1.parseStyleColorToCSSProp)({ availableSpecCodes: availableSpecCodes, props: props, propKey: 'BGCOLOR', device: device });
123
130
  }
124
- var S_Video = styled_components_1.default.video(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n height: 100%;\n object-fit: cover;\n pointer-events: ", ";\n width: 100%;\n"], ["\n height: 100%;\n object-fit: cover;\n pointer-events: ", ";\n width: 100%;\n"])), function (_a) {
131
+ var S_Video = styled_components_1.default.video(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n aspect-ratio: 16 / 9;\n height: 100%;\n max-height: 100%;\n object-fit: cover;\n pointer-events: ", ";\n width: 100%;\n"], ["\n aspect-ratio: 16 / 9;\n height: 100%;\n max-height: 100%;\n object-fit: cover;\n pointer-events: ", ";\n width: 100%;\n"])), function (_a) {
125
132
  var isEditMode = _a.isEditMode;
126
133
  return (isEditMode ? 'none' : 'auto');
127
134
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pds-dev-kit-web-test",
3
- "version": "2.5.382",
3
+ "version": "2.5.384",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "main": "dist/index.js",