pb-sxp-ui 1.15.22-alpha.4 → 1.15.22-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +15 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +15 -14
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +6 -6
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +6 -6
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +15 -14
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +6 -6
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/components/SxpPageRender/VideoWidget/index.js +15 -14
- package/lib/core/components/SxpPageRender/VideoWidget/index.js +15 -14
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -17662,7 +17662,7 @@ const mountVideoPlayerAtNode = (() => {
|
|
17662
17662
|
})();
|
17663
17663
|
|
17664
17664
|
const VideoWidget$4 = forwardRef(({ rec, index, height, data, muted, activeIndex, videoPostConfig, videoPlayIcon, loopPlay, swiperRef }, ref) => {
|
17665
|
-
var _a, _b
|
17665
|
+
var _a, _b;
|
17666
17666
|
const [isPauseVideo, setIsPauseVideo] = useState(false);
|
17667
17667
|
const { bffEventReport, sxpParameter, waterFallData, openHashtag, bffFbReport, isDiyH5 } = useSxpDataSource();
|
17668
17668
|
const videoStartTime = useRef(0);
|
@@ -17682,9 +17682,7 @@ const VideoWidget$4 = forwardRef(({ rec, index, height, data, muted, activeIndex
|
|
17682
17682
|
const scene = rec.video.scene;
|
17683
17683
|
const videoUrl = (scene === null || scene === void 0 ? void 0 : scene.mediaUrl) || ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.url);
|
17684
17684
|
const videoCover = (scene === null || scene === void 0 ? void 0 : scene.mediaUrl) ? scene === null || scene === void 0 ? void 0 : scene.cover : (_b = rec === null || rec === void 0 ? void 0 : rec.video) === null || _b === void 0 ? void 0 : _b.cover;
|
17685
|
-
const videoPoster = (
|
17686
|
-
? (_c = scene === null || scene === void 0 ? void 0 : scene.cover) !== null && _c !== void 0 ? _c : sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image
|
17687
|
-
: (_e = (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.cover) !== null && _e !== void 0 ? _e : sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image;
|
17685
|
+
const videoPoster = videoCover || (sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image);
|
17688
17686
|
useImperativeHandle(ref, () => {
|
17689
17687
|
return {
|
17690
17688
|
setLoopPlay(v) {
|
@@ -17740,22 +17738,27 @@ const VideoWidget$4 = forwardRef(({ rec, index, height, data, muted, activeIndex
|
|
17740
17738
|
setIsLoadFinish(true);
|
17741
17739
|
}, []);
|
17742
17740
|
const handleStartPlay = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
17743
|
-
var _f, _g, _h, _j, _k, _l, _m, _o, _p, _q
|
17741
|
+
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
17744
17742
|
if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current))
|
17745
17743
|
return;
|
17746
17744
|
setIsPauseVideo(false);
|
17747
17745
|
const item = data[index];
|
17748
|
-
if (item && ((
|
17749
|
-
videoStartTime.current = ((
|
17750
|
-
const videoDuration = ((
|
17751
|
-
const videoCurrentTime = ((
|
17746
|
+
if (item && ((_c = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _c === void 0 ? void 0 : _c.duration)) {
|
17747
|
+
videoStartTime.current = ((_d = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _d === void 0 ? void 0 : _d.currentTime) || 0;
|
17748
|
+
const videoDuration = ((_f = (_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.duration) !== null && _f !== void 0 ? _f : 0).toFixed(2);
|
17749
|
+
const videoCurrentTime = ((_h = (_g = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _g === void 0 ? void 0 : _g.currentTime) !== null && _h !== void 0 ? _h : 0).toFixed(2);
|
17752
17750
|
const playType = (isFirstPlayRef === null || isFirstPlayRef === void 0 ? void 0 : isFirstPlayRef.current) ? '0' : '1';
|
17753
17751
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
17754
|
-
eventInfo: Object.assign({ eventSubject: 'playVideo', eventDescription: 'User played the video', contentId: (
|
17752
|
+
eventInfo: Object.assign({ eventSubject: 'playVideo', eventDescription: 'User played the video', contentId: (_k = (_j = item === null || item === void 0 ? void 0 : item.video) === null || _j === void 0 ? void 0 : _j.itemId) !== null && _k !== void 0 ? _k : '', contentName: (_m = (_l = item === null || item === void 0 ? void 0 : item.video) === null || _l === void 0 ? void 0 : _l.title) !== null && _m !== void 0 ? _m : '', playType, startTime: videoCurrentTime, videoDuration, contentTags: JSON.stringify((_p = (_o = item === null || item === void 0 ? void 0 : item.video) === null || _o === void 0 ? void 0 : _o.tags) !== null && _p !== void 0 ? _p : []), position: index + '', contentFormat: 'video', traceInfo: (_q = item === null || item === void 0 ? void 0 : item.video) === null || _q === void 0 ? void 0 : _q.traceInfo }, ((isFirstPlayRef === null || isFirstPlayRef === void 0 ? void 0 : isFirstPlayRef.current) && { loadTime: (loadedTimeRef === null || loadedTimeRef === void 0 ? void 0 : loadedTimeRef.current) - (initTimeRef === null || initTimeRef === void 0 ? void 0 : initTimeRef.current) + '' }))
|
17755
17753
|
});
|
17756
17754
|
isFirstPlayRef.current = false;
|
17757
17755
|
}
|
17758
17756
|
}), [bffEventReport, data, index, isFirstPlayRef, videoRef === null || videoRef === void 0 ? void 0 : videoRef.current]);
|
17757
|
+
const setCurrentTimeByStartTime = useCallback(() => {
|
17758
|
+
if (isDiyH5) {
|
17759
|
+
videoRef.current.currentTime = scene === null || scene === void 0 ? void 0 : scene.startTime;
|
17760
|
+
}
|
17761
|
+
}, []);
|
17759
17762
|
const handLoadeddata = useCallback(() => {
|
17760
17763
|
if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || firstFrameSrc || !blur)
|
17761
17764
|
return;
|
@@ -17780,9 +17783,7 @@ const VideoWidget$4 = forwardRef(({ rec, index, height, data, muted, activeIndex
|
|
17780
17783
|
const handleLoadedmetadata = useCallback(() => {
|
17781
17784
|
if (!videoRef.current)
|
17782
17785
|
return;
|
17783
|
-
|
17784
|
-
videoRef.current.currentTime = scene === null || scene === void 0 ? void 0 : scene.startTime;
|
17785
|
-
}
|
17786
|
+
setCurrentTimeByStartTime();
|
17786
17787
|
loadedTimeRef.current = new Date();
|
17787
17788
|
handleStartPlay();
|
17788
17789
|
handLoadeddata();
|
@@ -17894,7 +17895,7 @@ const VideoWidget$4 = forwardRef(({ rec, index, height, data, muted, activeIndex
|
|
17894
17895
|
hls === null || hls === void 0 ? void 0 : hls.attachMedia(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current);
|
17895
17896
|
hls === null || hls === void 0 ? void 0 : hls.on(Hls.Events.MANIFEST_PARSED, function () {
|
17896
17897
|
var _a;
|
17897
|
-
|
17898
|
+
setCurrentTimeByStartTime();
|
17898
17899
|
(_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
|
17899
17900
|
});
|
17900
17901
|
}
|