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
@@ -1,6 +1,5 @@
|
|
1
1
|
import React, { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
2
2
|
import { useSwiperSlide } from 'swiper/react';
|
3
|
-
import Hls from 'hls.js';
|
4
3
|
import { useIconLink } from '../useIconLink';
|
5
4
|
import FormatImage from '../FormatImage';
|
6
5
|
import { useSxpDataSource } from '../../../../core/hooks';
|
@@ -15,12 +14,13 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
15
14
|
const { isActive } = useSwiperSlide();
|
16
15
|
const canvasRef = useRef(null);
|
17
16
|
const [firstFrameSrc, setFirstFrameSrc] = useState('');
|
17
|
+
const videoId = `pb-video-${index}`;
|
18
18
|
useEffect(() => {
|
19
19
|
if (!videoRef.current)
|
20
20
|
return;
|
21
|
-
videoRef.current.muted
|
21
|
+
videoRef.current.muted(muted);
|
22
22
|
}, [muted]);
|
23
|
-
const
|
23
|
+
const handleEnded = useCallback(() => {
|
24
24
|
var _a;
|
25
25
|
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
|
26
26
|
}, []);
|
@@ -29,10 +29,10 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
29
29
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
30
30
|
setIsPauseVideo(false);
|
31
31
|
const item = data[index];
|
32
|
-
if (item && ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.duration)) {
|
33
|
-
videoStartTime.current = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.currentTime) || 0;
|
34
|
-
const videoDuration = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.duration) !== null && _d !== void 0 ? _d : 0).toFixed(2);
|
35
|
-
const videoCurrentTime = ((_f = (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.currentTime) !== null && _f !== void 0 ? _f : 0).toFixed(2);
|
32
|
+
if (item && ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.duration())) {
|
33
|
+
videoStartTime.current = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.currentTime()) || 0;
|
34
|
+
const videoDuration = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.duration()) !== null && _d !== void 0 ? _d : 0).toFixed(2);
|
35
|
+
const videoCurrentTime = ((_f = (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.currentTime()) !== null && _f !== void 0 ? _f : 0).toFixed(2);
|
36
36
|
const playType = isFirstPlay ? '0' : '1';
|
37
37
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
38
38
|
eventInfo: {
|
@@ -52,14 +52,14 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
52
52
|
setIsFirstPlay(false);
|
53
53
|
}
|
54
54
|
}, [bffEventReport, data, index, isFirstPlay]);
|
55
|
-
const
|
55
|
+
const handleCanplay = useCallback(() => {
|
56
56
|
setIsLoadFinish(true);
|
57
57
|
}, []);
|
58
58
|
const handleClickVideo = useCallback((type) => () => {
|
59
59
|
var _a, _b, _c, _d, _e;
|
60
60
|
if (!isLoadFinish)
|
61
61
|
return;
|
62
|
-
const isPause = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.paused;
|
62
|
+
const isPause = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.paused();
|
63
63
|
switch (type) {
|
64
64
|
case 'start':
|
65
65
|
if (!isPause)
|
@@ -84,13 +84,13 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
84
84
|
break;
|
85
85
|
}
|
86
86
|
}, [isLoadFinish]);
|
87
|
-
const
|
87
|
+
const handlePause = useCallback(() => {
|
88
88
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
89
89
|
const item = data[index];
|
90
|
-
const videoDuration = ((_b = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.duration) !== null && _b !== void 0 ? _b : 0).toFixed(2);
|
91
|
-
const videoCurrentTime = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.currentTime) !== null && _d !== void 0 ? _d : 0).toFixed(2);
|
92
|
-
if ((_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.duration) {
|
93
|
-
const playDuration = (((_f = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _f === void 0 ? void 0 : _f.currentTime) - videoStartTime.current).toFixed(2);
|
90
|
+
const videoDuration = ((_b = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.duration()) !== null && _b !== void 0 ? _b : 0).toFixed(2);
|
91
|
+
const videoCurrentTime = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.currentTime()) !== null && _d !== void 0 ? _d : 0).toFixed(2);
|
92
|
+
if ((_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.duration()) {
|
93
|
+
const playDuration = (((_f = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _f === void 0 ? void 0 : _f.currentTime()) - videoStartTime.current).toFixed(2);
|
94
94
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
95
95
|
eventInfo: {
|
96
96
|
eventSubject: 'playOverVideo',
|
@@ -122,9 +122,10 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
122
122
|
return ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) || firstFrameSrc;
|
123
123
|
}, [firstFrameSrc, rec]);
|
124
124
|
const handLoadeddata = useCallback(() => {
|
125
|
-
|
125
|
+
const videoDomRef = document.getElementById(`${videoId}_html5_api`);
|
126
|
+
if (!canvasRef || !videoDomRef || !canvasRef.current)
|
126
127
|
return;
|
127
|
-
const video =
|
128
|
+
const video = videoDomRef;
|
128
129
|
const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
|
129
130
|
const ctx = canvas.getContext('2d');
|
130
131
|
const targetWidth = window === null || window === void 0 ? void 0 : window.innerWidth;
|
@@ -135,43 +136,35 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
135
136
|
setFirstFrameSrc(canvas.toDataURL());
|
136
137
|
}, []);
|
137
138
|
useEffect(() => {
|
138
|
-
var _a, _b, _c, _d;
|
139
|
-
if (
|
139
|
+
var _a, _b, _c, _d, _e, _f;
|
140
|
+
if (videoRef.current)
|
140
141
|
return;
|
141
142
|
setIsPauseVideo(false);
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
}
|
160
|
-
videoRef.current.setAttribute('x5-playsinline', 'true');
|
161
|
-
videoRef.current.setAttribute('webkit-playsinline', 'true');
|
143
|
+
const videoSrc = rec.video.url;
|
144
|
+
if (videoSrc && typeof TCPlayer === 'function') {
|
145
|
+
videoRef.current = TCPlayer(videoId, {
|
146
|
+
sources: [
|
147
|
+
{
|
148
|
+
src: videoSrc
|
149
|
+
}
|
150
|
+
],
|
151
|
+
licenseUrl: 'https://license.vod2.myqcloud.com/license/v2/1325816236_1/v_cube.license',
|
152
|
+
controls: false,
|
153
|
+
autoplay: false,
|
154
|
+
loop: false,
|
155
|
+
muted: true,
|
156
|
+
preload: 'meta',
|
157
|
+
posterImage: false,
|
158
|
+
bigPlayButton: true
|
159
|
+
});
|
162
160
|
}
|
163
|
-
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.
|
164
|
-
(_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.
|
165
|
-
(_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.
|
166
|
-
(_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
(_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('canplay', handleLoadedMetadata);
|
171
|
-
(_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.removeEventListener('playing', handlePlaying);
|
172
|
-
(_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.removeEventListener('loadeddata', handLoadeddata);
|
173
|
-
};
|
174
|
-
}, [handleLoadedMetadata, handlePlaying, rec.video, handLoadeddata]);
|
161
|
+
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.on('loadedmetadata', handleCanplay);
|
162
|
+
(_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.on('canplay', handleCanplay);
|
163
|
+
(_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.on('playing', handlePlaying);
|
164
|
+
(_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.on('loadeddata', handLoadeddata);
|
165
|
+
(_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.on('pause', handlePause);
|
166
|
+
(_f = videoRef.current) === null || _f === void 0 ? void 0 : _f.on('ended', handleEnded);
|
167
|
+
}, [handleCanplay, handlePlaying, rec.video, handLoadeddata, index, handlePause, handleEnded, videoId]);
|
175
168
|
useEffect(() => {
|
176
169
|
var _a;
|
177
170
|
if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || !isLoadFinish)
|
@@ -254,19 +247,27 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
254
247
|
right: 0
|
255
248
|
} },
|
256
249
|
React.createElement("div", { style: { position: 'relative', width: '100%', height: '100%' } },
|
257
|
-
React.createElement("video", { id: `pb-video-${index}`,
|
250
|
+
React.createElement("video", { id: `pb-video-${index}`, playsInline: true, crossOrigin: 'anonymous', style: {
|
258
251
|
width: '100%',
|
259
252
|
height: '100%',
|
260
|
-
objectFit: 'contain'
|
253
|
+
objectFit: 'contain',
|
254
|
+
backgroundColor: 'transparent',
|
255
|
+
pointerEvents: 'none'
|
261
256
|
} }),
|
262
257
|
React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON }))),
|
263
|
-
renderPoster)) : (React.createElement("div", { className: 'video-container', key: rec.video.itemId,
|
258
|
+
renderPoster)) : (React.createElement("div", { className: 'video-container', key: rec.video.itemId, style: {
|
264
259
|
position: 'relative',
|
265
260
|
width: '100%',
|
266
261
|
height,
|
267
262
|
overflow: 'hidden'
|
268
|
-
} },
|
269
|
-
React.createElement("video", { id: `pb-video-${index}`,
|
263
|
+
}, onClick: handleClickVideo() },
|
264
|
+
React.createElement("video", { id: `pb-video-${index}`, playsInline: true, crossOrigin: 'anonymous', style: {
|
265
|
+
backgroundColor: 'transparent',
|
266
|
+
width: '100%',
|
267
|
+
height: '100%',
|
268
|
+
objectFit: 'cover',
|
269
|
+
pointerEvents: 'none'
|
270
|
+
} }),
|
270
271
|
renderPoster,
|
271
272
|
React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON })))));
|
272
273
|
};
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
4
4
|
const react_1 = tslib_1.__importStar(require("react"));
|
5
5
|
const react_2 = require("swiper/react");
|
6
|
-
const hls_js_1 = tslib_1.__importDefault(require("hls.js"));
|
7
6
|
const useIconLink_1 = require("../useIconLink");
|
8
7
|
const FormatImage_1 = tslib_1.__importDefault(require("../FormatImage"));
|
9
8
|
const hooks_1 = require("../../../../core/hooks");
|
@@ -18,12 +17,13 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
18
17
|
const { isActive } = (0, react_2.useSwiperSlide)();
|
19
18
|
const canvasRef = (0, react_1.useRef)(null);
|
20
19
|
const [firstFrameSrc, setFirstFrameSrc] = (0, react_1.useState)('');
|
20
|
+
const videoId = `pb-video-${index}`;
|
21
21
|
(0, react_1.useEffect)(() => {
|
22
22
|
if (!videoRef.current)
|
23
23
|
return;
|
24
|
-
videoRef.current.muted
|
24
|
+
videoRef.current.muted(muted);
|
25
25
|
}, [muted]);
|
26
|
-
const
|
26
|
+
const handleEnded = (0, react_1.useCallback)(() => {
|
27
27
|
var _a;
|
28
28
|
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
|
29
29
|
}, []);
|
@@ -32,10 +32,10 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
32
32
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
33
33
|
setIsPauseVideo(false);
|
34
34
|
const item = data[index];
|
35
|
-
if (item && ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.duration)) {
|
36
|
-
videoStartTime.current = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.currentTime) || 0;
|
37
|
-
const videoDuration = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.duration) !== null && _d !== void 0 ? _d : 0).toFixed(2);
|
38
|
-
const videoCurrentTime = ((_f = (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.currentTime) !== null && _f !== void 0 ? _f : 0).toFixed(2);
|
35
|
+
if (item && ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.duration())) {
|
36
|
+
videoStartTime.current = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.currentTime()) || 0;
|
37
|
+
const videoDuration = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.duration()) !== null && _d !== void 0 ? _d : 0).toFixed(2);
|
38
|
+
const videoCurrentTime = ((_f = (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.currentTime()) !== null && _f !== void 0 ? _f : 0).toFixed(2);
|
39
39
|
const playType = isFirstPlay ? '0' : '1';
|
40
40
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
41
41
|
eventInfo: {
|
@@ -55,14 +55,14 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
55
55
|
setIsFirstPlay(false);
|
56
56
|
}
|
57
57
|
}, [bffEventReport, data, index, isFirstPlay]);
|
58
|
-
const
|
58
|
+
const handleCanplay = (0, react_1.useCallback)(() => {
|
59
59
|
setIsLoadFinish(true);
|
60
60
|
}, []);
|
61
61
|
const handleClickVideo = (0, react_1.useCallback)((type) => () => {
|
62
62
|
var _a, _b, _c, _d, _e;
|
63
63
|
if (!isLoadFinish)
|
64
64
|
return;
|
65
|
-
const isPause = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.paused;
|
65
|
+
const isPause = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.paused();
|
66
66
|
switch (type) {
|
67
67
|
case 'start':
|
68
68
|
if (!isPause)
|
@@ -87,13 +87,13 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
87
87
|
break;
|
88
88
|
}
|
89
89
|
}, [isLoadFinish]);
|
90
|
-
const
|
90
|
+
const handlePause = (0, react_1.useCallback)(() => {
|
91
91
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
92
92
|
const item = data[index];
|
93
|
-
const videoDuration = ((_b = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.duration) !== null && _b !== void 0 ? _b : 0).toFixed(2);
|
94
|
-
const videoCurrentTime = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.currentTime) !== null && _d !== void 0 ? _d : 0).toFixed(2);
|
95
|
-
if ((_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.duration) {
|
96
|
-
const playDuration = (((_f = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _f === void 0 ? void 0 : _f.currentTime) - videoStartTime.current).toFixed(2);
|
93
|
+
const videoDuration = ((_b = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.duration()) !== null && _b !== void 0 ? _b : 0).toFixed(2);
|
94
|
+
const videoCurrentTime = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.currentTime()) !== null && _d !== void 0 ? _d : 0).toFixed(2);
|
95
|
+
if ((_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.duration()) {
|
96
|
+
const playDuration = (((_f = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _f === void 0 ? void 0 : _f.currentTime()) - videoStartTime.current).toFixed(2);
|
97
97
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
98
98
|
eventInfo: {
|
99
99
|
eventSubject: 'playOverVideo',
|
@@ -125,9 +125,10 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
125
125
|
return ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) || firstFrameSrc;
|
126
126
|
}, [firstFrameSrc, rec]);
|
127
127
|
const handLoadeddata = (0, react_1.useCallback)(() => {
|
128
|
-
|
128
|
+
const videoDomRef = document.getElementById(`${videoId}_html5_api`);
|
129
|
+
if (!canvasRef || !videoDomRef || !canvasRef.current)
|
129
130
|
return;
|
130
|
-
const video =
|
131
|
+
const video = videoDomRef;
|
131
132
|
const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
|
132
133
|
const ctx = canvas.getContext('2d');
|
133
134
|
const targetWidth = window === null || window === void 0 ? void 0 : window.innerWidth;
|
@@ -138,43 +139,35 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
138
139
|
setFirstFrameSrc(canvas.toDataURL());
|
139
140
|
}, []);
|
140
141
|
(0, react_1.useEffect)(() => {
|
141
|
-
var _a, _b, _c, _d;
|
142
|
-
if (
|
142
|
+
var _a, _b, _c, _d, _e, _f;
|
143
|
+
if (videoRef.current)
|
143
144
|
return;
|
144
145
|
setIsPauseVideo(false);
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
}
|
163
|
-
videoRef.current.setAttribute('x5-playsinline', 'true');
|
164
|
-
videoRef.current.setAttribute('webkit-playsinline', 'true');
|
146
|
+
const videoSrc = rec.video.url;
|
147
|
+
if (videoSrc && typeof TCPlayer === 'function') {
|
148
|
+
videoRef.current = TCPlayer(videoId, {
|
149
|
+
sources: [
|
150
|
+
{
|
151
|
+
src: videoSrc
|
152
|
+
}
|
153
|
+
],
|
154
|
+
licenseUrl: 'https://license.vod2.myqcloud.com/license/v2/1325816236_1/v_cube.license',
|
155
|
+
controls: false,
|
156
|
+
autoplay: false,
|
157
|
+
loop: false,
|
158
|
+
muted: true,
|
159
|
+
preload: 'meta',
|
160
|
+
posterImage: false,
|
161
|
+
bigPlayButton: true
|
162
|
+
});
|
165
163
|
}
|
166
|
-
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.
|
167
|
-
(_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.
|
168
|
-
(_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.
|
169
|
-
(_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
(_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('canplay', handleLoadedMetadata);
|
174
|
-
(_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.removeEventListener('playing', handlePlaying);
|
175
|
-
(_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.removeEventListener('loadeddata', handLoadeddata);
|
176
|
-
};
|
177
|
-
}, [handleLoadedMetadata, handlePlaying, rec.video, handLoadeddata]);
|
164
|
+
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.on('loadedmetadata', handleCanplay);
|
165
|
+
(_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.on('canplay', handleCanplay);
|
166
|
+
(_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.on('playing', handlePlaying);
|
167
|
+
(_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.on('loadeddata', handLoadeddata);
|
168
|
+
(_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.on('pause', handlePause);
|
169
|
+
(_f = videoRef.current) === null || _f === void 0 ? void 0 : _f.on('ended', handleEnded);
|
170
|
+
}, [handleCanplay, handlePlaying, rec.video, handLoadeddata, index, handlePause, handleEnded, videoId]);
|
178
171
|
(0, react_1.useEffect)(() => {
|
179
172
|
var _a;
|
180
173
|
if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || !isLoadFinish)
|
@@ -257,19 +250,27 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
257
250
|
right: 0
|
258
251
|
} },
|
259
252
|
react_1.default.createElement("div", { style: { position: 'relative', width: '100%', height: '100%' } },
|
260
|
-
react_1.default.createElement("video", { id: `pb-video-${index}`,
|
253
|
+
react_1.default.createElement("video", { id: `pb-video-${index}`, playsInline: true, crossOrigin: 'anonymous', style: {
|
261
254
|
width: '100%',
|
262
255
|
height: '100%',
|
263
|
-
objectFit: 'contain'
|
256
|
+
objectFit: 'contain',
|
257
|
+
backgroundColor: 'transparent',
|
258
|
+
pointerEvents: 'none'
|
264
259
|
} }),
|
265
260
|
react_1.default.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON }))),
|
266
|
-
renderPoster)) : (react_1.default.createElement("div", { className: 'video-container', key: rec.video.itemId,
|
261
|
+
renderPoster)) : (react_1.default.createElement("div", { className: 'video-container', key: rec.video.itemId, style: {
|
267
262
|
position: 'relative',
|
268
263
|
width: '100%',
|
269
264
|
height,
|
270
265
|
overflow: 'hidden'
|
271
|
-
} },
|
272
|
-
react_1.default.createElement("video", { id: `pb-video-${index}`,
|
266
|
+
}, onClick: handleClickVideo() },
|
267
|
+
react_1.default.createElement("video", { id: `pb-video-${index}`, playsInline: true, crossOrigin: 'anonymous', style: {
|
268
|
+
backgroundColor: 'transparent',
|
269
|
+
width: '100%',
|
270
|
+
height: '100%',
|
271
|
+
objectFit: 'cover',
|
272
|
+
pointerEvents: 'none'
|
273
|
+
} }),
|
273
274
|
renderPoster,
|
274
275
|
react_1.default.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON })))));
|
275
276
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "pb-sxp-ui",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.33",
|
4
4
|
"description": "React enterprise-class UI components",
|
5
5
|
"main": "dist/index.cjs",
|
6
6
|
"module": "dist/index.js",
|
@@ -42,7 +42,6 @@
|
|
42
42
|
"antd": "^5.15.3",
|
43
43
|
"eslint": "^8.48.0",
|
44
44
|
"eventemitter3": "^5.0.1",
|
45
|
-
"hls.js": "^1.5.8",
|
46
45
|
"less": "^4.2.0",
|
47
46
|
"lodash": "^4.17.21",
|
48
47
|
"pako": "^2.1.0",
|