pb-sxp-ui 1.15.15-alpha.1 → 1.15.15-alpha.2

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
@@ -19487,11 +19487,11 @@ const VideoWidget = React.forwardRef(({ rec, index, height, data, muted, activeI
19487
19487
  const [isPauseVideo, setIsPauseVideo] = React.useState(false);
19488
19488
  const videoRef = React.useRef(null);
19489
19489
  const { bffEventReport, sxpParameter, waterFallData, openHashtag } = useSxpDataSource();
19490
- const videoStartTime = React.useRef(0);
19490
+ React.useRef(0);
19491
19491
  const [isLoadFinish, setIsLoadFinish] = React.useState(false);
19492
- const [isFirstPlay, setIsFirstPlay] = React.useState(true);
19493
- const canvasRef = React.useRef(null);
19494
- const [firstFrameSrc, setFirstFrameSrc] = React.useState('');
19492
+ React.useState(true);
19493
+ React.useRef(null);
19494
+ React.useState('');
19495
19495
  const videoId = `pb-cache-video-${index}`;
19496
19496
  const hlsRef = React.useRef(null);
19497
19497
  const loopPlayRef = React.useRef(loopPlay);
@@ -19516,8 +19516,6 @@ const VideoWidget = React.forwardRef(({ rec, index, height, data, muted, activeI
19516
19516
  setIsPauseVideo(true);
19517
19517
  },
19518
19518
  setLoopPlay(v) {
19519
- if (!videoRef.current)
19520
- return;
19521
19519
  loopPlayRef.current = v;
19522
19520
  },
19523
19521
  isPlaying() {
@@ -19531,22 +19529,7 @@ const VideoWidget = React.forwardRef(({ rec, index, height, data, muted, activeI
19531
19529
  return;
19532
19530
  videoRef.current.muted = muted;
19533
19531
  }, [muted]);
19534
- React.useCallback(() => {
19535
- var _a;
19536
- (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
19537
- }, []);
19538
19532
  const PAUSE_ICON = useIconLink('/pb_static/06f28a2025c74c1cb49be6767316d827.png');
19539
- React.useCallback(() => {
19540
- var _a, _b, _c, _d, _e, _f;
19541
- setIsPauseVideo(false);
19542
- const item = data[index];
19543
- if (item && ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.duration)) {
19544
- videoStartTime.current = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.currentTime) || 0;
19545
- ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.duration) !== null && _d !== void 0 ? _d : 0).toFixed(2);
19546
- ((_f = (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.currentTime) !== null && _f !== void 0 ? _f : 0).toFixed(2);
19547
- setIsFirstPlay(false);
19548
- }
19549
- }, [bffEventReport, data, index, isFirstPlay]);
19550
19533
  const handleLoadedMetadata = React.useCallback(() => {
19551
19534
  var _a;
19552
19535
  videoRef.current.currentTime = rec === null || rec === void 0 ? void 0 : rec.startTime;
@@ -19588,50 +19571,24 @@ const VideoWidget = React.forwardRef(({ rec, index, height, data, muted, activeI
19588
19571
  const blur = React.useMemo(() => {
19589
19572
  return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2';
19590
19573
  }, [videoPostConfig]);
19591
- React.useMemo(() => {
19592
- var _a;
19593
- return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2'
19594
- ? `translateY(-${50 + ((_a = videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.offsetTop) !== null && _a !== void 0 ? _a : 0)}%) translate3d(0px, 0px, 0px)`
19595
- : 'translateY(-50%)';
19596
- }, [videoPostConfig]);
19597
- React.useCallback(() => {
19598
- if (!canvasRef || !videoRef || !videoRef.current || !canvasRef.current)
19599
- return;
19600
- const video = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current;
19601
- const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
19602
- const ctx = canvas.getContext('2d');
19603
- const targetWidth = window === null || window === void 0 ? void 0 : window.innerWidth;
19604
- const targetHeight = window === null || window === void 0 ? void 0 : window.innerHeight;
19605
- canvas.height = targetHeight;
19606
- canvas.width = targetWidth;
19607
- ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
19608
- setFirstFrameSrc(canvas.toDataURL());
19609
- }, []);
19610
- const handleTimeUpload = React.useCallback(() => {
19611
- var _a;
19574
+ const handleTimeUpload = () => {
19612
19575
  if (!videoRef.current)
19613
19576
  return;
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);
19615
- onUpdateTimeLine === null || onUpdateTimeLine === void 0 ? void 0 : onUpdateTimeLine(index, localTime);
19616
19577
  setTimeout(() => {
19617
- var _a, _b;
19578
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
19618
19579
  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)) {
19619
- slideSwiper();
19580
+ (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.pause();
19581
+ if (!loopPlayRef.current)
19582
+ return;
19583
+ if (index === (data === null || data === void 0 ? void 0 : data.length) - 1) {
19584
+ (_e = (_d = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _d === void 0 ? void 0 : _d.swiper) === null || _e === void 0 ? void 0 : _e.slideTo(0);
19585
+ }
19586
+ else {
19587
+ const i = (_g = (_f = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _f === void 0 ? void 0 : _f.swiper) === null || _g === void 0 ? void 0 : _g.activeIndex;
19588
+ (_j = (_h = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _h === void 0 ? void 0 : _h.swiper) === null || _j === void 0 ? void 0 : _j.slideTo(i + 1);
19589
+ }
19620
19590
  }
19621
19591
  });
19622
- }, []);
19623
- const slideSwiper = () => {
19624
- var _a, _b, _c, _d, _e, _f, _g;
19625
- (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.pause();
19626
- if (!loopPlayRef.current)
19627
- return;
19628
- if (index === (data === null || data === void 0 ? void 0 : data.length) - 1) {
19629
- (_c = (_b = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _b === void 0 ? void 0 : _b.swiper) === null || _c === void 0 ? void 0 : _c.slideTo(0);
19630
- }
19631
- else {
19632
- const i = (_e = (_d = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _d === void 0 ? void 0 : _d.swiper) === null || _e === void 0 ? void 0 : _e.activeIndex;
19633
- (_g = (_f = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _f === void 0 ? void 0 : _f.swiper) === null || _g === void 0 ? void 0 : _g.slideTo(i + 1);
19634
- }
19635
19592
  };
19636
19593
  const handlePause = () => {
19637
19594
  setIsPauseVideo(true);
@@ -19743,7 +19700,7 @@ var VideoWidget$1 = React.memo(VideoWidget);
19743
19700
  * @Author: binruan@chatlabs.com
19744
19701
  * @Date: 2025-03-25 13:54:27
19745
19702
  * @LastEditors: binruan@chatlabs.com
19746
- * @LastEditTime: 2025-04-01 17:54:08
19703
+ * @LastEditTime: 2025-04-02 13:53:15
19747
19704
  * @FilePath: \pb-sxp-ui\src\core\components\DiyStoryPreview\index.tsx
19748
19705
  *
19749
19706
  */
@@ -20046,7 +20003,7 @@ const DiyStoryPreview = React.forwardRef(({ data = [], globalConfig, tipText, nu
20046
20003
  const renderLikeButton = (rec, index) => {
20047
20004
  var _a, _b, _c, _d;
20048
20005
  if (!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLike))
20049
- return;
20006
+ return null;
20050
20007
  let top = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconY) !== null && _a !== void 0 ? _a : 400;
20051
20008
  if (top < 40) {
20052
20009
  top += 40;
@@ -20076,12 +20033,12 @@ const DiyStoryPreview = React.forwardRef(({ data = [], globalConfig, tipText, nu
20076
20033
  const renderToggleButton = (visible) => {
20077
20034
  var _a, _b, _c, _d;
20078
20035
  if (!visible)
20079
- return;
20036
+ return null;
20080
20037
  let top = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconY) !== null && _a !== void 0 ? _a : 23;
20081
20038
  if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) === 'top') {
20082
20039
  top += 45;
20083
20040
  }
20084
- return (((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowMute) === undefined || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowMute) === true) && (React.createElement(ToggleButton$1, { style: {
20041
+ return (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowMute) === undefined || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowMute) === true ? (React.createElement(ToggleButton$1, { style: {
20085
20042
  position: 'absolute',
20086
20043
  visibility: 'visible',
20087
20044
  zIndex: 999,
@@ -20095,7 +20052,7 @@ const DiyStoryPreview = React.forwardRef(({ data = [], globalConfig, tipText, nu
20095
20052
  border: 'none',
20096
20053
  boxSizing: 'content-box',
20097
20054
  padding: 0
20098
- }, defaultValue: true, activeIcon: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.unMuteIcon) ? globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.unMuteIcon : mutedIcon, unactiveIcon: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIcon) ? globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIcon : unmutedIcon })));
20055
+ }, defaultValue: true, activeIcon: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.unMuteIcon) ? globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.unMuteIcon : mutedIcon, unactiveIcon: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIcon) ? globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIcon : unmutedIcon })) : null;
20099
20056
  };
20100
20057
  const renderView = (item, index) => {
20101
20058
  var _a, _b, _c, _d;