pb-sxp-ui 1.15.13-alpha.5 → 1.15.15-alpha.1

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/index.cjs CHANGED
@@ -19482,7 +19482,7 @@ const PictureGroup = ({ imgUrls, width, height, imgUrlsPostConfig, rec, index, s
19482
19482
  };
19483
19483
  var PictureGroup$1 = React.memo(PictureGroup);
19484
19484
 
19485
- const VideoWidget = React.forwardRef(({ rec, index, height, data, muted, activeIndex, videoPostConfig, width, swiperRef, videoPlayIcon, handleUpdateTimeline, loopPlay }, ref) => {
19485
+ const VideoWidget = React.forwardRef(({ rec, index, height, data, muted, activeIndex, videoPostConfig, width, swiperRef, videoPlayIcon, onUpdateTimeLine, loopPlay, onPlay, onPause }, ref) => {
19486
19486
  const { isActive } = useSwiperSlide();
19487
19487
  const [isPauseVideo, setIsPauseVideo] = React.useState(false);
19488
19488
  const videoRef = React.useRef(null);
@@ -19585,15 +19585,6 @@ const VideoWidget = React.forwardRef(({ rec, index, height, data, muted, activeI
19585
19585
  break;
19586
19586
  }
19587
19587
  }, [isLoadFinish]);
19588
- React.useCallback(() => {
19589
- var _a, _b, _c, _d, _e, _f;
19590
- data[index];
19591
- ((_b = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.duration) !== null && _b !== void 0 ? _b : 0).toFixed(2);
19592
- ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.currentTime) !== null && _d !== void 0 ? _d : 0).toFixed(2);
19593
- if ((_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.duration) {
19594
- (((_f = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _f === void 0 ? void 0 : _f.currentTime) - videoStartTime.current).toFixed(2);
19595
- }
19596
- }, [data, index, bffEventReport]);
19597
19588
  const blur = React.useMemo(() => {
19598
19589
  return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2';
19599
19590
  }, [videoPostConfig]);
@@ -19621,7 +19612,7 @@ const VideoWidget = React.forwardRef(({ rec, index, height, data, muted, activeI
19621
19612
  if (!videoRef.current)
19622
19613
  return;
19623
19614
  const localTime = ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.currentTime) - (rec === null || rec === void 0 ? void 0 : rec.startTime);
19624
- handleUpdateTimeline === null || handleUpdateTimeline === void 0 ? void 0 : handleUpdateTimeline(index, localTime);
19615
+ onUpdateTimeLine === null || onUpdateTimeLine === void 0 ? void 0 : onUpdateTimeLine(index, localTime);
19625
19616
  setTimeout(() => {
19626
19617
  var _a, _b;
19627
19618
  if (((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.currentTime) >= ((_b = rec === null || rec === void 0 ? void 0 : rec.endTime) !== null && _b !== void 0 ? _b : 0)) {
@@ -19644,9 +19635,15 @@ const VideoWidget = React.forwardRef(({ rec, index, height, data, muted, activeI
19644
19635
  };
19645
19636
  const handlePause = () => {
19646
19637
  setIsPauseVideo(true);
19638
+ onPause === null || onPause === void 0 ? void 0 : onPause();
19639
+ };
19640
+ const handlePlay = () => {
19641
+ var _a;
19642
+ const localTime = ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.currentTime) - (rec === null || rec === void 0 ? void 0 : rec.startTime);
19643
+ onPlay === null || onPlay === void 0 ? void 0 : onPlay(index, localTime);
19647
19644
  };
19648
19645
  React.useEffect(() => {
19649
- var _a, _b, _c;
19646
+ var _a, _b, _c, _d;
19650
19647
  if (!isActive)
19651
19648
  return;
19652
19649
  const videoSrc = rec === null || rec === void 0 ? void 0 : rec.mediaUrl;
@@ -19678,9 +19675,10 @@ const VideoWidget = React.forwardRef(({ rec, index, height, data, muted, activeI
19678
19675
  // videoRef.current?.addEventListener('playing', handlePlaying);
19679
19676
  // videoRef.current?.addEventListener('loadeddata', handLoadeddata);
19680
19677
  (_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('pause', handlePause);
19681
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.addEventListener('timeupdate', handleTimeUpload);
19678
+ (_c = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _c === void 0 ? void 0 : _c.addEventListener('play', handlePlay);
19679
+ (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.addEventListener('timeupdate', handleTimeUpload);
19682
19680
  return () => {
19683
- var _a, _b, _c, _d;
19681
+ var _a, _b, _c, _d, _e;
19684
19682
  if (hlsRef === null || hlsRef === void 0 ? void 0 : hlsRef.current)
19685
19683
  (_a = hlsRef === null || hlsRef === void 0 ? void 0 : hlsRef.current) === null || _a === void 0 ? void 0 : _a.destroy();
19686
19684
  setIsLoadFinish(false);
@@ -19688,7 +19686,8 @@ const VideoWidget = React.forwardRef(({ rec, index, height, data, muted, activeI
19688
19686
  // videoRef.current?.removeEventListener('playing', handlePlaying);
19689
19687
  // videoRef.current?.removeEventListener('loadeddata', handLoadeddata);
19690
19688
  (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.removeEventListener('pause', handlePause);
19691
- (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.removeEventListener('timeupdate', handleTimeUpload);
19689
+ (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.removeEventListener('play', handlePlay);
19690
+ (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.removeEventListener('timeupdate', handleTimeUpload);
19692
19691
  };
19693
19692
  }, [isActive]);
19694
19693
  const renderPoster = React.useMemo(() => {
@@ -19744,7 +19743,7 @@ var VideoWidget$1 = React.memo(VideoWidget);
19744
19743
  * @Author: binruan@chatlabs.com
19745
19744
  * @Date: 2025-03-25 13:54:27
19746
19745
  * @LastEditors: binruan@chatlabs.com
19747
- * @LastEditTime: 2025-03-31 14:29:21
19746
+ * @LastEditTime: 2025-04-01 17:54:08
19748
19747
  * @FilePath: \pb-sxp-ui\src\core\components\DiyStoryPreview\index.tsx
19749
19748
  *
19750
19749
  */
@@ -19932,7 +19931,7 @@ Object.values(_materials_).forEach((v) => {
19932
19931
  });
19933
19932
  const defaultUnLikeIconPath = '/pb_static/f71266d2c64446c5ae6a5a7f5489cc0a.png';
19934
19933
  const defaultLikeIconPath = '/pb_static/f07900fe3f0f4ae188ea1611d4801a44.png';
19935
- const DiyStoryPreview = React.forwardRef(({ data = [], globalConfig, tipText, nudge, tempMap, descStyle, hashTagStyle, containerHeight = 664, containerWidth = 375, appDomain, tagList = [], scenes, onActiveChange, activeIndex, loopPlay = false, pointerEvents = 'none', onUpdateTimeLine, disabledListener }, ref) => {
19934
+ const DiyStoryPreview = React.forwardRef(({ data = [], globalConfig, tipText, nudge, tempMap, descStyle, hashTagStyle, containerHeight = 664, containerWidth = 375, appDomain, tagList = [], scenes, onActiveChange, activeIndex, loopPlay = false, pointerEvents = 'none', onUpdateTimeLine, disabledListener, onPlay, onPause }, ref) => {
19936
19935
  const videoWidgetRef = React.useRef(null);
19937
19936
  const swiperRef = React.useRef(null);
19938
19937
  const [curIndex, setCurIndex] = React.useState(0);
@@ -19965,10 +19964,6 @@ const DiyStoryPreview = React.forwardRef(({ data = [], globalConfig, tipText, nu
19965
19964
  isPlaying() {
19966
19965
  var _a, _b;
19967
19966
  return (_b = (_a = videoWidgetRef === null || videoWidgetRef === void 0 ? void 0 : videoWidgetRef.current) === null || _a === void 0 ? void 0 : _a.isPlaying()) !== null && _b !== void 0 ? _b : false;
19968
- },
19969
- setLoopPlay(v) {
19970
- var _a;
19971
- (_a = videoWidgetRef === null || videoWidgetRef === void 0 ? void 0 : videoWidgetRef.current) === null || _a === void 0 ? void 0 : _a.setLoopPlay(v);
19972
19967
  }
19973
19968
  };
19974
19969
  });
@@ -19986,7 +19981,7 @@ const DiyStoryPreview = React.forwardRef(({ data = [], globalConfig, tipText, nu
19986
19981
  const renderContent = (rec, index) => {
19987
19982
  const isVideo = isVideoUrl(rec === null || rec === void 0 ? void 0 : rec.mediaUrl);
19988
19983
  if (isVideo) {
19989
- return (React.createElement(VideoWidget$1, Object.assign({ key: index }, (curIndex === index && { ref: videoWidgetRef }), { rec: rec, index: index, muted: true, width: containerWidth, data: scenes !== null && scenes !== void 0 ? scenes : [], height: containerHeight, activeIndex: index, videoPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPost, videoPlayIcon: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPlayIcon, swiperRef: swiperRef, loopPlay: loopPlay, handleUpdateTimeline: onUpdateTimeLine })));
19984
+ return (React.createElement(VideoWidget$1, Object.assign({ key: index }, (curIndex === index && { ref: videoWidgetRef }), { rec: rec, index: index, muted: true, width: containerWidth, data: scenes !== null && scenes !== void 0 ? scenes : [], height: containerHeight, activeIndex: index, videoPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPost, videoPlayIcon: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPlayIcon, swiperRef: swiperRef, loopPlay: loopPlay, onUpdateTimeLine: onUpdateTimeLine, onPlay: onPlay, onPause: onPause })));
19990
19985
  }
19991
19986
  else {
19992
19987
  return (React.createElement(PictureGroup$1, { key: rec.itemId, imgUrls: [rec === null || rec === void 0 ? void 0 : rec.mediaUrl], width: containerWidth, height: containerHeight, rec: rec, index: index, imgUrlsPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.imgUrlsPost, data: scenes !== null && scenes !== void 0 ? scenes : [], swiperRef: swiperRef }));