pb-sxp-ui 1.0.42 → 1.0.44

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
@@ -444,6 +444,7 @@
444
444
  const [cacheRtcList, setCacheRtcList] = React.useState([]);
445
445
  const [cacheActiveIndex, setCacheActiveIndex] = React.useState(0);
446
446
  const [isFromHashtag, setIsFromHashtag] = React.useState(false);
447
+ const [videoRef, setVideoRef] = React.useState(null);
447
448
  React.useEffect(() => {
448
449
  setOpenHashtag(isOpenHashTag);
449
450
  }, [isOpenHashTag]);
@@ -649,7 +650,9 @@
649
650
  loadingImage: loadingImage !== null && loadingImage !== void 0 ? loadingImage : defaultLoadingImage,
650
651
  isOpenHashTag,
651
652
  tagList,
652
- setLoading
653
+ setLoading,
654
+ videoRef,
655
+ setVideoRef
653
656
  } }, render({
654
657
  rtcList,
655
658
  mutateLike: bffMutateLike,
@@ -8405,10 +8408,10 @@
8405
8408
  React.createElement("div", { className: 'pb-commondity-content-title', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.title, hidden: !!product && !(product === null || product === void 0 ? void 0 : product.title) }, (_b = product === null || product === void 0 ? void 0 : product.title) !== null && _b !== void 0 ? _b : 'Pendant in Yellow Gold with Diamonds, Medium'),
8406
8409
  React.createElement("div", { className: 'pb-commondity-content-price', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price, hidden: !!product && !(product === null || product === void 0 ? void 0 : product.price) }, priceText),
8407
8410
  React.createElement("div", { hidden: !!product && (!(product === null || product === void 0 ? void 0 : product.info) || (product === null || product === void 0 ? void 0 : product.info) === '') },
8408
- React.createElement(ExpandableText$1, { foldText: tipText === null || tipText === void 0 ? void 0 : tipText.foldText, unfoldText: tipText === null || tipText === void 0 ? void 0 : tipText.unfoldText, onClick: () => setShowModal(true), isPost: isPost, text: (_c = product === null || product === void 0 ? void 0 : product.info) !== null && _c !== void 0 ? _c : `The design inspiration of Tiffany Lock series comes from the power of connection and inclusiveness, and the
8409
- bold and avant-garde visual design interprets the emotional bond connecting my heart. The Tiffany Lock
8410
- collection is unisex and is inspired by the padlock pattern found in the Tiffany Antique Collection. This
8411
- necklace features a stylish and eye-catching oval clasp chain decorated with a lock pattern. Crafted from
8411
+ React.createElement(ExpandableText$1, { foldText: tipText === null || tipText === void 0 ? void 0 : tipText.foldText, unfoldText: tipText === null || tipText === void 0 ? void 0 : tipText.unfoldText, onClick: () => setShowModal(true), isPost: isPost, text: (_c = product === null || product === void 0 ? void 0 : product.info) !== null && _c !== void 0 ? _c : `The design inspiration of Tiffany Lock series comes from the power of connection and inclusiveness, and the
8412
+ bold and avant-garde visual design interprets the emotional bond connecting my heart. The Tiffany Lock
8413
+ collection is unisex and is inspired by the padlock pattern found in the Tiffany Antique Collection. This
8414
+ necklace features a stylish and eye-catching oval clasp chain decorated with a lock pattern. Crafted from
8412
8415
  18-karat gold, this necklace is embellished with hand-set diamonds.`, maxStr: 79, className: 'pb-commondity-content-info', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.info }))));
8413
8416
  };
8414
8417
  const renderBtn = () => {
@@ -8859,7 +8862,7 @@
8859
8862
  const productInfoText = ({ isPost }) => {
8860
8863
  return (React.createElement("div", { hidden: !!product && (!(product === null || product === void 0 ? void 0 : product.info) || (product === null || product === void 0 ? void 0 : product.info) === '') },
8861
8864
  React.createElement(ExpandableText$1, { isPost: isPost, onClick: () => setShowModal(true), className: 'pb-commondityDiroNew-info', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.info, foldText: tipText === null || tipText === void 0 ? void 0 : tipText.foldText, unfoldText: tipText === null || tipText === void 0 ? void 0 : tipText.unfoldText, text: (product === null || product === void 0 ? void 0 : product.info) ||
8862
- `Unveiled at the Spring-Summer 2023 fashion show, the Dior Toujours bag is distinguished by a casual and practical design. Crafted in black calfskin with Macrocannage topstitching, it showcases a spacious interior compartment with a matching pouch to organize essentials. Its leather strap closure keeps items secure while the D of the CD Lock closure twists to adjust the sides and enhance the bag's silhouette. The leather handles can be adjusted using the small notches in order to be able to carry the large bag by hand or wear it over the shoulder. CD Lock and strap closures D.I.O.R. charms Removable interior pouch Adjustable leather handles Dust bag included
8865
+ `Unveiled at the Spring-Summer 2023 fashion show, the Dior Toujours bag is distinguished by a casual and practical design. Crafted in black calfskin with Macrocannage topstitching, it showcases a spacious interior compartment with a matching pouch to organize essentials. Its leather strap closure keeps items secure while the D of the CD Lock closure twists to adjust the sides and enhance the bag's silhouette. The leather handles can be adjusted using the small notches in order to be able to carry the large bag by hand or wear it over the shoulder. CD Lock and strap closures D.I.O.R. charms Removable interior pouch Adjustable leather handles Dust bag included
8863
8866
  Made in Italy` })));
8864
8867
  };
8865
8868
  return (React.createElement("div", { className: 'pb-commondityDiroNew' },
@@ -12007,9 +12010,8 @@ Made in Italy` })));
12007
12010
  SXP_EVENT_TYPE["PAGE_DID_HIDE"] = "pageDidHide";
12008
12011
  })(SXP_EVENT_TYPE || (SXP_EVENT_TYPE = {}));
12009
12012
 
12010
- const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPostConfig }) => {
12013
+ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPostConfig, videoRef }) => {
12011
12014
  const [isPauseVideo, setIsPauseVideo] = React.useState(false);
12012
- const videoRef = React.useRef(null);
12013
12015
  const { bffEventReport, sxpParameter, waterFallData, openHashtag } = useSxpDataSource();
12014
12016
  const videoStartTime = React.useRef(0);
12015
12017
  const [isLoadFinish, setIsLoadFinish] = React.useState(false);
@@ -12017,99 +12019,118 @@ Made in Italy` })));
12017
12019
  const { isActive } = useSwiperSlide();
12018
12020
  const canvasRef = React.useRef(null);
12019
12021
  const [firstFrameSrc, setFirstFrameSrc] = React.useState('');
12022
+ const videoId = `pb-cache-video-${index}`;
12023
+ const videoEleRef = React.useRef(null);
12020
12024
  React.useEffect(() => {
12021
- if (!videoRef.current)
12025
+ if (!videoRef)
12022
12026
  return;
12023
- videoRef.current.muted = muted;
12024
- }, [muted]);
12025
- const handleVideoStart = React.useCallback(() => {
12026
- var _a;
12027
- (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
12028
- }, []);
12027
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.muted(muted);
12028
+ }, [muted, videoRef]);
12029
+ const handleEnded = React.useCallback(() => {
12030
+ if (!videoRef)
12031
+ return;
12032
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
12033
+ }, [videoRef]);
12029
12034
  const PAUSE_ICON = useIconLink('/pb_static/06f28a2025c74c1cb49be6767316d827.png');
12030
12035
  const handlePlaying = React.useCallback(() => {
12031
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
12036
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
12037
+ if (!videoRef)
12038
+ return;
12032
12039
  setIsPauseVideo(false);
12033
12040
  const item = data[index];
12034
- if (item && ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.duration)) {
12035
- videoStartTime.current = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.currentTime) || 0;
12036
- const videoDuration = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.duration) !== null && _d !== void 0 ? _d : 0).toFixed(2);
12037
- const videoCurrentTime = ((_f = (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.currentTime) !== null && _f !== void 0 ? _f : 0).toFixed(2);
12041
+ if (item && (videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration())) {
12042
+ videoStartTime.current = (videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime()) || 0;
12043
+ const videoDuration = ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration()) !== null && _a !== void 0 ? _a : 0).toFixed(2);
12044
+ const videoCurrentTime = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime()) !== null && _b !== void 0 ? _b : 0).toFixed(2);
12038
12045
  const playType = isFirstPlay ? '0' : '1';
12039
12046
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
12040
12047
  eventInfo: {
12041
12048
  eventSubject: 'playVideo',
12042
12049
  eventDescription: 'User played the video',
12043
- contentId: (_h = (_g = item.video) === null || _g === void 0 ? void 0 : _g.itemId) !== null && _h !== void 0 ? _h : '',
12044
- contentName: (_k = (_j = item.video) === null || _j === void 0 ? void 0 : _j.title) !== null && _k !== void 0 ? _k : '',
12050
+ contentId: (_d = (_c = item.video) === null || _c === void 0 ? void 0 : _c.itemId) !== null && _d !== void 0 ? _d : '',
12051
+ contentName: (_f = (_e = item.video) === null || _e === void 0 ? void 0 : _e.title) !== null && _f !== void 0 ? _f : '',
12045
12052
  playType,
12046
12053
  startTime: videoCurrentTime,
12047
12054
  videoDuration,
12048
- contentTags: JSON.stringify((_m = (_l = item.video) === null || _l === void 0 ? void 0 : _l.tags) !== null && _m !== void 0 ? _m : []),
12055
+ contentTags: JSON.stringify((_h = (_g = item.video) === null || _g === void 0 ? void 0 : _g.tags) !== null && _h !== void 0 ? _h : []),
12049
12056
  position: index + '',
12050
12057
  contentFormat: 'video',
12051
- traceInfo: (_o = item.video) === null || _o === void 0 ? void 0 : _o.traceInfo
12058
+ traceInfo: (_j = item.video) === null || _j === void 0 ? void 0 : _j.traceInfo
12052
12059
  }
12053
12060
  });
12054
12061
  setIsFirstPlay(false);
12055
12062
  }
12056
- }, [bffEventReport, data, index, isFirstPlay]);
12057
- const handleLoadedMetadata = React.useCallback(() => {
12063
+ }, [bffEventReport, data, index, isFirstPlay, videoRef]);
12064
+ const handleLoadedmetadata = React.useCallback(() => {
12065
+ if (!videoRef)
12066
+ return;
12067
+ if (activeIndex !== index) {
12068
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
12069
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.pause();
12070
+ }
12071
+ setIsLoadFinish(true);
12072
+ }, [activeIndex, index, videoRef]);
12073
+ const handleCanplay = React.useCallback(() => {
12058
12074
  setIsLoadFinish(true);
12059
12075
  }, []);
12060
12076
  const handleClickVideo = React.useCallback((type) => () => {
12061
- var _a, _b, _c, _d, _e;
12077
+ if (!videoRef)
12078
+ return;
12062
12079
  if (!isLoadFinish)
12063
12080
  return;
12064
- const isPause = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.paused;
12081
+ const isPause = videoRef === null || videoRef === void 0 ? void 0 : videoRef.paused();
12065
12082
  switch (type) {
12066
12083
  case 'start':
12067
12084
  if (!isPause)
12068
12085
  return;
12069
- (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.play();
12086
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
12070
12087
  setIsPauseVideo(false);
12071
12088
  break;
12072
12089
  case 'pause':
12073
12090
  if (isPause)
12074
12091
  return;
12075
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.pause();
12092
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.pause();
12076
12093
  setIsPauseVideo(true);
12077
12094
  break;
12078
12095
  default:
12079
12096
  if (isPause) {
12080
- (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.play();
12097
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
12081
12098
  }
12082
12099
  else {
12083
- (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.pause();
12100
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.pause();
12084
12101
  }
12085
12102
  setIsPauseVideo(!isPause);
12086
12103
  break;
12087
12104
  }
12088
- }, [isLoadFinish]);
12089
- const onPause = React.useCallback(() => {
12090
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
12105
+ }, [isLoadFinish, videoRef]);
12106
+ const handlePause = React.useCallback(() => {
12107
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
12108
+ if (!videoRef)
12109
+ return;
12110
+ if (activeIndex !== index)
12111
+ return;
12091
12112
  const item = data[index];
12092
- const videoDuration = ((_b = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.duration) !== null && _b !== void 0 ? _b : 0).toFixed(2);
12093
- const videoCurrentTime = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.currentTime) !== null && _d !== void 0 ? _d : 0).toFixed(2);
12094
- if ((_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.duration) {
12095
- const playDuration = (((_f = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _f === void 0 ? void 0 : _f.currentTime) - videoStartTime.current).toFixed(2);
12113
+ const videoDuration = ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration()) !== null && _a !== void 0 ? _a : 0).toFixed(2);
12114
+ const videoCurrentTime = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime()) !== null && _b !== void 0 ? _b : 0).toFixed(2);
12115
+ if (videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration()) {
12116
+ const playDuration = ((videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime()) - videoStartTime.current).toFixed(2);
12096
12117
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
12097
12118
  eventInfo: {
12098
12119
  eventSubject: 'playOverVideo',
12099
12120
  eventDescription: 'User finished playing the video',
12100
- contentId: (_h = (_g = item.video) === null || _g === void 0 ? void 0 : _g.itemId) !== null && _h !== void 0 ? _h : '',
12101
- contentName: (_k = (_j = item.video) === null || _j === void 0 ? void 0 : _j.title) !== null && _k !== void 0 ? _k : '',
12121
+ contentId: (_d = (_c = item.video) === null || _c === void 0 ? void 0 : _c.itemId) !== null && _d !== void 0 ? _d : '',
12122
+ contentName: (_f = (_e = item.video) === null || _e === void 0 ? void 0 : _e.title) !== null && _f !== void 0 ? _f : '',
12102
12123
  endTime: videoCurrentTime,
12103
12124
  videoDuration,
12104
12125
  playDuration,
12105
- contentTags: JSON.stringify((_m = (_l = item.video) === null || _l === void 0 ? void 0 : _l.tags) !== null && _m !== void 0 ? _m : []),
12126
+ contentTags: JSON.stringify((_h = (_g = item.video) === null || _g === void 0 ? void 0 : _g.tags) !== null && _h !== void 0 ? _h : []),
12106
12127
  position: index + '',
12107
12128
  contentFormat: 'video',
12108
- traceInfo: (_o = item.video) === null || _o === void 0 ? void 0 : _o.traceInfo
12129
+ traceInfo: (_j = item.video) === null || _j === void 0 ? void 0 : _j.traceInfo
12109
12130
  }
12110
12131
  });
12111
12132
  }
12112
- }, [data, index, bffEventReport]);
12133
+ }, [data, index, bffEventReport, videoRef]);
12113
12134
  const blur = React.useMemo(() => {
12114
12135
  return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2';
12115
12136
  }, [videoPostConfig]);
@@ -12124,82 +12145,82 @@ Made in Italy` })));
12124
12145
  return ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) || firstFrameSrc;
12125
12146
  }, [firstFrameSrc, rec]);
12126
12147
  const handLoadeddata = React.useCallback(() => {
12127
- if (!canvasRef || !videoRef || !videoRef.current || !canvasRef.current)
12148
+ var _a;
12149
+ if (!videoRef)
12128
12150
  return;
12129
- const video = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current;
12130
- const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
12131
- const ctx = canvas.getContext('2d');
12132
- const targetWidth = window === null || window === void 0 ? void 0 : window.innerWidth;
12133
- const targetHeight = window === null || window === void 0 ? void 0 : window.innerHeight;
12134
- canvas.height = targetHeight;
12135
- canvas.width = targetWidth;
12136
- ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
12137
- setFirstFrameSrc(canvas.toDataURL());
12138
- }, []);
12151
+ const videoDomRef = document.getElementById(`${videoId}_html5_api`);
12152
+ if (((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) || !canvasRef || !videoDomRef || !canvasRef.current)
12153
+ return;
12154
+ const setFrameImg = () => {
12155
+ const video = videoDomRef;
12156
+ const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
12157
+ const ctx = canvas.getContext('2d');
12158
+ const targetWidth = window === null || window === void 0 ? void 0 : window.innerWidth;
12159
+ const targetHeight = window === null || window === void 0 ? void 0 : window.innerHeight;
12160
+ canvas.height = targetHeight;
12161
+ canvas.width = targetWidth;
12162
+ ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
12163
+ setFirstFrameSrc(canvas.toDataURL());
12164
+ };
12165
+ setFrameImg();
12166
+ setTimeout(() => {
12167
+ setFrameImg();
12168
+ }, 500);
12169
+ }, [videoRef]);
12139
12170
  React.useEffect(() => {
12140
- var _a, _b, _c, _d;
12141
- if (!videoRef.current)
12171
+ if (!isActive || !videoRef)
12172
+ return;
12173
+ const videoSrc = rec.video.url;
12174
+ if (!videoSrc)
12142
12175
  return;
12143
12176
  setIsPauseVideo(false);
12144
- if (!videoRef.current.src) {
12145
- const videoSrc = rec.video.url;
12146
- // if (videoSrc.includes('.m3u8')) {
12147
- // if (Hls.isSupported()) {
12148
- // const hls = new Hls();
12149
- // hls.loadSource(videoSrc);
12150
- // hls.attachMedia(videoRef.current);
12151
- // hls.on(Hls.Events.MANIFEST_PARSED, function () {
12152
- // videoRef?.current?.play();
12153
- // });
12154
- // } else if (videoRef.current.canPlayType('application/vnd.apple.mpegurl')) {
12155
- // videoRef.current.src = videoSrc;
12156
- // } else {
12157
- // videoRef.current.src = videoSrc;
12158
- // }
12159
- // } else {
12160
- videoRef.current.src = videoSrc;
12161
- // }
12162
- videoRef.current.setAttribute('x5-playsinline', 'true');
12163
- videoRef.current.setAttribute('webkit-playsinline', 'true');
12164
- }
12165
- (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('loadedmetadata', handleLoadedMetadata);
12166
- (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('canplay', handleLoadedMetadata);
12167
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.addEventListener('playing', handlePlaying);
12168
- (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.addEventListener('loadeddata', handLoadeddata);
12177
+ const videoPlayerWrapperNode = document.querySelector(`#${videoId}`);
12178
+ const dom = document.querySelector('#player-container-id');
12179
+ const dom2 = document.querySelector('#player-container-id-copy');
12180
+ if (!dom && !dom2)
12181
+ return;
12182
+ videoPlayerWrapperNode === null || videoPlayerWrapperNode === void 0 ? void 0 : videoPlayerWrapperNode.appendChild(dom || dom2);
12183
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.src(videoSrc);
12184
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('loadedmetadata', handleLoadedmetadata);
12185
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('loadeddata', handLoadeddata);
12186
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('canplay', handleCanplay);
12187
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('playing', handlePlaying);
12188
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('pause', handlePause);
12189
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('ended', handleEnded);
12169
12190
  return () => {
12170
- var _a, _b, _c, _d;
12171
- (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('loadedmetadata', handleLoadedMetadata);
12172
- (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('canplay', handleLoadedMetadata);
12173
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.removeEventListener('playing', handlePlaying);
12174
- (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.removeEventListener('loadeddata', handLoadeddata);
12191
+ dom2 === null || dom2 === void 0 ? void 0 : dom2.appendChild(dom);
12192
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('loadedmetadata', handleLoadedmetadata);
12193
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('loadeddata', handLoadeddata);
12194
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('canplay', handleCanplay);
12195
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('playing', handlePlaying);
12196
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('pause', handlePause);
12197
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('ended', handleEnded);
12175
12198
  };
12176
- }, [handleLoadedMetadata, handlePlaying, rec.video, handLoadeddata]);
12199
+ }, [isActive, videoId, rec, videoRef]);
12177
12200
  React.useEffect(() => {
12178
- var _a;
12179
- if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || !isLoadFinish)
12201
+ if (!videoRef || !isLoadFinish)
12180
12202
  return;
12181
12203
  if (isActive) {
12182
- videoRef.current.play();
12204
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
12183
12205
  }
12184
12206
  else {
12185
- (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.pause();
12207
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.pause();
12186
12208
  }
12187
- }, [isActive, isLoadFinish]);
12209
+ }, [isActive, isLoadFinish, videoRef]);
12188
12210
  /*
12189
12211
  打开/关闭hashtag暂停/播放视频
12190
12212
  */
12191
12213
  React.useEffect(() => {
12192
- var _a, _b, _c;
12193
- if (!isActive || !(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current))
12214
+ if (!isActive || !videoRef)
12194
12215
  return;
12195
- const isPause = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.paused;
12216
+ const isPause = videoRef === null || videoRef === void 0 ? void 0 : videoRef.paused();
12196
12217
  if (!isPause && openHashtag) {
12197
- (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.pause();
12218
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.pause();
12198
12219
  }
12199
12220
  else if (!openHashtag) {
12200
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.play();
12221
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
12201
12222
  }
12202
- }, [openHashtag, isActive]);
12223
+ }, [openHashtag, isActive, videoRef]);
12203
12224
  React.useEffect(() => {
12204
12225
  if (!isActive)
12205
12226
  return;
@@ -12219,9 +12240,11 @@ Made in Italy` })));
12219
12240
  return (React.createElement("img", { style: { position: 'absolute', left: 0, top: 0, width: '100%', height: '100%', objectFit: 'cover' }, src: sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image }));
12220
12241
  }, [isLoadFinish, sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image]);
12221
12242
  React.useEffect(() => {
12243
+ if (!videoRef)
12244
+ return;
12222
12245
  const handleBeforeUnload = () => {
12223
- var _a, _b;
12224
- if (activeIndex === index && ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.url) && ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.src) && !isPauseVideo) {
12246
+ var _a;
12247
+ if (activeIndex === index && ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.url) && videoRef && !isPauseVideo) {
12225
12248
  handleClickVideo('pause')();
12226
12249
  }
12227
12250
  };
@@ -12259,19 +12282,15 @@ Made in Italy` })));
12259
12282
  right: 0
12260
12283
  } },
12261
12284
  React.createElement("div", { style: { position: 'relative', width: '100%', height: '100%' } },
12262
- React.createElement("video", { id: `pb-video-${index}`, className: 'clc-pb-video', ref: videoRef, crossOrigin: 'anonymous', muted: true, controls: false, playsInline: true, preload: 'auto', onPause: onPause, onEnded: handleVideoStart, style: {
12263
- width: '100%',
12264
- height: '100%',
12265
- objectFit: 'contain'
12266
- } }),
12285
+ React.createElement("div", { className: 'n-full-screen', ref: videoEleRef, id: videoId, style: { width: '100%', height: '100%' } }),
12267
12286
  React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON }))),
12268
- renderPoster)) : (React.createElement("div", { className: 'video-container', key: rec.video.itemId, onClick: handleClickVideo(), style: {
12287
+ renderPoster)) : (React.createElement("div", { className: 'video-container', key: rec.video.itemId, style: {
12269
12288
  position: 'relative',
12270
12289
  width: '100%',
12271
12290
  height,
12272
12291
  overflow: 'hidden'
12273
- } },
12274
- React.createElement("video", { id: `pb-video-${index}`, className: 'clc-pb-video', ref: videoRef, crossOrigin: 'anonymous', muted: true, controls: false, playsInline: true, preload: 'auto', onPause: onPause, onEnded: handleVideoStart }),
12292
+ }, onClick: handleClickVideo() },
12293
+ React.createElement("div", { className: 'n-full-screen', ref: videoEleRef, id: videoId, style: { width: '100%', height: '100%' } }),
12275
12294
  renderPoster,
12276
12295
  React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON })))));
12277
12296
  };
@@ -12620,7 +12639,7 @@ Made in Italy` })));
12620
12639
  * @Author: binruan@chatlabs.com
12621
12640
  * @Date: 2024-01-15 19:03:09
12622
12641
  * @LastEditors: binruan@chatlabs.com
12623
- * @LastEditTime: 2024-04-23 15:48:32
12642
+ * @LastEditTime: 2024-04-29 16:33:53
12624
12643
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
12625
12644
  *
12626
12645
  */
@@ -12636,6 +12655,8 @@ Made in Italy` })));
12636
12655
  const [isLoadMore, setIsLoadMore] = React.useState(false);
12637
12656
  const [isShowMore, setIsShowMore] = React.useState(false);
12638
12657
  const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData } = useSxpDataSource();
12658
+ const [videoRef, setVideoRef] = React.useState(null);
12659
+ const playerRef = React.useRef();
12639
12660
  const { productView } = useEventReport();
12640
12661
  const isShowFingerTip = React.useMemo(() => {
12641
12662
  return data.length > 0 && !loading && getFeUserId();
@@ -12673,6 +12694,25 @@ Made in Italy` })));
12673
12694
  viewTime.current = new Date();
12674
12695
  refreshFeSessionId();
12675
12696
  };
12697
+ const firstRef = React.useRef();
12698
+ React.useEffect(() => {
12699
+ if (!firstRef.current && !videoRef) {
12700
+ firstRef.current = true;
12701
+ const player = TCPlayer('player-container-id', {
12702
+ licenseUrl: 'https://license.vod2.myqcloud.com/license/v2/1325816236_1/v_cube.license', // license 地址,参考准备工作部分,在视立方控制台申请 license 后可获得 licenseUrl
12703
+ controls: false,
12704
+ autoplay: false,
12705
+ loop: false,
12706
+ muted: true,
12707
+ preload: 'auto',
12708
+ posterImage: false,
12709
+ bigPlayButton: true
12710
+ });
12711
+ player === null || player === void 0 ? void 0 : player.ready(() => {
12712
+ setVideoRef(player);
12713
+ });
12714
+ }
12715
+ }, [videoRef]);
12676
12716
  React.useEffect(() => {
12677
12717
  if (!isInit)
12678
12718
  handleH5EnterLink();
@@ -12788,7 +12828,7 @@ Made in Italy` })));
12788
12828
  const renderContent = React.useCallback((rec, index) => {
12789
12829
  var _a, _b, _c, _d;
12790
12830
  if ((_a = rec.video) === null || _a === void 0 ? void 0 : _a.url) {
12791
- return (React.createElement(VideoWidget$3, { rec: rec, index: index, muted: isMuted, data: data, height: height, activeIndex: activeIndex, videoPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPost }));
12831
+ return (React.createElement(VideoWidget$3, { rec: rec, index: index, muted: isMuted, data: data, height: height, activeIndex: activeIndex, videoPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPost, videoRef: videoRef }));
12792
12832
  }
12793
12833
  if ((_b = rec.video) === null || _b === void 0 ? void 0 : _b.imgUrls) {
12794
12834
  return (React.createElement(PictureGroup$3, { key: rec.video.itemId, imgUrls: rec.video.imgUrls, width: containerWidth, height: height, rec: rec, index: index, onReportViewImageEnd: handleReportViewImageEnd, onViewImageStartEvent: handleViewImageStartEvent, imgUrlsPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.imgUrlsPost }));
@@ -12803,7 +12843,19 @@ Made in Italy` })));
12803
12843
  });
12804
12844
  }
12805
12845
  return null;
12806
- }, [containerWidth, data, height, isMuted, activeIndex, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost, viewTime, tipText, resolver, schema]);
12846
+ }, [
12847
+ containerWidth,
12848
+ data,
12849
+ height,
12850
+ isMuted,
12851
+ activeIndex,
12852
+ globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost,
12853
+ viewTime,
12854
+ tipText,
12855
+ resolver,
12856
+ schema,
12857
+ videoRef
12858
+ ]);
12807
12859
  const onExpandableChange = React.useCallback((v) => {
12808
12860
  setIsShowMore(v);
12809
12861
  }, []);
@@ -12989,7 +13041,12 @@ Made in Italy` })));
12989
13041
  renderLogo,
12990
13042
  React.createElement(Tagbar$1, { tagList: tagList, setActiveIndex: setActiveIndex }),
12991
13043
  isShowFingerTip ? React.createElement(FingerSwipeTip, { imageUrl: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.swipeTipIcon }) : null,
12992
- React.createElement(Swiper, { ref: swiperRef, onActiveIndexChange: (swiper) => {
13044
+ React.createElement(Swiper, { ref: swiperRef, onSlideChange: () => {
13045
+ swiperRef.current.swiper.allowTouchMove = false;
13046
+ setTimeout(() => {
13047
+ swiperRef.current.swiper.allowTouchMove = true;
13048
+ }, 500);
13049
+ }, onActiveIndexChange: (swiper) => {
12993
13050
  setActiveIndex(swiper.activeIndex);
12994
13051
  if (openHashtag)
12995
13052
  return;
@@ -13006,6 +13063,9 @@ Made in Italy` })));
13006
13063
  }
13007
13064
  }
13008
13065
  },
13066
+ // style={{
13067
+ // pointerEvents: canSwiper ? 'auto' : 'none'
13068
+ // }}
13009
13069
  // onReachEnd={() => {
13010
13070
  // // 由hashtaglist跳转过来时不执行下面的方法
13011
13071
  // if (waterFallData) return;
@@ -13028,7 +13088,16 @@ Made in Italy` })));
13028
13088
  zIndex: 999
13029
13089
  }, defaultValue: isMuted, 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, onChange: setIsMuted }),
13030
13090
  renderView),
13031
- React.createElement(WaterFall$1, Object.assign({}, (_g = (_f = (_e = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.hashTag) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.item) === null || _g === void 0 ? void 0 : _g.props))));
13091
+ React.createElement(WaterFall$1, Object.assign({}, (_g = (_f = (_e = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.hashTag) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.item) === null || _g === void 0 ? void 0 : _g.props)),
13092
+ React.createElement("div", { style: { position: 'absolute', zIndex: -100 } },
13093
+ React.createElement("video", { ref: playerRef, id: 'player-container-id', playsInline: true, crossOrigin: 'anonymous', style: {
13094
+ backgroundColor: 'transparent',
13095
+ width: '100%',
13096
+ height: '100%',
13097
+ objectFit: 'cover',
13098
+ pointerEvents: 'none'
13099
+ } }),
13100
+ React.createElement("div", { id: 'player-container-id-copy' }))));
13032
13101
  };
13033
13102
 
13034
13103
  const PictureGroup = ({ imgUrls, width, height, imgUrlsPostConfig, rec, index }) => {