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/LICENSE +21 -21
- package/README.md +111 -111
- package/dist/index.cjs +183 -114
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +0 -6
- package/dist/index.js +183 -114
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +3 -3
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +3 -3
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +183 -114
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +3 -3
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/components/SxpPageRender/VideoWidget/index.d.ts +1 -0
- package/es/core/components/SxpPageRender/VideoWidget/index.js +119 -88
- package/es/core/components/SxpPageRender/index.js +51 -4
- package/es/core/context/SxpDataSourceProvider.d.ts +2 -0
- package/es/core/context/SxpDataSourceProvider.js +4 -1
- package/es/materials/sxp/popup/CommodityDetail/index.js +4 -4
- package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +1 -1
- package/lib/core/components/SxpPageRender/VideoWidget/index.d.ts +1 -0
- package/lib/core/components/SxpPageRender/VideoWidget/index.js +119 -88
- package/lib/core/components/SxpPageRender/index.js +51 -4
- package/lib/core/context/SxpDataSourceProvider.d.ts +2 -0
- package/lib/core/context/SxpDataSourceProvider.js +4 -1
- package/lib/materials/sxp/popup/CommodityDetail/index.js +4 -4
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +1 -1
- package/package.json +115 -115
package/dist/index.css
CHANGED
@@ -1459,12 +1459,6 @@ button.swiper-pagination-bullet {
|
|
1459
1459
|
-webkit-transform: translate3d(0px, 0px, 0px);
|
1460
1460
|
transform: translate3d(0px, 0px, 0px);
|
1461
1461
|
}
|
1462
|
-
.video-container video {
|
1463
|
-
width: 100%;
|
1464
|
-
height: 100%;
|
1465
|
-
-o-object-fit: cover;
|
1466
|
-
object-fit: cover;
|
1467
|
-
}
|
1468
1462
|
.modal-bg {
|
1469
1463
|
position: fixed;
|
1470
1464
|
left: 0;
|
package/dist/index.js
CHANGED
@@ -430,6 +430,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
430
430
|
const [cacheRtcList, setCacheRtcList] = useState([]);
|
431
431
|
const [cacheActiveIndex, setCacheActiveIndex] = useState(0);
|
432
432
|
const [isFromHashtag, setIsFromHashtag] = useState(false);
|
433
|
+
const [videoRef, setVideoRef] = useState(null);
|
433
434
|
useEffect(() => {
|
434
435
|
setOpenHashtag(isOpenHashTag);
|
435
436
|
}, [isOpenHashTag]);
|
@@ -635,7 +636,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
635
636
|
loadingImage: loadingImage !== null && loadingImage !== void 0 ? loadingImage : defaultLoadingImage,
|
636
637
|
isOpenHashTag,
|
637
638
|
tagList,
|
638
|
-
setLoading
|
639
|
+
setLoading,
|
640
|
+
videoRef,
|
641
|
+
setVideoRef
|
639
642
|
} }, render({
|
640
643
|
rtcList,
|
641
644
|
mutateLike: bffMutateLike,
|
@@ -8391,10 +8394,10 @@ const CommodityDetail$1 = (_a) => {
|
|
8391
8394
|
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'),
|
8392
8395
|
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),
|
8393
8396
|
React.createElement("div", { hidden: !!product && (!(product === null || product === void 0 ? void 0 : product.info) || (product === null || product === void 0 ? void 0 : product.info) === '') },
|
8394
|
-
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
|
8395
|
-
bold and avant-garde visual design interprets the emotional bond connecting my heart. The Tiffany Lock
|
8396
|
-
collection is unisex and is inspired by the padlock pattern found in the Tiffany Antique Collection. This
|
8397
|
-
necklace features a stylish and eye-catching oval clasp chain decorated with a lock pattern. Crafted from
|
8397
|
+
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
|
8398
|
+
bold and avant-garde visual design interprets the emotional bond connecting my heart. The Tiffany Lock
|
8399
|
+
collection is unisex and is inspired by the padlock pattern found in the Tiffany Antique Collection. This
|
8400
|
+
necklace features a stylish and eye-catching oval clasp chain decorated with a lock pattern. Crafted from
|
8398
8401
|
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 }))));
|
8399
8402
|
};
|
8400
8403
|
const renderBtn = () => {
|
@@ -8845,7 +8848,7 @@ const CommodityDetailDiroNew$1 = (_a) => {
|
|
8845
8848
|
const productInfoText = ({ isPost }) => {
|
8846
8849
|
return (React.createElement("div", { hidden: !!product && (!(product === null || product === void 0 ? void 0 : product.info) || (product === null || product === void 0 ? void 0 : product.info) === '') },
|
8847
8850
|
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) ||
|
8848
|
-
`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
|
8851
|
+
`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
|
8849
8852
|
Made in Italy` })));
|
8850
8853
|
};
|
8851
8854
|
return (React.createElement("div", { className: 'pb-commondityDiroNew' },
|
@@ -11993,9 +11996,8 @@ var SXP_EVENT_TYPE;
|
|
11993
11996
|
SXP_EVENT_TYPE["PAGE_DID_HIDE"] = "pageDidHide";
|
11994
11997
|
})(SXP_EVENT_TYPE || (SXP_EVENT_TYPE = {}));
|
11995
11998
|
|
11996
|
-
const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPostConfig }) => {
|
11999
|
+
const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPostConfig, videoRef }) => {
|
11997
12000
|
const [isPauseVideo, setIsPauseVideo] = useState(false);
|
11998
|
-
const videoRef = useRef(null);
|
11999
12001
|
const { bffEventReport, sxpParameter, waterFallData, openHashtag } = useSxpDataSource();
|
12000
12002
|
const videoStartTime = useRef(0);
|
12001
12003
|
const [isLoadFinish, setIsLoadFinish] = useState(false);
|
@@ -12003,99 +12005,118 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
|
|
12003
12005
|
const { isActive } = useSwiperSlide();
|
12004
12006
|
const canvasRef = useRef(null);
|
12005
12007
|
const [firstFrameSrc, setFirstFrameSrc] = useState('');
|
12008
|
+
const videoId = `pb-cache-video-${index}`;
|
12009
|
+
const videoEleRef = useRef(null);
|
12006
12010
|
useEffect(() => {
|
12007
|
-
if (!videoRef
|
12011
|
+
if (!videoRef)
|
12008
12012
|
return;
|
12009
|
-
videoRef
|
12010
|
-
}, [muted]);
|
12011
|
-
const
|
12012
|
-
|
12013
|
-
|
12014
|
-
|
12013
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.muted(muted);
|
12014
|
+
}, [muted, videoRef]);
|
12015
|
+
const handleEnded = useCallback(() => {
|
12016
|
+
if (!videoRef)
|
12017
|
+
return;
|
12018
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
|
12019
|
+
}, [videoRef]);
|
12015
12020
|
const PAUSE_ICON = useIconLink('/pb_static/06f28a2025c74c1cb49be6767316d827.png');
|
12016
12021
|
const handlePlaying = useCallback(() => {
|
12017
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j
|
12022
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
12023
|
+
if (!videoRef)
|
12024
|
+
return;
|
12018
12025
|
setIsPauseVideo(false);
|
12019
12026
|
const item = data[index];
|
12020
|
-
if (item && (
|
12021
|
-
videoStartTime.current = (
|
12022
|
-
const videoDuration = ((
|
12023
|
-
const videoCurrentTime = ((
|
12027
|
+
if (item && (videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration())) {
|
12028
|
+
videoStartTime.current = (videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime()) || 0;
|
12029
|
+
const videoDuration = ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration()) !== null && _a !== void 0 ? _a : 0).toFixed(2);
|
12030
|
+
const videoCurrentTime = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime()) !== null && _b !== void 0 ? _b : 0).toFixed(2);
|
12024
12031
|
const playType = isFirstPlay ? '0' : '1';
|
12025
12032
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
12026
12033
|
eventInfo: {
|
12027
12034
|
eventSubject: 'playVideo',
|
12028
12035
|
eventDescription: 'User played the video',
|
12029
|
-
contentId: (
|
12030
|
-
contentName: (
|
12036
|
+
contentId: (_d = (_c = item.video) === null || _c === void 0 ? void 0 : _c.itemId) !== null && _d !== void 0 ? _d : '',
|
12037
|
+
contentName: (_f = (_e = item.video) === null || _e === void 0 ? void 0 : _e.title) !== null && _f !== void 0 ? _f : '',
|
12031
12038
|
playType,
|
12032
12039
|
startTime: videoCurrentTime,
|
12033
12040
|
videoDuration,
|
12034
|
-
contentTags: JSON.stringify((
|
12041
|
+
contentTags: JSON.stringify((_h = (_g = item.video) === null || _g === void 0 ? void 0 : _g.tags) !== null && _h !== void 0 ? _h : []),
|
12035
12042
|
position: index + '',
|
12036
12043
|
contentFormat: 'video',
|
12037
|
-
traceInfo: (
|
12044
|
+
traceInfo: (_j = item.video) === null || _j === void 0 ? void 0 : _j.traceInfo
|
12038
12045
|
}
|
12039
12046
|
});
|
12040
12047
|
setIsFirstPlay(false);
|
12041
12048
|
}
|
12042
|
-
}, [bffEventReport, data, index, isFirstPlay]);
|
12043
|
-
const
|
12049
|
+
}, [bffEventReport, data, index, isFirstPlay, videoRef]);
|
12050
|
+
const handleLoadedmetadata = useCallback(() => {
|
12051
|
+
if (!videoRef)
|
12052
|
+
return;
|
12053
|
+
if (activeIndex !== index) {
|
12054
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
|
12055
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.pause();
|
12056
|
+
}
|
12057
|
+
setIsLoadFinish(true);
|
12058
|
+
}, [activeIndex, index, videoRef]);
|
12059
|
+
const handleCanplay = useCallback(() => {
|
12044
12060
|
setIsLoadFinish(true);
|
12045
12061
|
}, []);
|
12046
12062
|
const handleClickVideo = useCallback((type) => () => {
|
12047
|
-
|
12063
|
+
if (!videoRef)
|
12064
|
+
return;
|
12048
12065
|
if (!isLoadFinish)
|
12049
12066
|
return;
|
12050
|
-
const isPause =
|
12067
|
+
const isPause = videoRef === null || videoRef === void 0 ? void 0 : videoRef.paused();
|
12051
12068
|
switch (type) {
|
12052
12069
|
case 'start':
|
12053
12070
|
if (!isPause)
|
12054
12071
|
return;
|
12055
|
-
|
12072
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
|
12056
12073
|
setIsPauseVideo(false);
|
12057
12074
|
break;
|
12058
12075
|
case 'pause':
|
12059
12076
|
if (isPause)
|
12060
12077
|
return;
|
12061
|
-
|
12078
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.pause();
|
12062
12079
|
setIsPauseVideo(true);
|
12063
12080
|
break;
|
12064
12081
|
default:
|
12065
12082
|
if (isPause) {
|
12066
|
-
|
12083
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
|
12067
12084
|
}
|
12068
12085
|
else {
|
12069
|
-
|
12086
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.pause();
|
12070
12087
|
}
|
12071
12088
|
setIsPauseVideo(!isPause);
|
12072
12089
|
break;
|
12073
12090
|
}
|
12074
|
-
}, [isLoadFinish]);
|
12075
|
-
const
|
12076
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j
|
12091
|
+
}, [isLoadFinish, videoRef]);
|
12092
|
+
const handlePause = useCallback(() => {
|
12093
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
12094
|
+
if (!videoRef)
|
12095
|
+
return;
|
12096
|
+
if (activeIndex !== index)
|
12097
|
+
return;
|
12077
12098
|
const item = data[index];
|
12078
|
-
const videoDuration = ((
|
12079
|
-
const videoCurrentTime = ((
|
12080
|
-
if (
|
12081
|
-
const playDuration = ((
|
12099
|
+
const videoDuration = ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration()) !== null && _a !== void 0 ? _a : 0).toFixed(2);
|
12100
|
+
const videoCurrentTime = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime()) !== null && _b !== void 0 ? _b : 0).toFixed(2);
|
12101
|
+
if (videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration()) {
|
12102
|
+
const playDuration = ((videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime()) - videoStartTime.current).toFixed(2);
|
12082
12103
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
12083
12104
|
eventInfo: {
|
12084
12105
|
eventSubject: 'playOverVideo',
|
12085
12106
|
eventDescription: 'User finished playing the video',
|
12086
|
-
contentId: (
|
12087
|
-
contentName: (
|
12107
|
+
contentId: (_d = (_c = item.video) === null || _c === void 0 ? void 0 : _c.itemId) !== null && _d !== void 0 ? _d : '',
|
12108
|
+
contentName: (_f = (_e = item.video) === null || _e === void 0 ? void 0 : _e.title) !== null && _f !== void 0 ? _f : '',
|
12088
12109
|
endTime: videoCurrentTime,
|
12089
12110
|
videoDuration,
|
12090
12111
|
playDuration,
|
12091
|
-
contentTags: JSON.stringify((
|
12112
|
+
contentTags: JSON.stringify((_h = (_g = item.video) === null || _g === void 0 ? void 0 : _g.tags) !== null && _h !== void 0 ? _h : []),
|
12092
12113
|
position: index + '',
|
12093
12114
|
contentFormat: 'video',
|
12094
|
-
traceInfo: (
|
12115
|
+
traceInfo: (_j = item.video) === null || _j === void 0 ? void 0 : _j.traceInfo
|
12095
12116
|
}
|
12096
12117
|
});
|
12097
12118
|
}
|
12098
|
-
}, [data, index, bffEventReport]);
|
12119
|
+
}, [data, index, bffEventReport, videoRef]);
|
12099
12120
|
const blur = useMemo(() => {
|
12100
12121
|
return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2';
|
12101
12122
|
}, [videoPostConfig]);
|
@@ -12110,82 +12131,82 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
|
|
12110
12131
|
return ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) || firstFrameSrc;
|
12111
12132
|
}, [firstFrameSrc, rec]);
|
12112
12133
|
const handLoadeddata = useCallback(() => {
|
12113
|
-
|
12134
|
+
var _a;
|
12135
|
+
if (!videoRef)
|
12114
12136
|
return;
|
12115
|
-
const
|
12116
|
-
|
12117
|
-
|
12118
|
-
const
|
12119
|
-
|
12120
|
-
|
12121
|
-
|
12122
|
-
|
12123
|
-
|
12124
|
-
|
12137
|
+
const videoDomRef = document.getElementById(`${videoId}_html5_api`);
|
12138
|
+
if (((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) || !canvasRef || !videoDomRef || !canvasRef.current)
|
12139
|
+
return;
|
12140
|
+
const setFrameImg = () => {
|
12141
|
+
const video = videoDomRef;
|
12142
|
+
const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
|
12143
|
+
const ctx = canvas.getContext('2d');
|
12144
|
+
const targetWidth = window === null || window === void 0 ? void 0 : window.innerWidth;
|
12145
|
+
const targetHeight = window === null || window === void 0 ? void 0 : window.innerHeight;
|
12146
|
+
canvas.height = targetHeight;
|
12147
|
+
canvas.width = targetWidth;
|
12148
|
+
ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
|
12149
|
+
setFirstFrameSrc(canvas.toDataURL());
|
12150
|
+
};
|
12151
|
+
setFrameImg();
|
12152
|
+
setTimeout(() => {
|
12153
|
+
setFrameImg();
|
12154
|
+
}, 500);
|
12155
|
+
}, [videoRef]);
|
12125
12156
|
useEffect(() => {
|
12126
|
-
|
12127
|
-
|
12157
|
+
if (!isActive || !videoRef)
|
12158
|
+
return;
|
12159
|
+
const videoSrc = rec.video.url;
|
12160
|
+
if (!videoSrc)
|
12128
12161
|
return;
|
12129
12162
|
setIsPauseVideo(false);
|
12130
|
-
|
12131
|
-
|
12132
|
-
|
12133
|
-
|
12134
|
-
|
12135
|
-
|
12136
|
-
|
12137
|
-
|
12138
|
-
|
12139
|
-
|
12140
|
-
|
12141
|
-
|
12142
|
-
|
12143
|
-
// videoRef.current.src = videoSrc;
|
12144
|
-
// }
|
12145
|
-
// } else {
|
12146
|
-
videoRef.current.src = videoSrc;
|
12147
|
-
// }
|
12148
|
-
videoRef.current.setAttribute('x5-playsinline', 'true');
|
12149
|
-
videoRef.current.setAttribute('webkit-playsinline', 'true');
|
12150
|
-
}
|
12151
|
-
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('loadedmetadata', handleLoadedMetadata);
|
12152
|
-
(_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('canplay', handleLoadedMetadata);
|
12153
|
-
(_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.addEventListener('playing', handlePlaying);
|
12154
|
-
(_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.addEventListener('loadeddata', handLoadeddata);
|
12163
|
+
const videoPlayerWrapperNode = document.querySelector(`#${videoId}`);
|
12164
|
+
const dom = document.querySelector('#player-container-id');
|
12165
|
+
const dom2 = document.querySelector('#player-container-id-copy');
|
12166
|
+
if (!dom && !dom2)
|
12167
|
+
return;
|
12168
|
+
videoPlayerWrapperNode === null || videoPlayerWrapperNode === void 0 ? void 0 : videoPlayerWrapperNode.appendChild(dom || dom2);
|
12169
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.src(videoSrc);
|
12170
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('loadedmetadata', handleLoadedmetadata);
|
12171
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('loadeddata', handLoadeddata);
|
12172
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('canplay', handleCanplay);
|
12173
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('playing', handlePlaying);
|
12174
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('pause', handlePause);
|
12175
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('ended', handleEnded);
|
12155
12176
|
return () => {
|
12156
|
-
|
12157
|
-
|
12158
|
-
|
12159
|
-
|
12160
|
-
|
12177
|
+
dom2 === null || dom2 === void 0 ? void 0 : dom2.appendChild(dom);
|
12178
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('loadedmetadata', handleLoadedmetadata);
|
12179
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('loadeddata', handLoadeddata);
|
12180
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('canplay', handleCanplay);
|
12181
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('playing', handlePlaying);
|
12182
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('pause', handlePause);
|
12183
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('ended', handleEnded);
|
12161
12184
|
};
|
12162
|
-
}, [
|
12185
|
+
}, [isActive, videoId, rec, videoRef]);
|
12163
12186
|
useEffect(() => {
|
12164
|
-
|
12165
|
-
if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || !isLoadFinish)
|
12187
|
+
if (!videoRef || !isLoadFinish)
|
12166
12188
|
return;
|
12167
12189
|
if (isActive) {
|
12168
|
-
videoRef.
|
12190
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
|
12169
12191
|
}
|
12170
12192
|
else {
|
12171
|
-
|
12193
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.pause();
|
12172
12194
|
}
|
12173
|
-
}, [isActive, isLoadFinish]);
|
12195
|
+
}, [isActive, isLoadFinish, videoRef]);
|
12174
12196
|
/*
|
12175
12197
|
打开/关闭hashtag暂停/播放视频
|
12176
12198
|
*/
|
12177
12199
|
useEffect(() => {
|
12178
|
-
|
12179
|
-
if (!isActive || !(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current))
|
12200
|
+
if (!isActive || !videoRef)
|
12180
12201
|
return;
|
12181
|
-
const isPause =
|
12202
|
+
const isPause = videoRef === null || videoRef === void 0 ? void 0 : videoRef.paused();
|
12182
12203
|
if (!isPause && openHashtag) {
|
12183
|
-
|
12204
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.pause();
|
12184
12205
|
}
|
12185
12206
|
else if (!openHashtag) {
|
12186
|
-
|
12207
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
|
12187
12208
|
}
|
12188
|
-
}, [openHashtag, isActive]);
|
12209
|
+
}, [openHashtag, isActive, videoRef]);
|
12189
12210
|
useEffect(() => {
|
12190
12211
|
if (!isActive)
|
12191
12212
|
return;
|
@@ -12205,9 +12226,11 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
|
|
12205
12226
|
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 }));
|
12206
12227
|
}, [isLoadFinish, sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image]);
|
12207
12228
|
useEffect(() => {
|
12229
|
+
if (!videoRef)
|
12230
|
+
return;
|
12208
12231
|
const handleBeforeUnload = () => {
|
12209
|
-
var _a
|
12210
|
-
if (activeIndex === index && ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.url) &&
|
12232
|
+
var _a;
|
12233
|
+
if (activeIndex === index && ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.url) && videoRef && !isPauseVideo) {
|
12211
12234
|
handleClickVideo('pause')();
|
12212
12235
|
}
|
12213
12236
|
};
|
@@ -12245,19 +12268,15 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
|
|
12245
12268
|
right: 0
|
12246
12269
|
} },
|
12247
12270
|
React.createElement("div", { style: { position: 'relative', width: '100%', height: '100%' } },
|
12248
|
-
React.createElement("
|
12249
|
-
width: '100%',
|
12250
|
-
height: '100%',
|
12251
|
-
objectFit: 'contain'
|
12252
|
-
} }),
|
12271
|
+
React.createElement("div", { className: 'n-full-screen', ref: videoEleRef, id: videoId, style: { width: '100%', height: '100%' } }),
|
12253
12272
|
React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON }))),
|
12254
|
-
renderPoster)) : (React.createElement("div", { className: 'video-container', key: rec.video.itemId,
|
12273
|
+
renderPoster)) : (React.createElement("div", { className: 'video-container', key: rec.video.itemId, style: {
|
12255
12274
|
position: 'relative',
|
12256
12275
|
width: '100%',
|
12257
12276
|
height,
|
12258
12277
|
overflow: 'hidden'
|
12259
|
-
} },
|
12260
|
-
React.createElement("
|
12278
|
+
}, onClick: handleClickVideo() },
|
12279
|
+
React.createElement("div", { className: 'n-full-screen', ref: videoEleRef, id: videoId, style: { width: '100%', height: '100%' } }),
|
12261
12280
|
renderPoster,
|
12262
12281
|
React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON })))));
|
12263
12282
|
};
|
@@ -12606,7 +12625,7 @@ var Tagbar$1 = memo(Tagbar);
|
|
12606
12625
|
* @Author: binruan@chatlabs.com
|
12607
12626
|
* @Date: 2024-01-15 19:03:09
|
12608
12627
|
* @LastEditors: binruan@chatlabs.com
|
12609
|
-
* @LastEditTime: 2024-04-
|
12628
|
+
* @LastEditTime: 2024-04-29 16:33:53
|
12610
12629
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
|
12611
12630
|
*
|
12612
12631
|
*/
|
@@ -12622,6 +12641,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
12622
12641
|
const [isLoadMore, setIsLoadMore] = useState(false);
|
12623
12642
|
const [isShowMore, setIsShowMore] = useState(false);
|
12624
12643
|
const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData } = useSxpDataSource();
|
12644
|
+
const [videoRef, setVideoRef] = useState(null);
|
12645
|
+
const playerRef = useRef();
|
12625
12646
|
const { productView } = useEventReport();
|
12626
12647
|
const isShowFingerTip = useMemo(() => {
|
12627
12648
|
return data.length > 0 && !loading && getFeUserId();
|
@@ -12659,6 +12680,25 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
12659
12680
|
viewTime.current = new Date();
|
12660
12681
|
refreshFeSessionId();
|
12661
12682
|
};
|
12683
|
+
const firstRef = useRef();
|
12684
|
+
useEffect(() => {
|
12685
|
+
if (!firstRef.current && !videoRef) {
|
12686
|
+
firstRef.current = true;
|
12687
|
+
const player = TCPlayer('player-container-id', {
|
12688
|
+
licenseUrl: 'https://license.vod2.myqcloud.com/license/v2/1325816236_1/v_cube.license', // license 地址,参考准备工作部分,在视立方控制台申请 license 后可获得 licenseUrl
|
12689
|
+
controls: false,
|
12690
|
+
autoplay: false,
|
12691
|
+
loop: false,
|
12692
|
+
muted: true,
|
12693
|
+
preload: 'auto',
|
12694
|
+
posterImage: false,
|
12695
|
+
bigPlayButton: true
|
12696
|
+
});
|
12697
|
+
player === null || player === void 0 ? void 0 : player.ready(() => {
|
12698
|
+
setVideoRef(player);
|
12699
|
+
});
|
12700
|
+
}
|
12701
|
+
}, [videoRef]);
|
12662
12702
|
useEffect(() => {
|
12663
12703
|
if (!isInit)
|
12664
12704
|
handleH5EnterLink();
|
@@ -12774,7 +12814,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
12774
12814
|
const renderContent = useCallback((rec, index) => {
|
12775
12815
|
var _a, _b, _c, _d;
|
12776
12816
|
if ((_a = rec.video) === null || _a === void 0 ? void 0 : _a.url) {
|
12777
|
-
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 }));
|
12817
|
+
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 }));
|
12778
12818
|
}
|
12779
12819
|
if ((_b = rec.video) === null || _b === void 0 ? void 0 : _b.imgUrls) {
|
12780
12820
|
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 }));
|
@@ -12789,7 +12829,19 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
12789
12829
|
});
|
12790
12830
|
}
|
12791
12831
|
return null;
|
12792
|
-
}, [
|
12832
|
+
}, [
|
12833
|
+
containerWidth,
|
12834
|
+
data,
|
12835
|
+
height,
|
12836
|
+
isMuted,
|
12837
|
+
activeIndex,
|
12838
|
+
globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost,
|
12839
|
+
viewTime,
|
12840
|
+
tipText,
|
12841
|
+
resolver,
|
12842
|
+
schema,
|
12843
|
+
videoRef
|
12844
|
+
]);
|
12793
12845
|
const onExpandableChange = useCallback((v) => {
|
12794
12846
|
setIsShowMore(v);
|
12795
12847
|
}, []);
|
@@ -12975,7 +13027,12 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
12975
13027
|
renderLogo,
|
12976
13028
|
React.createElement(Tagbar$1, { tagList: tagList, setActiveIndex: setActiveIndex }),
|
12977
13029
|
isShowFingerTip ? React.createElement(FingerSwipeTip, { imageUrl: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.swipeTipIcon }) : null,
|
12978
|
-
React.createElement(Swiper, { ref: swiperRef,
|
13030
|
+
React.createElement(Swiper, { ref: swiperRef, onSlideChange: () => {
|
13031
|
+
swiperRef.current.swiper.allowTouchMove = false;
|
13032
|
+
setTimeout(() => {
|
13033
|
+
swiperRef.current.swiper.allowTouchMove = true;
|
13034
|
+
}, 500);
|
13035
|
+
}, onActiveIndexChange: (swiper) => {
|
12979
13036
|
setActiveIndex(swiper.activeIndex);
|
12980
13037
|
if (openHashtag)
|
12981
13038
|
return;
|
@@ -12992,6 +13049,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
12992
13049
|
}
|
12993
13050
|
}
|
12994
13051
|
},
|
13052
|
+
// style={{
|
13053
|
+
// pointerEvents: canSwiper ? 'auto' : 'none'
|
13054
|
+
// }}
|
12995
13055
|
// onReachEnd={() => {
|
12996
13056
|
// // 由hashtaglist跳转过来时不执行下面的方法
|
12997
13057
|
// if (waterFallData) return;
|
@@ -13014,7 +13074,16 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
13014
13074
|
zIndex: 999
|
13015
13075
|
}, 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 }),
|
13016
13076
|
renderView),
|
13017
|
-
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))
|
13077
|
+
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)),
|
13078
|
+
React.createElement("div", { style: { position: 'absolute', zIndex: -100 } },
|
13079
|
+
React.createElement("video", { ref: playerRef, id: 'player-container-id', playsInline: true, crossOrigin: 'anonymous', style: {
|
13080
|
+
backgroundColor: 'transparent',
|
13081
|
+
width: '100%',
|
13082
|
+
height: '100%',
|
13083
|
+
objectFit: 'cover',
|
13084
|
+
pointerEvents: 'none'
|
13085
|
+
} }),
|
13086
|
+
React.createElement("div", { id: 'player-container-id-copy' }))));
|
13018
13087
|
};
|
13019
13088
|
|
13020
13089
|
const PictureGroup = ({ imgUrls, width, height, imgUrlsPostConfig, rec, index }) => {
|