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.js CHANGED
@@ -17662,7 +17662,7 @@ const mountVideoPlayerAtNode = (() => {
17662
17662
  })();
17663
17663
 
17664
17664
  const VideoWidget$4 = forwardRef(({ rec, index, height, data, muted, activeIndex, videoPostConfig, videoPlayIcon, loopPlay, swiperRef }, ref) => {
17665
- var _a, _b, _c, _d, _e;
17665
+ var _a, _b;
17666
17666
  const [isPauseVideo, setIsPauseVideo] = useState(false);
17667
17667
  const { bffEventReport, sxpParameter, waterFallData, openHashtag, bffFbReport, isDiyH5 } = useSxpDataSource();
17668
17668
  const videoStartTime = useRef(0);
@@ -17682,9 +17682,7 @@ const VideoWidget$4 = forwardRef(({ rec, index, height, data, muted, activeIndex
17682
17682
  const scene = rec.video.scene;
17683
17683
  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);
17684
17684
  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;
17685
- const videoPoster = (scene === null || scene === void 0 ? void 0 : scene.mediaUrl)
17686
- ? (_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
17687
- : (_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;
17685
+ const videoPoster = videoCover || (sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image);
17688
17686
  useImperativeHandle(ref, () => {
17689
17687
  return {
17690
17688
  setLoopPlay(v) {
@@ -17740,22 +17738,27 @@ const VideoWidget$4 = forwardRef(({ rec, index, height, data, muted, activeIndex
17740
17738
  setIsLoadFinish(true);
17741
17739
  }, []);
17742
17740
  const handleStartPlay = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
17743
- var _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
17741
+ var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
17744
17742
  if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current))
17745
17743
  return;
17746
17744
  setIsPauseVideo(false);
17747
17745
  const item = data[index];
17748
- if (item && ((_f = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _f === void 0 ? void 0 : _f.duration)) {
17749
- videoStartTime.current = ((_g = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _g === void 0 ? void 0 : _g.currentTime) || 0;
17750
- 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);
17751
- 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);
17746
+ if (item && ((_c = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _c === void 0 ? void 0 : _c.duration)) {
17747
+ videoStartTime.current = ((_d = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _d === void 0 ? void 0 : _d.currentTime) || 0;
17748
+ 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);
17749
+ 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);
17752
17750
  const playType = (isFirstPlayRef === null || isFirstPlayRef === void 0 ? void 0 : isFirstPlayRef.current) ? '0' : '1';
17753
17751
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
17754
- 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) + '' }))
17752
+ 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) + '' }))
17755
17753
  });
17756
17754
  isFirstPlayRef.current = false;
17757
17755
  }
17758
17756
  }), [bffEventReport, data, index, isFirstPlayRef, videoRef === null || videoRef === void 0 ? void 0 : videoRef.current]);
17757
+ const setCurrentTimeByStartTime = useCallback(() => {
17758
+ if (isDiyH5) {
17759
+ videoRef.current.currentTime = scene === null || scene === void 0 ? void 0 : scene.startTime;
17760
+ }
17761
+ }, []);
17759
17762
  const handLoadeddata = useCallback(() => {
17760
17763
  if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || firstFrameSrc || !blur)
17761
17764
  return;
@@ -17780,9 +17783,7 @@ const VideoWidget$4 = forwardRef(({ rec, index, height, data, muted, activeIndex
17780
17783
  const handleLoadedmetadata = useCallback(() => {
17781
17784
  if (!videoRef.current)
17782
17785
  return;
17783
- if (isDiyH5) {
17784
- videoRef.current.currentTime = scene === null || scene === void 0 ? void 0 : scene.startTime;
17785
- }
17786
+ setCurrentTimeByStartTime();
17786
17787
  loadedTimeRef.current = new Date();
17787
17788
  handleStartPlay();
17788
17789
  handLoadeddata();
@@ -17894,7 +17895,7 @@ const VideoWidget$4 = forwardRef(({ rec, index, height, data, muted, activeIndex
17894
17895
  hls === null || hls === void 0 ? void 0 : hls.attachMedia(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current);
17895
17896
  hls === null || hls === void 0 ? void 0 : hls.on(Hls.Events.MANIFEST_PARSED, function () {
17896
17897
  var _a;
17897
- videoRef.current.currentTime = scene === null || scene === void 0 ? void 0 : scene.startTime;
17898
+ setCurrentTimeByStartTime();
17898
17899
  (_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
17899
17900
  });
17900
17901
  }