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.cjs
CHANGED
@@ -453,6 +453,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
453
453
|
const [cacheRtcList, setCacheRtcList] = React.useState([]);
|
454
454
|
const [cacheActiveIndex, setCacheActiveIndex] = React.useState(0);
|
455
455
|
const [isFromHashtag, setIsFromHashtag] = React.useState(false);
|
456
|
+
const [videoRef, setVideoRef] = React.useState(null);
|
456
457
|
React.useEffect(() => {
|
457
458
|
setOpenHashtag(isOpenHashTag);
|
458
459
|
}, [isOpenHashTag]);
|
@@ -658,7 +659,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
658
659
|
loadingImage: loadingImage !== null && loadingImage !== void 0 ? loadingImage : defaultLoadingImage,
|
659
660
|
isOpenHashTag,
|
660
661
|
tagList,
|
661
|
-
setLoading
|
662
|
+
setLoading,
|
663
|
+
videoRef,
|
664
|
+
setVideoRef
|
662
665
|
} }, render({
|
663
666
|
rtcList,
|
664
667
|
mutateLike: bffMutateLike,
|
@@ -8414,10 +8417,10 @@ const CommodityDetail$1 = (_a) => {
|
|
8414
8417
|
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'),
|
8415
8418
|
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),
|
8416
8419
|
React.createElement("div", { hidden: !!product && (!(product === null || product === void 0 ? void 0 : product.info) || (product === null || product === void 0 ? void 0 : product.info) === '') },
|
8417
|
-
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
|
8418
|
-
bold and avant-garde visual design interprets the emotional bond connecting my heart. The Tiffany Lock
|
8419
|
-
collection is unisex and is inspired by the padlock pattern found in the Tiffany Antique Collection. This
|
8420
|
-
necklace features a stylish and eye-catching oval clasp chain decorated with a lock pattern. Crafted from
|
8420
|
+
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
|
8421
|
+
bold and avant-garde visual design interprets the emotional bond connecting my heart. The Tiffany Lock
|
8422
|
+
collection is unisex and is inspired by the padlock pattern found in the Tiffany Antique Collection. This
|
8423
|
+
necklace features a stylish and eye-catching oval clasp chain decorated with a lock pattern. Crafted from
|
8421
8424
|
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 }))));
|
8422
8425
|
};
|
8423
8426
|
const renderBtn = () => {
|
@@ -8868,7 +8871,7 @@ const CommodityDetailDiroNew$1 = (_a) => {
|
|
8868
8871
|
const productInfoText = ({ isPost }) => {
|
8869
8872
|
return (React.createElement("div", { hidden: !!product && (!(product === null || product === void 0 ? void 0 : product.info) || (product === null || product === void 0 ? void 0 : product.info) === '') },
|
8870
8873
|
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) ||
|
8871
|
-
`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
|
8874
|
+
`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
|
8872
8875
|
Made in Italy` })));
|
8873
8876
|
};
|
8874
8877
|
return (React.createElement("div", { className: 'pb-commondityDiroNew' },
|
@@ -12016,9 +12019,8 @@ var SXP_EVENT_TYPE;
|
|
12016
12019
|
SXP_EVENT_TYPE["PAGE_DID_HIDE"] = "pageDidHide";
|
12017
12020
|
})(SXP_EVENT_TYPE || (SXP_EVENT_TYPE = {}));
|
12018
12021
|
|
12019
|
-
const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPostConfig }) => {
|
12022
|
+
const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPostConfig, videoRef }) => {
|
12020
12023
|
const [isPauseVideo, setIsPauseVideo] = React.useState(false);
|
12021
|
-
const videoRef = React.useRef(null);
|
12022
12024
|
const { bffEventReport, sxpParameter, waterFallData, openHashtag } = useSxpDataSource();
|
12023
12025
|
const videoStartTime = React.useRef(0);
|
12024
12026
|
const [isLoadFinish, setIsLoadFinish] = React.useState(false);
|
@@ -12026,99 +12028,118 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
|
|
12026
12028
|
const { isActive } = useSwiperSlide();
|
12027
12029
|
const canvasRef = React.useRef(null);
|
12028
12030
|
const [firstFrameSrc, setFirstFrameSrc] = React.useState('');
|
12031
|
+
const videoId = `pb-cache-video-${index}`;
|
12032
|
+
const videoEleRef = React.useRef(null);
|
12029
12033
|
React.useEffect(() => {
|
12030
|
-
if (!videoRef
|
12034
|
+
if (!videoRef)
|
12031
12035
|
return;
|
12032
|
-
videoRef
|
12033
|
-
}, [muted]);
|
12034
|
-
const
|
12035
|
-
|
12036
|
-
|
12037
|
-
|
12036
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.muted(muted);
|
12037
|
+
}, [muted, videoRef]);
|
12038
|
+
const handleEnded = React.useCallback(() => {
|
12039
|
+
if (!videoRef)
|
12040
|
+
return;
|
12041
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
|
12042
|
+
}, [videoRef]);
|
12038
12043
|
const PAUSE_ICON = useIconLink('/pb_static/06f28a2025c74c1cb49be6767316d827.png');
|
12039
12044
|
const handlePlaying = React.useCallback(() => {
|
12040
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j
|
12045
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
12046
|
+
if (!videoRef)
|
12047
|
+
return;
|
12041
12048
|
setIsPauseVideo(false);
|
12042
12049
|
const item = data[index];
|
12043
|
-
if (item && (
|
12044
|
-
videoStartTime.current = (
|
12045
|
-
const videoDuration = ((
|
12046
|
-
const videoCurrentTime = ((
|
12050
|
+
if (item && (videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration())) {
|
12051
|
+
videoStartTime.current = (videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime()) || 0;
|
12052
|
+
const videoDuration = ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration()) !== null && _a !== void 0 ? _a : 0).toFixed(2);
|
12053
|
+
const videoCurrentTime = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime()) !== null && _b !== void 0 ? _b : 0).toFixed(2);
|
12047
12054
|
const playType = isFirstPlay ? '0' : '1';
|
12048
12055
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
12049
12056
|
eventInfo: {
|
12050
12057
|
eventSubject: 'playVideo',
|
12051
12058
|
eventDescription: 'User played the video',
|
12052
|
-
contentId: (
|
12053
|
-
contentName: (
|
12059
|
+
contentId: (_d = (_c = item.video) === null || _c === void 0 ? void 0 : _c.itemId) !== null && _d !== void 0 ? _d : '',
|
12060
|
+
contentName: (_f = (_e = item.video) === null || _e === void 0 ? void 0 : _e.title) !== null && _f !== void 0 ? _f : '',
|
12054
12061
|
playType,
|
12055
12062
|
startTime: videoCurrentTime,
|
12056
12063
|
videoDuration,
|
12057
|
-
contentTags: JSON.stringify((
|
12064
|
+
contentTags: JSON.stringify((_h = (_g = item.video) === null || _g === void 0 ? void 0 : _g.tags) !== null && _h !== void 0 ? _h : []),
|
12058
12065
|
position: index + '',
|
12059
12066
|
contentFormat: 'video',
|
12060
|
-
traceInfo: (
|
12067
|
+
traceInfo: (_j = item.video) === null || _j === void 0 ? void 0 : _j.traceInfo
|
12061
12068
|
}
|
12062
12069
|
});
|
12063
12070
|
setIsFirstPlay(false);
|
12064
12071
|
}
|
12065
|
-
}, [bffEventReport, data, index, isFirstPlay]);
|
12066
|
-
const
|
12072
|
+
}, [bffEventReport, data, index, isFirstPlay, videoRef]);
|
12073
|
+
const handleLoadedmetadata = React.useCallback(() => {
|
12074
|
+
if (!videoRef)
|
12075
|
+
return;
|
12076
|
+
if (activeIndex !== index) {
|
12077
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
|
12078
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.pause();
|
12079
|
+
}
|
12080
|
+
setIsLoadFinish(true);
|
12081
|
+
}, [activeIndex, index, videoRef]);
|
12082
|
+
const handleCanplay = React.useCallback(() => {
|
12067
12083
|
setIsLoadFinish(true);
|
12068
12084
|
}, []);
|
12069
12085
|
const handleClickVideo = React.useCallback((type) => () => {
|
12070
|
-
|
12086
|
+
if (!videoRef)
|
12087
|
+
return;
|
12071
12088
|
if (!isLoadFinish)
|
12072
12089
|
return;
|
12073
|
-
const isPause =
|
12090
|
+
const isPause = videoRef === null || videoRef === void 0 ? void 0 : videoRef.paused();
|
12074
12091
|
switch (type) {
|
12075
12092
|
case 'start':
|
12076
12093
|
if (!isPause)
|
12077
12094
|
return;
|
12078
|
-
|
12095
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
|
12079
12096
|
setIsPauseVideo(false);
|
12080
12097
|
break;
|
12081
12098
|
case 'pause':
|
12082
12099
|
if (isPause)
|
12083
12100
|
return;
|
12084
|
-
|
12101
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.pause();
|
12085
12102
|
setIsPauseVideo(true);
|
12086
12103
|
break;
|
12087
12104
|
default:
|
12088
12105
|
if (isPause) {
|
12089
|
-
|
12106
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
|
12090
12107
|
}
|
12091
12108
|
else {
|
12092
|
-
|
12109
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.pause();
|
12093
12110
|
}
|
12094
12111
|
setIsPauseVideo(!isPause);
|
12095
12112
|
break;
|
12096
12113
|
}
|
12097
|
-
}, [isLoadFinish]);
|
12098
|
-
const
|
12099
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j
|
12114
|
+
}, [isLoadFinish, videoRef]);
|
12115
|
+
const handlePause = React.useCallback(() => {
|
12116
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
12117
|
+
if (!videoRef)
|
12118
|
+
return;
|
12119
|
+
if (activeIndex !== index)
|
12120
|
+
return;
|
12100
12121
|
const item = data[index];
|
12101
|
-
const videoDuration = ((
|
12102
|
-
const videoCurrentTime = ((
|
12103
|
-
if (
|
12104
|
-
const playDuration = ((
|
12122
|
+
const videoDuration = ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration()) !== null && _a !== void 0 ? _a : 0).toFixed(2);
|
12123
|
+
const videoCurrentTime = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime()) !== null && _b !== void 0 ? _b : 0).toFixed(2);
|
12124
|
+
if (videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration()) {
|
12125
|
+
const playDuration = ((videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime()) - videoStartTime.current).toFixed(2);
|
12105
12126
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
12106
12127
|
eventInfo: {
|
12107
12128
|
eventSubject: 'playOverVideo',
|
12108
12129
|
eventDescription: 'User finished playing the video',
|
12109
|
-
contentId: (
|
12110
|
-
contentName: (
|
12130
|
+
contentId: (_d = (_c = item.video) === null || _c === void 0 ? void 0 : _c.itemId) !== null && _d !== void 0 ? _d : '',
|
12131
|
+
contentName: (_f = (_e = item.video) === null || _e === void 0 ? void 0 : _e.title) !== null && _f !== void 0 ? _f : '',
|
12111
12132
|
endTime: videoCurrentTime,
|
12112
12133
|
videoDuration,
|
12113
12134
|
playDuration,
|
12114
|
-
contentTags: JSON.stringify((
|
12135
|
+
contentTags: JSON.stringify((_h = (_g = item.video) === null || _g === void 0 ? void 0 : _g.tags) !== null && _h !== void 0 ? _h : []),
|
12115
12136
|
position: index + '',
|
12116
12137
|
contentFormat: 'video',
|
12117
|
-
traceInfo: (
|
12138
|
+
traceInfo: (_j = item.video) === null || _j === void 0 ? void 0 : _j.traceInfo
|
12118
12139
|
}
|
12119
12140
|
});
|
12120
12141
|
}
|
12121
|
-
}, [data, index, bffEventReport]);
|
12142
|
+
}, [data, index, bffEventReport, videoRef]);
|
12122
12143
|
const blur = React.useMemo(() => {
|
12123
12144
|
return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2';
|
12124
12145
|
}, [videoPostConfig]);
|
@@ -12133,82 +12154,82 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
|
|
12133
12154
|
return ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) || firstFrameSrc;
|
12134
12155
|
}, [firstFrameSrc, rec]);
|
12135
12156
|
const handLoadeddata = React.useCallback(() => {
|
12136
|
-
|
12157
|
+
var _a;
|
12158
|
+
if (!videoRef)
|
12137
12159
|
return;
|
12138
|
-
const
|
12139
|
-
|
12140
|
-
|
12141
|
-
const
|
12142
|
-
|
12143
|
-
|
12144
|
-
|
12145
|
-
|
12146
|
-
|
12147
|
-
|
12160
|
+
const videoDomRef = document.getElementById(`${videoId}_html5_api`);
|
12161
|
+
if (((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) || !canvasRef || !videoDomRef || !canvasRef.current)
|
12162
|
+
return;
|
12163
|
+
const setFrameImg = () => {
|
12164
|
+
const video = videoDomRef;
|
12165
|
+
const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
|
12166
|
+
const ctx = canvas.getContext('2d');
|
12167
|
+
const targetWidth = window === null || window === void 0 ? void 0 : window.innerWidth;
|
12168
|
+
const targetHeight = window === null || window === void 0 ? void 0 : window.innerHeight;
|
12169
|
+
canvas.height = targetHeight;
|
12170
|
+
canvas.width = targetWidth;
|
12171
|
+
ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
|
12172
|
+
setFirstFrameSrc(canvas.toDataURL());
|
12173
|
+
};
|
12174
|
+
setFrameImg();
|
12175
|
+
setTimeout(() => {
|
12176
|
+
setFrameImg();
|
12177
|
+
}, 500);
|
12178
|
+
}, [videoRef]);
|
12148
12179
|
React.useEffect(() => {
|
12149
|
-
|
12150
|
-
|
12180
|
+
if (!isActive || !videoRef)
|
12181
|
+
return;
|
12182
|
+
const videoSrc = rec.video.url;
|
12183
|
+
if (!videoSrc)
|
12151
12184
|
return;
|
12152
12185
|
setIsPauseVideo(false);
|
12153
|
-
|
12154
|
-
|
12155
|
-
|
12156
|
-
|
12157
|
-
|
12158
|
-
|
12159
|
-
|
12160
|
-
|
12161
|
-
|
12162
|
-
|
12163
|
-
|
12164
|
-
|
12165
|
-
|
12166
|
-
// videoRef.current.src = videoSrc;
|
12167
|
-
// }
|
12168
|
-
// } else {
|
12169
|
-
videoRef.current.src = videoSrc;
|
12170
|
-
// }
|
12171
|
-
videoRef.current.setAttribute('x5-playsinline', 'true');
|
12172
|
-
videoRef.current.setAttribute('webkit-playsinline', 'true');
|
12173
|
-
}
|
12174
|
-
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('loadedmetadata', handleLoadedMetadata);
|
12175
|
-
(_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('canplay', handleLoadedMetadata);
|
12176
|
-
(_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.addEventListener('playing', handlePlaying);
|
12177
|
-
(_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.addEventListener('loadeddata', handLoadeddata);
|
12186
|
+
const videoPlayerWrapperNode = document.querySelector(`#${videoId}`);
|
12187
|
+
const dom = document.querySelector('#player-container-id');
|
12188
|
+
const dom2 = document.querySelector('#player-container-id-copy');
|
12189
|
+
if (!dom && !dom2)
|
12190
|
+
return;
|
12191
|
+
videoPlayerWrapperNode === null || videoPlayerWrapperNode === void 0 ? void 0 : videoPlayerWrapperNode.appendChild(dom || dom2);
|
12192
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.src(videoSrc);
|
12193
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('loadedmetadata', handleLoadedmetadata);
|
12194
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('loadeddata', handLoadeddata);
|
12195
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('canplay', handleCanplay);
|
12196
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('playing', handlePlaying);
|
12197
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('pause', handlePause);
|
12198
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('ended', handleEnded);
|
12178
12199
|
return () => {
|
12179
|
-
|
12180
|
-
|
12181
|
-
|
12182
|
-
|
12183
|
-
|
12200
|
+
dom2 === null || dom2 === void 0 ? void 0 : dom2.appendChild(dom);
|
12201
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('loadedmetadata', handleLoadedmetadata);
|
12202
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('loadeddata', handLoadeddata);
|
12203
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('canplay', handleCanplay);
|
12204
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('playing', handlePlaying);
|
12205
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('pause', handlePause);
|
12206
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('ended', handleEnded);
|
12184
12207
|
};
|
12185
|
-
}, [
|
12208
|
+
}, [isActive, videoId, rec, videoRef]);
|
12186
12209
|
React.useEffect(() => {
|
12187
|
-
|
12188
|
-
if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || !isLoadFinish)
|
12210
|
+
if (!videoRef || !isLoadFinish)
|
12189
12211
|
return;
|
12190
12212
|
if (isActive) {
|
12191
|
-
videoRef.
|
12213
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
|
12192
12214
|
}
|
12193
12215
|
else {
|
12194
|
-
|
12216
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.pause();
|
12195
12217
|
}
|
12196
|
-
}, [isActive, isLoadFinish]);
|
12218
|
+
}, [isActive, isLoadFinish, videoRef]);
|
12197
12219
|
/*
|
12198
12220
|
打开/关闭hashtag暂停/播放视频
|
12199
12221
|
*/
|
12200
12222
|
React.useEffect(() => {
|
12201
|
-
|
12202
|
-
if (!isActive || !(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current))
|
12223
|
+
if (!isActive || !videoRef)
|
12203
12224
|
return;
|
12204
|
-
const isPause =
|
12225
|
+
const isPause = videoRef === null || videoRef === void 0 ? void 0 : videoRef.paused();
|
12205
12226
|
if (!isPause && openHashtag) {
|
12206
|
-
|
12227
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.pause();
|
12207
12228
|
}
|
12208
12229
|
else if (!openHashtag) {
|
12209
|
-
|
12230
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
|
12210
12231
|
}
|
12211
|
-
}, [openHashtag, isActive]);
|
12232
|
+
}, [openHashtag, isActive, videoRef]);
|
12212
12233
|
React.useEffect(() => {
|
12213
12234
|
if (!isActive)
|
12214
12235
|
return;
|
@@ -12228,9 +12249,11 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
|
|
12228
12249
|
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 }));
|
12229
12250
|
}, [isLoadFinish, sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image]);
|
12230
12251
|
React.useEffect(() => {
|
12252
|
+
if (!videoRef)
|
12253
|
+
return;
|
12231
12254
|
const handleBeforeUnload = () => {
|
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) &&
|
12255
|
+
var _a;
|
12256
|
+
if (activeIndex === index && ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.url) && videoRef && !isPauseVideo) {
|
12234
12257
|
handleClickVideo('pause')();
|
12235
12258
|
}
|
12236
12259
|
};
|
@@ -12268,19 +12291,15 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
|
|
12268
12291
|
right: 0
|
12269
12292
|
} },
|
12270
12293
|
React.createElement("div", { style: { position: 'relative', width: '100%', height: '100%' } },
|
12271
|
-
React.createElement("
|
12272
|
-
width: '100%',
|
12273
|
-
height: '100%',
|
12274
|
-
objectFit: 'contain'
|
12275
|
-
} }),
|
12294
|
+
React.createElement("div", { className: 'n-full-screen', ref: videoEleRef, id: videoId, style: { width: '100%', height: '100%' } }),
|
12276
12295
|
React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON }))),
|
12277
|
-
renderPoster)) : (React.createElement("div", { className: 'video-container', key: rec.video.itemId,
|
12296
|
+
renderPoster)) : (React.createElement("div", { className: 'video-container', key: rec.video.itemId, style: {
|
12278
12297
|
position: 'relative',
|
12279
12298
|
width: '100%',
|
12280
12299
|
height,
|
12281
12300
|
overflow: 'hidden'
|
12282
|
-
} },
|
12283
|
-
React.createElement("
|
12301
|
+
}, onClick: handleClickVideo() },
|
12302
|
+
React.createElement("div", { className: 'n-full-screen', ref: videoEleRef, id: videoId, style: { width: '100%', height: '100%' } }),
|
12284
12303
|
renderPoster,
|
12285
12304
|
React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON })))));
|
12286
12305
|
};
|
@@ -12629,7 +12648,7 @@ var Tagbar$1 = React.memo(Tagbar);
|
|
12629
12648
|
* @Author: binruan@chatlabs.com
|
12630
12649
|
* @Date: 2024-01-15 19:03:09
|
12631
12650
|
* @LastEditors: binruan@chatlabs.com
|
12632
|
-
* @LastEditTime: 2024-04-
|
12651
|
+
* @LastEditTime: 2024-04-29 16:33:53
|
12633
12652
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
|
12634
12653
|
*
|
12635
12654
|
*/
|
@@ -12645,6 +12664,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
12645
12664
|
const [isLoadMore, setIsLoadMore] = React.useState(false);
|
12646
12665
|
const [isShowMore, setIsShowMore] = React.useState(false);
|
12647
12666
|
const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData } = useSxpDataSource();
|
12667
|
+
const [videoRef, setVideoRef] = React.useState(null);
|
12668
|
+
const playerRef = React.useRef();
|
12648
12669
|
const { productView } = useEventReport();
|
12649
12670
|
const isShowFingerTip = React.useMemo(() => {
|
12650
12671
|
return data.length > 0 && !loading && getFeUserId();
|
@@ -12682,6 +12703,25 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
12682
12703
|
viewTime.current = new Date();
|
12683
12704
|
refreshFeSessionId();
|
12684
12705
|
};
|
12706
|
+
const firstRef = React.useRef();
|
12707
|
+
React.useEffect(() => {
|
12708
|
+
if (!firstRef.current && !videoRef) {
|
12709
|
+
firstRef.current = true;
|
12710
|
+
const player = TCPlayer('player-container-id', {
|
12711
|
+
licenseUrl: 'https://license.vod2.myqcloud.com/license/v2/1325816236_1/v_cube.license', // license 地址,参考准备工作部分,在视立方控制台申请 license 后可获得 licenseUrl
|
12712
|
+
controls: false,
|
12713
|
+
autoplay: false,
|
12714
|
+
loop: false,
|
12715
|
+
muted: true,
|
12716
|
+
preload: 'auto',
|
12717
|
+
posterImage: false,
|
12718
|
+
bigPlayButton: true
|
12719
|
+
});
|
12720
|
+
player === null || player === void 0 ? void 0 : player.ready(() => {
|
12721
|
+
setVideoRef(player);
|
12722
|
+
});
|
12723
|
+
}
|
12724
|
+
}, [videoRef]);
|
12685
12725
|
React.useEffect(() => {
|
12686
12726
|
if (!isInit)
|
12687
12727
|
handleH5EnterLink();
|
@@ -12797,7 +12837,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
12797
12837
|
const renderContent = React.useCallback((rec, index) => {
|
12798
12838
|
var _a, _b, _c, _d;
|
12799
12839
|
if ((_a = rec.video) === null || _a === void 0 ? void 0 : _a.url) {
|
12800
|
-
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 }));
|
12840
|
+
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 }));
|
12801
12841
|
}
|
12802
12842
|
if ((_b = rec.video) === null || _b === void 0 ? void 0 : _b.imgUrls) {
|
12803
12843
|
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 }));
|
@@ -12812,7 +12852,19 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
12812
12852
|
});
|
12813
12853
|
}
|
12814
12854
|
return null;
|
12815
|
-
}, [
|
12855
|
+
}, [
|
12856
|
+
containerWidth,
|
12857
|
+
data,
|
12858
|
+
height,
|
12859
|
+
isMuted,
|
12860
|
+
activeIndex,
|
12861
|
+
globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost,
|
12862
|
+
viewTime,
|
12863
|
+
tipText,
|
12864
|
+
resolver,
|
12865
|
+
schema,
|
12866
|
+
videoRef
|
12867
|
+
]);
|
12816
12868
|
const onExpandableChange = React.useCallback((v) => {
|
12817
12869
|
setIsShowMore(v);
|
12818
12870
|
}, []);
|
@@ -12998,7 +13050,12 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
12998
13050
|
renderLogo,
|
12999
13051
|
React.createElement(Tagbar$1, { tagList: tagList, setActiveIndex: setActiveIndex }),
|
13000
13052
|
isShowFingerTip ? React.createElement(FingerSwipeTip, { imageUrl: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.swipeTipIcon }) : null,
|
13001
|
-
React.createElement(Swiper, { ref: swiperRef,
|
13053
|
+
React.createElement(Swiper, { ref: swiperRef, onSlideChange: () => {
|
13054
|
+
swiperRef.current.swiper.allowTouchMove = false;
|
13055
|
+
setTimeout(() => {
|
13056
|
+
swiperRef.current.swiper.allowTouchMove = true;
|
13057
|
+
}, 500);
|
13058
|
+
}, onActiveIndexChange: (swiper) => {
|
13002
13059
|
setActiveIndex(swiper.activeIndex);
|
13003
13060
|
if (openHashtag)
|
13004
13061
|
return;
|
@@ -13015,6 +13072,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
13015
13072
|
}
|
13016
13073
|
}
|
13017
13074
|
},
|
13075
|
+
// style={{
|
13076
|
+
// pointerEvents: canSwiper ? 'auto' : 'none'
|
13077
|
+
// }}
|
13018
13078
|
// onReachEnd={() => {
|
13019
13079
|
// // 由hashtaglist跳转过来时不执行下面的方法
|
13020
13080
|
// if (waterFallData) return;
|
@@ -13037,7 +13097,16 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
13037
13097
|
zIndex: 999
|
13038
13098
|
}, 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 }),
|
13039
13099
|
renderView),
|
13040
|
-
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))
|
13100
|
+
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)),
|
13101
|
+
React.createElement("div", { style: { position: 'absolute', zIndex: -100 } },
|
13102
|
+
React.createElement("video", { ref: playerRef, id: 'player-container-id', playsInline: true, crossOrigin: 'anonymous', style: {
|
13103
|
+
backgroundColor: 'transparent',
|
13104
|
+
width: '100%',
|
13105
|
+
height: '100%',
|
13106
|
+
objectFit: 'cover',
|
13107
|
+
pointerEvents: 'none'
|
13108
|
+
} }),
|
13109
|
+
React.createElement("div", { id: 'player-container-id-copy' }))));
|
13041
13110
|
};
|
13042
13111
|
|
13043
13112
|
const PictureGroup = ({ imgUrls, width, height, imgUrlsPostConfig, rec, index }) => {
|