pb-sxp-ui 1.0.31 → 1.0.33
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 +56 -55
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +0 -6
- package/dist/index.js +56 -55
- 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 +60 -58
- 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.js +56 -55
- package/lib/core/components/SxpPageRender/VideoWidget/index.js +56 -55
- package/package.json +1 -2
package/dist/index.cjs
CHANGED
@@ -10,7 +10,6 @@ var qs = require('qs');
|
|
10
10
|
var css = require('@emotion/css');
|
11
11
|
var proComponents = require('@ant-design/pro-components');
|
12
12
|
var ReactDOM = require('react-dom');
|
13
|
-
var Hls = require('hls.js');
|
14
13
|
var EventEmitter = require('eventemitter3');
|
15
14
|
|
16
15
|
function _interopNamespaceDefault(e) {
|
@@ -12001,12 +12000,13 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
12001
12000
|
const { isActive } = useSwiperSlide();
|
12002
12001
|
const canvasRef = React.useRef(null);
|
12003
12002
|
const [firstFrameSrc, setFirstFrameSrc] = React.useState('');
|
12003
|
+
const videoId = `pb-video-${index}`;
|
12004
12004
|
React.useEffect(() => {
|
12005
12005
|
if (!videoRef.current)
|
12006
12006
|
return;
|
12007
|
-
videoRef.current.muted
|
12007
|
+
videoRef.current.muted(muted);
|
12008
12008
|
}, [muted]);
|
12009
|
-
const
|
12009
|
+
const handleEnded = React.useCallback(() => {
|
12010
12010
|
var _a;
|
12011
12011
|
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
|
12012
12012
|
}, []);
|
@@ -12015,10 +12015,10 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
12015
12015
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
12016
12016
|
setIsPauseVideo(false);
|
12017
12017
|
const item = data[index];
|
12018
|
-
if (item && ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.duration)) {
|
12019
|
-
videoStartTime.current = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.currentTime) || 0;
|
12020
|
-
const videoDuration = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.duration) !== null && _d !== void 0 ? _d : 0).toFixed(2);
|
12021
|
-
const videoCurrentTime = ((_f = (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.currentTime) !== null && _f !== void 0 ? _f : 0).toFixed(2);
|
12018
|
+
if (item && ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.duration())) {
|
12019
|
+
videoStartTime.current = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.currentTime()) || 0;
|
12020
|
+
const videoDuration = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.duration()) !== null && _d !== void 0 ? _d : 0).toFixed(2);
|
12021
|
+
const videoCurrentTime = ((_f = (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.currentTime()) !== null && _f !== void 0 ? _f : 0).toFixed(2);
|
12022
12022
|
const playType = isFirstPlay ? '0' : '1';
|
12023
12023
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
12024
12024
|
eventInfo: {
|
@@ -12038,14 +12038,14 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
12038
12038
|
setIsFirstPlay(false);
|
12039
12039
|
}
|
12040
12040
|
}, [bffEventReport, data, index, isFirstPlay]);
|
12041
|
-
const
|
12041
|
+
const handleCanplay = React.useCallback(() => {
|
12042
12042
|
setIsLoadFinish(true);
|
12043
12043
|
}, []);
|
12044
12044
|
const handleClickVideo = React.useCallback((type) => () => {
|
12045
12045
|
var _a, _b, _c, _d, _e;
|
12046
12046
|
if (!isLoadFinish)
|
12047
12047
|
return;
|
12048
|
-
const isPause = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.paused;
|
12048
|
+
const isPause = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.paused();
|
12049
12049
|
switch (type) {
|
12050
12050
|
case 'start':
|
12051
12051
|
if (!isPause)
|
@@ -12070,13 +12070,13 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
12070
12070
|
break;
|
12071
12071
|
}
|
12072
12072
|
}, [isLoadFinish]);
|
12073
|
-
const
|
12073
|
+
const handlePause = React.useCallback(() => {
|
12074
12074
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
12075
12075
|
const item = data[index];
|
12076
|
-
const videoDuration = ((_b = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.duration) !== null && _b !== void 0 ? _b : 0).toFixed(2);
|
12077
|
-
const videoCurrentTime = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.currentTime) !== null && _d !== void 0 ? _d : 0).toFixed(2);
|
12078
|
-
if ((_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.duration) {
|
12079
|
-
const playDuration = (((_f = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _f === void 0 ? void 0 : _f.currentTime) - videoStartTime.current).toFixed(2);
|
12076
|
+
const videoDuration = ((_b = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.duration()) !== null && _b !== void 0 ? _b : 0).toFixed(2);
|
12077
|
+
const videoCurrentTime = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.currentTime()) !== null && _d !== void 0 ? _d : 0).toFixed(2);
|
12078
|
+
if ((_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.duration()) {
|
12079
|
+
const playDuration = (((_f = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _f === void 0 ? void 0 : _f.currentTime()) - videoStartTime.current).toFixed(2);
|
12080
12080
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
12081
12081
|
eventInfo: {
|
12082
12082
|
eventSubject: 'playOverVideo',
|
@@ -12108,9 +12108,10 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
12108
12108
|
return ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) || firstFrameSrc;
|
12109
12109
|
}, [firstFrameSrc, rec]);
|
12110
12110
|
const handLoadeddata = React.useCallback(() => {
|
12111
|
-
|
12111
|
+
const videoDomRef = document.getElementById(`${videoId}_html5_api`);
|
12112
|
+
if (!canvasRef || !videoDomRef || !canvasRef.current)
|
12112
12113
|
return;
|
12113
|
-
const video =
|
12114
|
+
const video = videoDomRef;
|
12114
12115
|
const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
|
12115
12116
|
const ctx = canvas.getContext('2d');
|
12116
12117
|
const targetWidth = window === null || window === void 0 ? void 0 : window.innerWidth;
|
@@ -12121,43 +12122,35 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
12121
12122
|
setFirstFrameSrc(canvas.toDataURL());
|
12122
12123
|
}, []);
|
12123
12124
|
React.useEffect(() => {
|
12124
|
-
var _a, _b, _c, _d;
|
12125
|
-
if (
|
12125
|
+
var _a, _b, _c, _d, _e, _f;
|
12126
|
+
if (videoRef.current)
|
12126
12127
|
return;
|
12127
12128
|
setIsPauseVideo(false);
|
12128
|
-
|
12129
|
-
|
12130
|
-
|
12131
|
-
|
12132
|
-
|
12133
|
-
|
12134
|
-
|
12135
|
-
|
12136
|
-
|
12137
|
-
|
12138
|
-
|
12139
|
-
|
12140
|
-
|
12141
|
-
|
12142
|
-
|
12143
|
-
|
12144
|
-
|
12145
|
-
}
|
12146
|
-
videoRef.current.setAttribute('x5-playsinline', 'true');
|
12147
|
-
videoRef.current.setAttribute('webkit-playsinline', 'true');
|
12129
|
+
const videoSrc = rec.video.url;
|
12130
|
+
if (videoSrc && typeof TCPlayer === 'function') {
|
12131
|
+
videoRef.current = TCPlayer(videoId, {
|
12132
|
+
sources: [
|
12133
|
+
{
|
12134
|
+
src: videoSrc // 播放地址
|
12135
|
+
}
|
12136
|
+
],
|
12137
|
+
licenseUrl: 'https://license.vod2.myqcloud.com/license/v2/1325816236_1/v_cube.license', // license 地址,参考准备工作部分,在视立方控制台申请 license 后可获得 licenseUrl
|
12138
|
+
controls: false,
|
12139
|
+
autoplay: false,
|
12140
|
+
loop: false,
|
12141
|
+
muted: true,
|
12142
|
+
preload: 'meta',
|
12143
|
+
posterImage: false,
|
12144
|
+
bigPlayButton: true
|
12145
|
+
});
|
12148
12146
|
}
|
12149
|
-
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.
|
12150
|
-
(_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.
|
12151
|
-
(_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.
|
12152
|
-
(_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.
|
12153
|
-
|
12154
|
-
|
12155
|
-
|
12156
|
-
(_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('canplay', handleLoadedMetadata);
|
12157
|
-
(_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.removeEventListener('playing', handlePlaying);
|
12158
|
-
(_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.removeEventListener('loadeddata', handLoadeddata);
|
12159
|
-
};
|
12160
|
-
}, [handleLoadedMetadata, handlePlaying, rec.video, handLoadeddata]);
|
12147
|
+
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.on('loadedmetadata', handleCanplay);
|
12148
|
+
(_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.on('canplay', handleCanplay);
|
12149
|
+
(_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.on('playing', handlePlaying);
|
12150
|
+
(_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.on('loadeddata', handLoadeddata);
|
12151
|
+
(_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.on('pause', handlePause);
|
12152
|
+
(_f = videoRef.current) === null || _f === void 0 ? void 0 : _f.on('ended', handleEnded);
|
12153
|
+
}, [handleCanplay, handlePlaying, rec.video, handLoadeddata, index, handlePause, handleEnded, videoId]);
|
12161
12154
|
React.useEffect(() => {
|
12162
12155
|
var _a;
|
12163
12156
|
if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || !isLoadFinish)
|
@@ -12243,19 +12236,27 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
12243
12236
|
right: 0
|
12244
12237
|
} },
|
12245
12238
|
React.createElement("div", { style: { position: 'relative', width: '100%', height: '100%' } },
|
12246
|
-
React.createElement("video", { id: `pb-video-${index}`,
|
12239
|
+
React.createElement("video", { id: `pb-video-${index}`, playsInline: true, crossOrigin: 'anonymous', style: {
|
12247
12240
|
width: '100%',
|
12248
12241
|
height: '100%',
|
12249
|
-
objectFit: 'contain'
|
12242
|
+
objectFit: 'contain',
|
12243
|
+
backgroundColor: 'transparent',
|
12244
|
+
pointerEvents: 'none'
|
12250
12245
|
} }),
|
12251
12246
|
React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON }))),
|
12252
|
-
renderPoster)) : (React.createElement("div", { className: 'video-container', key: rec.video.itemId,
|
12247
|
+
renderPoster)) : (React.createElement("div", { className: 'video-container', key: rec.video.itemId, style: {
|
12253
12248
|
position: 'relative',
|
12254
12249
|
width: '100%',
|
12255
12250
|
height,
|
12256
12251
|
overflow: 'hidden'
|
12257
|
-
} },
|
12258
|
-
React.createElement("video", { id: `pb-video-${index}`,
|
12252
|
+
}, onClick: handleClickVideo() },
|
12253
|
+
React.createElement("video", { id: `pb-video-${index}`, playsInline: true, crossOrigin: 'anonymous', style: {
|
12254
|
+
backgroundColor: 'transparent',
|
12255
|
+
width: '100%',
|
12256
|
+
height: '100%',
|
12257
|
+
objectFit: 'cover',
|
12258
|
+
pointerEvents: 'none'
|
12259
|
+
} }),
|
12259
12260
|
renderPoster,
|
12260
12261
|
React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON })))));
|
12261
12262
|
};
|