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/pb-ui.js CHANGED
@@ -17677,7 +17677,7 @@ Made in Italy` })));
17677
17677
  })();
17678
17678
 
17679
17679
  const VideoWidget$4 = React.forwardRef(({ rec, index, height, data, muted, activeIndex, videoPostConfig, videoPlayIcon, loopPlay, swiperRef }, ref) => {
17680
- var _a, _b, _c, _d, _e;
17680
+ var _a, _b;
17681
17681
  const [isPauseVideo, setIsPauseVideo] = React.useState(false);
17682
17682
  const { bffEventReport, sxpParameter, waterFallData, openHashtag, bffFbReport, isDiyH5 } = useSxpDataSource();
17683
17683
  const videoStartTime = React.useRef(0);
@@ -17697,9 +17697,7 @@ Made in Italy` })));
17697
17697
  const scene = rec.video.scene;
17698
17698
  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);
17699
17699
  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;
17700
- const videoPoster = (scene === null || scene === void 0 ? void 0 : scene.mediaUrl)
17701
- ? (_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
17702
- : (_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;
17700
+ const videoPoster = videoCover || (sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image);
17703
17701
  React.useImperativeHandle(ref, () => {
17704
17702
  return {
17705
17703
  setLoopPlay(v) {
@@ -17755,22 +17753,27 @@ Made in Italy` })));
17755
17753
  setIsLoadFinish(true);
17756
17754
  }, []);
17757
17755
  const handleStartPlay = React.useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
17758
- var _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
17756
+ var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
17759
17757
  if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current))
17760
17758
  return;
17761
17759
  setIsPauseVideo(false);
17762
17760
  const item = data[index];
17763
- if (item && ((_f = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _f === void 0 ? void 0 : _f.duration)) {
17764
- videoStartTime.current = ((_g = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _g === void 0 ? void 0 : _g.currentTime) || 0;
17765
- 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);
17766
- 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);
17761
+ if (item && ((_c = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _c === void 0 ? void 0 : _c.duration)) {
17762
+ videoStartTime.current = ((_d = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _d === void 0 ? void 0 : _d.currentTime) || 0;
17763
+ 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);
17764
+ 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);
17767
17765
  const playType = (isFirstPlayRef === null || isFirstPlayRef === void 0 ? void 0 : isFirstPlayRef.current) ? '0' : '1';
17768
17766
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
17769
- 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) + '' }))
17767
+ 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) + '' }))
17770
17768
  });
17771
17769
  isFirstPlayRef.current = false;
17772
17770
  }
17773
17771
  }), [bffEventReport, data, index, isFirstPlayRef, videoRef === null || videoRef === void 0 ? void 0 : videoRef.current]);
17772
+ const setCurrentTimeByStartTime = React.useCallback(() => {
17773
+ if (isDiyH5) {
17774
+ videoRef.current.currentTime = scene === null || scene === void 0 ? void 0 : scene.startTime;
17775
+ }
17776
+ }, []);
17774
17777
  const handLoadeddata = React.useCallback(() => {
17775
17778
  if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || firstFrameSrc || !blur)
17776
17779
  return;
@@ -17795,9 +17798,7 @@ Made in Italy` })));
17795
17798
  const handleLoadedmetadata = React.useCallback(() => {
17796
17799
  if (!videoRef.current)
17797
17800
  return;
17798
- if (isDiyH5) {
17799
- videoRef.current.currentTime = scene === null || scene === void 0 ? void 0 : scene.startTime;
17800
- }
17801
+ setCurrentTimeByStartTime();
17801
17802
  loadedTimeRef.current = new Date();
17802
17803
  handleStartPlay();
17803
17804
  handLoadeddata();
@@ -17909,7 +17910,7 @@ Made in Italy` })));
17909
17910
  hls === null || hls === void 0 ? void 0 : hls.attachMedia(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current);
17910
17911
  hls === null || hls === void 0 ? void 0 : hls.on(Hls.Events.MANIFEST_PARSED, function () {
17911
17912
  var _a;
17912
- videoRef.current.currentTime = scene === null || scene === void 0 ? void 0 : scene.startTime;
17913
+ setCurrentTimeByStartTime();
17913
17914
  (_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
17914
17915
  });
17915
17916
  }