pb-sxp-ui 1.0.94 → 1.0.95

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.
@@ -56,11 +56,15 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
56
56
  }, [videoRef]);
57
57
  const PAUSE_ICON = useIconLink('/pb_static/06f28a2025c74c1cb49be6767316d827.png');
58
58
  const handlePlaying = useCallback(() => {
59
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
60
59
  if (!videoRef)
61
60
  return;
62
61
  setWaiting(false);
63
62
  setIsLoadFinish(true);
63
+ }, []);
64
+ const handleStartPlay = useCallback(() => {
65
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
66
+ if (!videoRef)
67
+ return;
64
68
  setIsPauseVideo(false);
65
69
  const item = data[index];
66
70
  if (item && (videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration)) {
@@ -111,8 +115,9 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
111
115
  const handleLoadedmetadata = useCallback(() => {
112
116
  if (!videoRef)
113
117
  return;
118
+ handleStartPlay();
114
119
  handLoadeddata();
115
- }, [videoRef, handLoadeddata]);
120
+ }, [videoRef, handLoadeddata, handleStartPlay]);
116
121
  const handleClickVideo = useCallback((type) => () => {
117
122
  if (!videoRef)
118
123
  return;
@@ -202,6 +207,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
202
207
  videoRef.setAttribute('webkit-playsinline', 'true');
203
208
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('loadedmetadata', handleLoadedmetadata);
204
209
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('loadeddata', handLoadeddata);
210
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('play', handleStartPlay);
205
211
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('playing', handlePlaying);
206
212
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('pause', handlePause);
207
213
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('ended', handlePlay);
@@ -212,9 +218,11 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
212
218
  dom2 === null || dom2 === void 0 ? void 0 : dom2.appendChild(dom);
213
219
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('loadedmetadata', handleLoadedmetadata);
214
220
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('loadeddata', handLoadeddata);
221
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('play', handleStartPlay);
215
222
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('playing', handlePlaying);
216
223
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('pause', handlePause);
217
224
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('ended', handlePlay);
225
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('canplay', handlePlay);
218
226
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('waiting', handleWaiting);
219
227
  };
220
228
  }, [isActive, videoId, rec, videoRef]);
@@ -305,7 +313,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
305
313
  return null;
306
314
  }
307
315
  return (React.createElement(React.Fragment, null, blur ? (React.createElement("div", { className: 'video-container', key: rec === null || rec === void 0 ? void 0 : rec.video.itemId, onClick: handleClickVideo(), style: Object.assign({ position: 'relative', width: '100%', height, overflow: 'hidden' }, bgStyle) },
308
- !isBgColor && isLoadFinish && (React.createElement(FormatImage, { src: blurBgSrc, style: Object.assign({ height: '100%', width: '100%', objectFit: 'cover' }, blurStyle) })),
316
+ !isBgColor && isLoadFinish && blurBgSrc && (React.createElement(FormatImage, { src: blurBgSrc, style: Object.assign({ height: '100%', width: '100%', objectFit: 'cover' }, blurStyle) })),
309
317
  React.createElement("canvas", { ref: canvasRef, style: { display: 'none' } }),
310
318
  React.createElement("div", { style: {
311
319
  position: 'absolute',
@@ -59,11 +59,15 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
59
59
  }, [videoRef]);
60
60
  const PAUSE_ICON = (0, useIconLink_1.useIconLink)('/pb_static/06f28a2025c74c1cb49be6767316d827.png');
61
61
  const handlePlaying = (0, react_1.useCallback)(() => {
62
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
63
62
  if (!videoRef)
64
63
  return;
65
64
  setWaiting(false);
66
65
  setIsLoadFinish(true);
66
+ }, []);
67
+ const handleStartPlay = (0, react_1.useCallback)(() => {
68
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
69
+ if (!videoRef)
70
+ return;
67
71
  setIsPauseVideo(false);
68
72
  const item = data[index];
69
73
  if (item && (videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration)) {
@@ -114,8 +118,9 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
114
118
  const handleLoadedmetadata = (0, react_1.useCallback)(() => {
115
119
  if (!videoRef)
116
120
  return;
121
+ handleStartPlay();
117
122
  handLoadeddata();
118
- }, [videoRef, handLoadeddata]);
123
+ }, [videoRef, handLoadeddata, handleStartPlay]);
119
124
  const handleClickVideo = (0, react_1.useCallback)((type) => () => {
120
125
  if (!videoRef)
121
126
  return;
@@ -205,6 +210,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
205
210
  videoRef.setAttribute('webkit-playsinline', 'true');
206
211
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('loadedmetadata', handleLoadedmetadata);
207
212
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('loadeddata', handLoadeddata);
213
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('play', handleStartPlay);
208
214
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('playing', handlePlaying);
209
215
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('pause', handlePause);
210
216
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('ended', handlePlay);
@@ -215,9 +221,11 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
215
221
  dom2 === null || dom2 === void 0 ? void 0 : dom2.appendChild(dom);
216
222
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('loadedmetadata', handleLoadedmetadata);
217
223
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('loadeddata', handLoadeddata);
224
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('play', handleStartPlay);
218
225
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('playing', handlePlaying);
219
226
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('pause', handlePause);
220
227
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('ended', handlePlay);
228
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('canplay', handlePlay);
221
229
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('waiting', handleWaiting);
222
230
  };
223
231
  }, [isActive, videoId, rec, videoRef]);
@@ -308,7 +316,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
308
316
  return null;
309
317
  }
310
318
  return (react_1.default.createElement(react_1.default.Fragment, null, blur ? (react_1.default.createElement("div", { className: 'video-container', key: rec === null || rec === void 0 ? void 0 : rec.video.itemId, onClick: handleClickVideo(), style: Object.assign({ position: 'relative', width: '100%', height, overflow: 'hidden' }, bgStyle) },
311
- !isBgColor && isLoadFinish && (react_1.default.createElement(FormatImage_1.default, { src: blurBgSrc, style: Object.assign({ height: '100%', width: '100%', objectFit: 'cover' }, blurStyle) })),
319
+ !isBgColor && isLoadFinish && blurBgSrc && (react_1.default.createElement(FormatImage_1.default, { src: blurBgSrc, style: Object.assign({ height: '100%', width: '100%', objectFit: 'cover' }, blurStyle) })),
312
320
  react_1.default.createElement("canvas", { ref: canvasRef, style: { display: 'none' } }),
313
321
  react_1.default.createElement("div", { style: {
314
322
  position: 'absolute',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pb-sxp-ui",
3
- "version": "1.0.94",
3
+ "version": "1.0.95",
4
4
  "description": "React enterprise-class UI components",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",