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.js CHANGED
@@ -19460,7 +19460,7 @@ const PictureGroup = ({ imgUrls, width, height, imgUrlsPostConfig, rec, index, s
19460
19460
  };
19461
19461
  var PictureGroup$1 = memo(PictureGroup);
19462
19462
 
19463
- const VideoWidget = forwardRef(({ rec, index, height, data, muted, activeIndex, videoPostConfig, width, swiperRef, videoPlayIcon, handleUpdateTimeline, loopPlay }, ref) => {
19463
+ const VideoWidget = forwardRef(({ rec, index, height, data, muted, activeIndex, videoPostConfig, width, swiperRef, videoPlayIcon, onUpdateTimeLine, loopPlay, onPlay, onPause }, ref) => {
19464
19464
  const { isActive } = useSwiperSlide();
19465
19465
  const [isPauseVideo, setIsPauseVideo] = useState(false);
19466
19466
  const videoRef = useRef(null);
@@ -19563,15 +19563,6 @@ const VideoWidget = forwardRef(({ rec, index, height, data, muted, activeIndex,
19563
19563
  break;
19564
19564
  }
19565
19565
  }, [isLoadFinish]);
19566
- useCallback(() => {
19567
- var _a, _b, _c, _d, _e, _f;
19568
- data[index];
19569
- ((_b = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.duration) !== null && _b !== void 0 ? _b : 0).toFixed(2);
19570
- ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.currentTime) !== null && _d !== void 0 ? _d : 0).toFixed(2);
19571
- if ((_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.duration) {
19572
- (((_f = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _f === void 0 ? void 0 : _f.currentTime) - videoStartTime.current).toFixed(2);
19573
- }
19574
- }, [data, index, bffEventReport]);
19575
19566
  const blur = useMemo(() => {
19576
19567
  return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2';
19577
19568
  }, [videoPostConfig]);
@@ -19599,7 +19590,7 @@ const VideoWidget = forwardRef(({ rec, index, height, data, muted, activeIndex,
19599
19590
  if (!videoRef.current)
19600
19591
  return;
19601
19592
  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);
19602
- handleUpdateTimeline === null || handleUpdateTimeline === void 0 ? void 0 : handleUpdateTimeline(index, localTime);
19593
+ onUpdateTimeLine === null || onUpdateTimeLine === void 0 ? void 0 : onUpdateTimeLine(index, localTime);
19603
19594
  setTimeout(() => {
19604
19595
  var _a, _b;
19605
19596
  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)) {
@@ -19622,9 +19613,15 @@ const VideoWidget = forwardRef(({ rec, index, height, data, muted, activeIndex,
19622
19613
  };
19623
19614
  const handlePause = () => {
19624
19615
  setIsPauseVideo(true);
19616
+ onPause === null || onPause === void 0 ? void 0 : onPause();
19617
+ };
19618
+ const handlePlay = () => {
19619
+ var _a;
19620
+ 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);
19621
+ onPlay === null || onPlay === void 0 ? void 0 : onPlay(index, localTime);
19625
19622
  };
19626
19623
  useEffect(() => {
19627
- var _a, _b, _c;
19624
+ var _a, _b, _c, _d;
19628
19625
  if (!isActive)
19629
19626
  return;
19630
19627
  const videoSrc = rec === null || rec === void 0 ? void 0 : rec.mediaUrl;
@@ -19656,9 +19653,10 @@ const VideoWidget = forwardRef(({ rec, index, height, data, muted, activeIndex,
19656
19653
  // videoRef.current?.addEventListener('playing', handlePlaying);
19657
19654
  // videoRef.current?.addEventListener('loadeddata', handLoadeddata);
19658
19655
  (_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('pause', handlePause);
19659
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.addEventListener('timeupdate', handleTimeUpload);
19656
+ (_c = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _c === void 0 ? void 0 : _c.addEventListener('play', handlePlay);
19657
+ (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.addEventListener('timeupdate', handleTimeUpload);
19660
19658
  return () => {
19661
- var _a, _b, _c, _d;
19659
+ var _a, _b, _c, _d, _e;
19662
19660
  if (hlsRef === null || hlsRef === void 0 ? void 0 : hlsRef.current)
19663
19661
  (_a = hlsRef === null || hlsRef === void 0 ? void 0 : hlsRef.current) === null || _a === void 0 ? void 0 : _a.destroy();
19664
19662
  setIsLoadFinish(false);
@@ -19666,7 +19664,8 @@ const VideoWidget = forwardRef(({ rec, index, height, data, muted, activeIndex,
19666
19664
  // videoRef.current?.removeEventListener('playing', handlePlaying);
19667
19665
  // videoRef.current?.removeEventListener('loadeddata', handLoadeddata);
19668
19666
  (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.removeEventListener('pause', handlePause);
19669
- (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.removeEventListener('timeupdate', handleTimeUpload);
19667
+ (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.removeEventListener('play', handlePlay);
19668
+ (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.removeEventListener('timeupdate', handleTimeUpload);
19670
19669
  };
19671
19670
  }, [isActive]);
19672
19671
  const renderPoster = useMemo(() => {
@@ -19722,7 +19721,7 @@ var VideoWidget$1 = memo(VideoWidget);
19722
19721
  * @Author: binruan@chatlabs.com
19723
19722
  * @Date: 2025-03-25 13:54:27
19724
19723
  * @LastEditors: binruan@chatlabs.com
19725
- * @LastEditTime: 2025-03-31 14:29:21
19724
+ * @LastEditTime: 2025-04-01 17:54:08
19726
19725
  * @FilePath: \pb-sxp-ui\src\core\components\DiyStoryPreview\index.tsx
19727
19726
  *
19728
19727
  */
@@ -19910,7 +19909,7 @@ Object.values(_materials_).forEach((v) => {
19910
19909
  });
19911
19910
  const defaultUnLikeIconPath = '/pb_static/f71266d2c64446c5ae6a5a7f5489cc0a.png';
19912
19911
  const defaultLikeIconPath = '/pb_static/f07900fe3f0f4ae188ea1611d4801a44.png';
19913
- const DiyStoryPreview = forwardRef(({ data = [], globalConfig, tipText, nudge, tempMap, descStyle, hashTagStyle, containerHeight = 664, containerWidth = 375, appDomain, tagList = [], scenes, onActiveChange, activeIndex, loopPlay = false, pointerEvents = 'none', onUpdateTimeLine, disabledListener }, ref) => {
19912
+ const DiyStoryPreview = 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) => {
19914
19913
  const videoWidgetRef = useRef(null);
19915
19914
  const swiperRef = useRef(null);
19916
19915
  const [curIndex, setCurIndex] = useState(0);
@@ -19943,10 +19942,6 @@ const DiyStoryPreview = forwardRef(({ data = [], globalConfig, tipText, nudge, t
19943
19942
  isPlaying() {
19944
19943
  var _a, _b;
19945
19944
  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;
19946
- },
19947
- setLoopPlay(v) {
19948
- var _a;
19949
- (_a = videoWidgetRef === null || videoWidgetRef === void 0 ? void 0 : videoWidgetRef.current) === null || _a === void 0 ? void 0 : _a.setLoopPlay(v);
19950
19945
  }
19951
19946
  };
19952
19947
  });
@@ -19964,7 +19959,7 @@ const DiyStoryPreview = forwardRef(({ data = [], globalConfig, tipText, nudge, t
19964
19959
  const renderContent = (rec, index) => {
19965
19960
  const isVideo = isVideoUrl(rec === null || rec === void 0 ? void 0 : rec.mediaUrl);
19966
19961
  if (isVideo) {
19967
- 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 })));
19962
+ 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 })));
19968
19963
  }
19969
19964
  else {
19970
19965
  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 }));