pb-sxp-ui 1.0.29 → 1.0.31
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 +20 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +20 -17
- 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 +23 -21
- 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 +20 -4
- package/lib/core/components/SxpPageRender/VideoWidget/index.js +20 -4
- package/package.json +2 -1
@@ -1,5 +1,6 @@
|
|
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';
|
3
4
|
import { useIconLink } from '../useIconLink';
|
4
5
|
import FormatImage from '../FormatImage';
|
5
6
|
import { useSxpDataSource } from '../../../../core/hooks';
|
@@ -140,7 +141,22 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
140
141
|
setIsPauseVideo(false);
|
141
142
|
if (!videoRef.current.src) {
|
142
143
|
const videoSrc = rec.video.url;
|
143
|
-
|
144
|
+
if (videoSrc.includes('.m3u8')) {
|
145
|
+
if (Hls.isSupported()) {
|
146
|
+
const hls = new Hls();
|
147
|
+
hls.loadSource(videoSrc);
|
148
|
+
hls.attachMedia(videoRef.current);
|
149
|
+
}
|
150
|
+
else if (videoRef.current.canPlayType('application/vnd.apple.mpegurl')) {
|
151
|
+
videoRef.current.src = videoSrc;
|
152
|
+
}
|
153
|
+
else {
|
154
|
+
videoRef.current.src = videoSrc;
|
155
|
+
}
|
156
|
+
}
|
157
|
+
else {
|
158
|
+
videoRef.current.src = videoSrc;
|
159
|
+
}
|
144
160
|
videoRef.current.setAttribute('x5-playsinline', 'true');
|
145
161
|
videoRef.current.setAttribute('webkit-playsinline', 'true');
|
146
162
|
}
|
@@ -231,16 +247,16 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
231
247
|
React.createElement("div", { style: {
|
232
248
|
position: 'absolute',
|
233
249
|
width: '100%',
|
234
|
-
height: '
|
250
|
+
height: '100%',
|
235
251
|
top: '50%',
|
236
252
|
transform: translateY,
|
237
253
|
left: 0,
|
238
254
|
right: 0
|
239
255
|
} },
|
240
|
-
React.createElement("div", { style: { position: 'relative' } },
|
256
|
+
React.createElement("div", { style: { position: 'relative', width: '100%', height: '100%' } },
|
241
257
|
React.createElement("video", { id: `pb-video-${index}`, className: 'clc-pb-video', ref: videoRef, crossOrigin: 'anonymous', muted: true, controls: false, playsInline: true, preload: 'auto', onPause: onPause, onEnded: handleVideoStart, style: {
|
242
258
|
width: '100%',
|
243
|
-
height: '
|
259
|
+
height: '100%',
|
244
260
|
objectFit: 'contain'
|
245
261
|
} }),
|
246
262
|
React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON }))),
|
@@ -3,6 +3,7 @@ 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"));
|
6
7
|
const useIconLink_1 = require("../useIconLink");
|
7
8
|
const FormatImage_1 = tslib_1.__importDefault(require("../FormatImage"));
|
8
9
|
const hooks_1 = require("../../../../core/hooks");
|
@@ -143,7 +144,22 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
143
144
|
setIsPauseVideo(false);
|
144
145
|
if (!videoRef.current.src) {
|
145
146
|
const videoSrc = rec.video.url;
|
146
|
-
|
147
|
+
if (videoSrc.includes('.m3u8')) {
|
148
|
+
if (hls_js_1.default.isSupported()) {
|
149
|
+
const hls = new hls_js_1.default();
|
150
|
+
hls.loadSource(videoSrc);
|
151
|
+
hls.attachMedia(videoRef.current);
|
152
|
+
}
|
153
|
+
else if (videoRef.current.canPlayType('application/vnd.apple.mpegurl')) {
|
154
|
+
videoRef.current.src = videoSrc;
|
155
|
+
}
|
156
|
+
else {
|
157
|
+
videoRef.current.src = videoSrc;
|
158
|
+
}
|
159
|
+
}
|
160
|
+
else {
|
161
|
+
videoRef.current.src = videoSrc;
|
162
|
+
}
|
147
163
|
videoRef.current.setAttribute('x5-playsinline', 'true');
|
148
164
|
videoRef.current.setAttribute('webkit-playsinline', 'true');
|
149
165
|
}
|
@@ -234,16 +250,16 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
234
250
|
react_1.default.createElement("div", { style: {
|
235
251
|
position: 'absolute',
|
236
252
|
width: '100%',
|
237
|
-
height: '
|
253
|
+
height: '100%',
|
238
254
|
top: '50%',
|
239
255
|
transform: translateY,
|
240
256
|
left: 0,
|
241
257
|
right: 0
|
242
258
|
} },
|
243
|
-
react_1.default.createElement("div", { style: { position: 'relative' } },
|
259
|
+
react_1.default.createElement("div", { style: { position: 'relative', width: '100%', height: '100%' } },
|
244
260
|
react_1.default.createElement("video", { id: `pb-video-${index}`, className: 'clc-pb-video', ref: videoRef, crossOrigin: 'anonymous', muted: true, controls: false, playsInline: true, preload: 'auto', onPause: onPause, onEnded: handleVideoStart, style: {
|
245
261
|
width: '100%',
|
246
|
-
height: '
|
262
|
+
height: '100%',
|
247
263
|
objectFit: 'contain'
|
248
264
|
} }),
|
249
265
|
react_1.default.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON }))),
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "pb-sxp-ui",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.31",
|
4
4
|
"description": "React enterprise-class UI components",
|
5
5
|
"main": "dist/index.cjs",
|
6
6
|
"module": "dist/index.js",
|
@@ -42,6 +42,7 @@
|
|
42
42
|
"antd": "^5.15.3",
|
43
43
|
"eslint": "^8.48.0",
|
44
44
|
"eventemitter3": "^5.0.1",
|
45
|
+
"hls.js": "^1.5.8",
|
45
46
|
"less": "^4.2.0",
|
46
47
|
"lodash": "^4.17.21",
|
47
48
|
"pako": "^2.1.0",
|