pb-sxp-ui 1.15.22-alpha.4 → 1.15.22-alpha.5

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
@@ -17684,7 +17684,7 @@ const mountVideoPlayerAtNode = (() => {
17684
17684
  })();
17685
17685
 
17686
17686
  const VideoWidget$4 = React.forwardRef(({ rec, index, height, data, muted, activeIndex, videoPostConfig, videoPlayIcon, loopPlay, swiperRef }, ref) => {
17687
- var _a, _b, _c, _d, _e;
17687
+ var _a, _b;
17688
17688
  const [isPauseVideo, setIsPauseVideo] = React.useState(false);
17689
17689
  const { bffEventReport, sxpParameter, waterFallData, openHashtag, bffFbReport, isDiyH5 } = useSxpDataSource();
17690
17690
  const videoStartTime = React.useRef(0);
@@ -17704,9 +17704,7 @@ const VideoWidget$4 = React.forwardRef(({ rec, index, height, data, muted, activ
17704
17704
  const scene = rec.video.scene;
17705
17705
  const videoUrl = (scene === null || scene === void 0 ? void 0 : scene.mediaUrl) || ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.url);
17706
17706
  const videoCover = (scene === null || scene === void 0 ? void 0 : scene.mediaUrl) ? scene === null || scene === void 0 ? void 0 : scene.cover : (_b = rec === null || rec === void 0 ? void 0 : rec.video) === null || _b === void 0 ? void 0 : _b.cover;
17707
- const videoPoster = (scene === null || scene === void 0 ? void 0 : scene.mediaUrl)
17708
- ? (_c = scene === null || scene === void 0 ? void 0 : scene.cover) !== null && _c !== void 0 ? _c : sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image
17709
- : (_e = (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.cover) !== null && _e !== void 0 ? _e : sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image;
17707
+ const videoPoster = videoCover || (sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image);
17710
17708
  React.useImperativeHandle(ref, () => {
17711
17709
  return {
17712
17710
  setLoopPlay(v) {
@@ -17762,22 +17760,27 @@ const VideoWidget$4 = React.forwardRef(({ rec, index, height, data, muted, activ
17762
17760
  setIsLoadFinish(true);
17763
17761
  }, []);
17764
17762
  const handleStartPlay = React.useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
17765
- var _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
17763
+ var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
17766
17764
  if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current))
17767
17765
  return;
17768
17766
  setIsPauseVideo(false);
17769
17767
  const item = data[index];
17770
- if (item && ((_f = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _f === void 0 ? void 0 : _f.duration)) {
17771
- videoStartTime.current = ((_g = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _g === void 0 ? void 0 : _g.currentTime) || 0;
17772
- const videoDuration = ((_j = (_h = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _h === void 0 ? void 0 : _h.duration) !== null && _j !== void 0 ? _j : 0).toFixed(2);
17773
- const videoCurrentTime = ((_l = (_k = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _k === void 0 ? void 0 : _k.currentTime) !== null && _l !== void 0 ? _l : 0).toFixed(2);
17768
+ if (item && ((_c = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _c === void 0 ? void 0 : _c.duration)) {
17769
+ videoStartTime.current = ((_d = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _d === void 0 ? void 0 : _d.currentTime) || 0;
17770
+ const videoDuration = ((_f = (_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.duration) !== null && _f !== void 0 ? _f : 0).toFixed(2);
17771
+ const videoCurrentTime = ((_h = (_g = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _g === void 0 ? void 0 : _g.currentTime) !== null && _h !== void 0 ? _h : 0).toFixed(2);
17774
17772
  const playType = (isFirstPlayRef === null || isFirstPlayRef === void 0 ? void 0 : isFirstPlayRef.current) ? '0' : '1';
17775
17773
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
17776
- eventInfo: Object.assign({ eventSubject: 'playVideo', eventDescription: 'User played the video', contentId: (_o = (_m = item === null || item === void 0 ? void 0 : item.video) === null || _m === void 0 ? void 0 : _m.itemId) !== null && _o !== void 0 ? _o : '', contentName: (_q = (_p = item === null || item === void 0 ? void 0 : item.video) === null || _p === void 0 ? void 0 : _p.title) !== null && _q !== void 0 ? _q : '', playType, startTime: videoCurrentTime, videoDuration, contentTags: JSON.stringify((_s = (_r = item === null || item === void 0 ? void 0 : item.video) === null || _r === void 0 ? void 0 : _r.tags) !== null && _s !== void 0 ? _s : []), position: index + '', contentFormat: 'video', traceInfo: (_t = item === null || item === void 0 ? void 0 : item.video) === null || _t === void 0 ? void 0 : _t.traceInfo }, ((isFirstPlayRef === null || isFirstPlayRef === void 0 ? void 0 : isFirstPlayRef.current) && { loadTime: (loadedTimeRef === null || loadedTimeRef === void 0 ? void 0 : loadedTimeRef.current) - (initTimeRef === null || initTimeRef === void 0 ? void 0 : initTimeRef.current) + '' }))
17774
+ eventInfo: Object.assign({ eventSubject: 'playVideo', eventDescription: 'User played the video', contentId: (_k = (_j = item === null || item === void 0 ? void 0 : item.video) === null || _j === void 0 ? void 0 : _j.itemId) !== null && _k !== void 0 ? _k : '', contentName: (_m = (_l = item === null || item === void 0 ? void 0 : item.video) === null || _l === void 0 ? void 0 : _l.title) !== null && _m !== void 0 ? _m : '', playType, startTime: videoCurrentTime, videoDuration, contentTags: JSON.stringify((_p = (_o = item === null || item === void 0 ? void 0 : item.video) === null || _o === void 0 ? void 0 : _o.tags) !== null && _p !== void 0 ? _p : []), position: index + '', contentFormat: 'video', traceInfo: (_q = item === null || item === void 0 ? void 0 : item.video) === null || _q === void 0 ? void 0 : _q.traceInfo }, ((isFirstPlayRef === null || isFirstPlayRef === void 0 ? void 0 : isFirstPlayRef.current) && { loadTime: (loadedTimeRef === null || loadedTimeRef === void 0 ? void 0 : loadedTimeRef.current) - (initTimeRef === null || initTimeRef === void 0 ? void 0 : initTimeRef.current) + '' }))
17777
17775
  });
17778
17776
  isFirstPlayRef.current = false;
17779
17777
  }
17780
17778
  }), [bffEventReport, data, index, isFirstPlayRef, videoRef === null || videoRef === void 0 ? void 0 : videoRef.current]);
17779
+ const setCurrentTimeByStartTime = React.useCallback(() => {
17780
+ if (isDiyH5) {
17781
+ videoRef.current.currentTime = scene === null || scene === void 0 ? void 0 : scene.startTime;
17782
+ }
17783
+ }, []);
17781
17784
  const handLoadeddata = React.useCallback(() => {
17782
17785
  if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || firstFrameSrc || !blur)
17783
17786
  return;
@@ -17802,9 +17805,7 @@ const VideoWidget$4 = React.forwardRef(({ rec, index, height, data, muted, activ
17802
17805
  const handleLoadedmetadata = React.useCallback(() => {
17803
17806
  if (!videoRef.current)
17804
17807
  return;
17805
- if (isDiyH5) {
17806
- videoRef.current.currentTime = scene === null || scene === void 0 ? void 0 : scene.startTime;
17807
- }
17808
+ setCurrentTimeByStartTime();
17808
17809
  loadedTimeRef.current = new Date();
17809
17810
  handleStartPlay();
17810
17811
  handLoadeddata();
@@ -17916,7 +17917,7 @@ const VideoWidget$4 = React.forwardRef(({ rec, index, height, data, muted, activ
17916
17917
  hls === null || hls === void 0 ? void 0 : hls.attachMedia(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current);
17917
17918
  hls === null || hls === void 0 ? void 0 : hls.on(Hls.Events.MANIFEST_PARSED, function () {
17918
17919
  var _a;
17919
- videoRef.current.currentTime = scene === null || scene === void 0 ? void 0 : scene.startTime;
17920
+ setCurrentTimeByStartTime();
17920
17921
  (_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
17921
17922
  });
17922
17923
  }