wargerm 0.4.11 → 0.4.14
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/components/VideoPlayer/index.d.ts +4 -3
- package/dist/components/VideoPlayer/xgplayer.d.ts +3 -2
- package/dist/index.css +34 -6
- package/dist/index.esm.css +34 -6
- package/dist/index.esm.js +169 -106
- package/dist/index.js +169 -106
- package/package.json +1 -1
@@ -1,12 +1,13 @@
|
|
1
|
-
|
1
|
+
import React from 'react';
|
2
2
|
declare type propsType = {
|
3
3
|
footer?: boolean;
|
4
4
|
style?: {
|
5
5
|
height: number | string;
|
6
6
|
width: number | string;
|
7
7
|
};
|
8
|
+
layoutIndex?: number;
|
8
9
|
config?: Object;
|
9
10
|
url?: string[];
|
10
11
|
};
|
11
|
-
|
12
|
-
export
|
12
|
+
declare const _default: React.ForwardRefExoticComponent<propsType & React.RefAttributes<unknown>>;
|
13
|
+
export default _default;
|
@@ -1,2 +1,3 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
import React from 'react';
|
2
|
+
declare const _default: React.ForwardRefExoticComponent<Pick<any, string | number | symbol> & React.RefAttributes<unknown>>;
|
3
|
+
export default _default;
|
package/dist/index.css
CHANGED
@@ -1372,11 +1372,13 @@ button[data-prefers-color='dark'] .swiper-pagination-bullet {
|
|
1372
1372
|
-ms-user-select: none;
|
1373
1373
|
user-select: none;
|
1374
1374
|
}
|
1375
|
-
[data-prefers-color='dark'] .row {
|
1376
|
-
height: calc(100% -30px);
|
1377
|
-
}
|
1378
1375
|
[data-prefers-color='dark'] .camera {
|
1379
1376
|
border: 1px solid #216fa3;
|
1377
|
+
width: 100%;
|
1378
|
+
height: 100%;
|
1379
|
+
}
|
1380
|
+
[data-prefers-color='dark'] .activeCamera {
|
1381
|
+
border: 1px solid red;
|
1380
1382
|
}
|
1381
1383
|
[data-prefers-color='dark'] .camera:hover {
|
1382
1384
|
border: 1px solid red;
|
@@ -1409,6 +1411,18 @@ button[data-prefers-color='dark'] .swiper-pagination-bullet {
|
|
1409
1411
|
[data-prefers-color='dark'] .btnbox:hover {
|
1410
1412
|
background: #0f6ab7;
|
1411
1413
|
}
|
1414
|
+
[data-prefers-color='dark'] .videoContainer {
|
1415
|
+
width: 100%;
|
1416
|
+
height: 100%;
|
1417
|
+
display: grid;
|
1418
|
+
grid-template-columns: 1fr;
|
1419
|
+
grid-template-rows: 1fr;
|
1420
|
+
grid-gap: 1px 1px;
|
1421
|
+
background: #0f6ab7;
|
1422
|
+
}
|
1423
|
+
[data-prefers-color='dark'] .xgplayer-skin-default {
|
1424
|
+
height: 100% !important;
|
1425
|
+
}
|
1412
1426
|
|
1413
1427
|
/* Color
|
1414
1428
|
----------------------- */
|
@@ -2744,11 +2758,13 @@ button[data-prefers-color='light'] .swiper-pagination-bullet {
|
|
2744
2758
|
-ms-user-select: none;
|
2745
2759
|
user-select: none;
|
2746
2760
|
}
|
2747
|
-
[data-prefers-color='light'] .row {
|
2748
|
-
height: calc(100% -30px);
|
2749
|
-
}
|
2750
2761
|
[data-prefers-color='light'] .camera {
|
2751
2762
|
border: 1px solid #216fa3;
|
2763
|
+
width: 100%;
|
2764
|
+
height: 100%;
|
2765
|
+
}
|
2766
|
+
[data-prefers-color='light'] .activeCamera {
|
2767
|
+
border: 1px solid red;
|
2752
2768
|
}
|
2753
2769
|
[data-prefers-color='light'] .camera:hover {
|
2754
2770
|
border: 1px solid red;
|
@@ -2781,6 +2797,18 @@ button[data-prefers-color='light'] .swiper-pagination-bullet {
|
|
2781
2797
|
[data-prefers-color='light'] .btnbox:hover {
|
2782
2798
|
background: #0f6ab7;
|
2783
2799
|
}
|
2800
|
+
[data-prefers-color='light'] .videoContainer {
|
2801
|
+
width: 100%;
|
2802
|
+
height: 100%;
|
2803
|
+
display: grid;
|
2804
|
+
grid-template-columns: 1fr;
|
2805
|
+
grid-template-rows: 1fr;
|
2806
|
+
grid-gap: 1px 1px;
|
2807
|
+
background: #0f6ab7;
|
2808
|
+
}
|
2809
|
+
[data-prefers-color='light'] .xgplayer-skin-default {
|
2810
|
+
height: 100% !important;
|
2811
|
+
}
|
2784
2812
|
|
2785
2813
|
.frame {
|
2786
2814
|
width: 40px;
|
package/dist/index.esm.css
CHANGED
@@ -1372,11 +1372,13 @@ button[data-prefers-color='dark'] .swiper-pagination-bullet {
|
|
1372
1372
|
-ms-user-select: none;
|
1373
1373
|
user-select: none;
|
1374
1374
|
}
|
1375
|
-
[data-prefers-color='dark'] .row {
|
1376
|
-
height: calc(100% -30px);
|
1377
|
-
}
|
1378
1375
|
[data-prefers-color='dark'] .camera {
|
1379
1376
|
border: 1px solid #216fa3;
|
1377
|
+
width: 100%;
|
1378
|
+
height: 100%;
|
1379
|
+
}
|
1380
|
+
[data-prefers-color='dark'] .activeCamera {
|
1381
|
+
border: 1px solid red;
|
1380
1382
|
}
|
1381
1383
|
[data-prefers-color='dark'] .camera:hover {
|
1382
1384
|
border: 1px solid red;
|
@@ -1409,6 +1411,18 @@ button[data-prefers-color='dark'] .swiper-pagination-bullet {
|
|
1409
1411
|
[data-prefers-color='dark'] .btnbox:hover {
|
1410
1412
|
background: #0f6ab7;
|
1411
1413
|
}
|
1414
|
+
[data-prefers-color='dark'] .videoContainer {
|
1415
|
+
width: 100%;
|
1416
|
+
height: 100%;
|
1417
|
+
display: grid;
|
1418
|
+
grid-template-columns: 1fr;
|
1419
|
+
grid-template-rows: 1fr;
|
1420
|
+
grid-gap: 1px 1px;
|
1421
|
+
background: #0f6ab7;
|
1422
|
+
}
|
1423
|
+
[data-prefers-color='dark'] .xgplayer-skin-default {
|
1424
|
+
height: 100% !important;
|
1425
|
+
}
|
1412
1426
|
|
1413
1427
|
/* Color
|
1414
1428
|
----------------------- */
|
@@ -2744,11 +2758,13 @@ button[data-prefers-color='light'] .swiper-pagination-bullet {
|
|
2744
2758
|
-ms-user-select: none;
|
2745
2759
|
user-select: none;
|
2746
2760
|
}
|
2747
|
-
[data-prefers-color='light'] .row {
|
2748
|
-
height: calc(100% -30px);
|
2749
|
-
}
|
2750
2761
|
[data-prefers-color='light'] .camera {
|
2751
2762
|
border: 1px solid #216fa3;
|
2763
|
+
width: 100%;
|
2764
|
+
height: 100%;
|
2765
|
+
}
|
2766
|
+
[data-prefers-color='light'] .activeCamera {
|
2767
|
+
border: 1px solid red;
|
2752
2768
|
}
|
2753
2769
|
[data-prefers-color='light'] .camera:hover {
|
2754
2770
|
border: 1px solid red;
|
@@ -2781,6 +2797,18 @@ button[data-prefers-color='light'] .swiper-pagination-bullet {
|
|
2781
2797
|
[data-prefers-color='light'] .btnbox:hover {
|
2782
2798
|
background: #0f6ab7;
|
2783
2799
|
}
|
2800
|
+
[data-prefers-color='light'] .videoContainer {
|
2801
|
+
width: 100%;
|
2802
|
+
height: 100%;
|
2803
|
+
display: grid;
|
2804
|
+
grid-template-columns: 1fr;
|
2805
|
+
grid-template-rows: 1fr;
|
2806
|
+
grid-gap: 1px 1px;
|
2807
|
+
background: #0f6ab7;
|
2808
|
+
}
|
2809
|
+
[data-prefers-color='light'] .xgplayer-skin-default {
|
2810
|
+
height: 100% !important;
|
2811
|
+
}
|
2784
2812
|
|
2785
2813
|
.frame {
|
2786
2814
|
width: 40px;
|
package/dist/index.esm.js
CHANGED
@@ -8535,7 +8535,7 @@ Table.defaultProps = {
|
|
8535
8535
|
var _excluded$8 = ["height", "width", "count", "style", "numberStyle"],
|
8536
8536
|
_excluded2$2 = ["count", "numberCount", "width", "height", "marginRight"];
|
8537
8537
|
|
8538
|
-
var Number
|
8538
|
+
var Number = function Number(_ref) {
|
8539
8539
|
var height = _ref.height,
|
8540
8540
|
width = _ref.width,
|
8541
8541
|
_ref$count = _ref.count,
|
@@ -8657,7 +8657,7 @@ var Number$1 = function Number(_ref) {
|
|
8657
8657
|
})))));
|
8658
8658
|
};
|
8659
8659
|
|
8660
|
-
Number
|
8660
|
+
Number.defaultProps = {
|
8661
8661
|
width: 28,
|
8662
8662
|
height: 40
|
8663
8663
|
};
|
@@ -8694,7 +8694,7 @@ var Index$7 = function Index(props) {
|
|
8694
8694
|
display: 'flex'
|
8695
8695
|
}
|
8696
8696
|
}, numberList.map(function (res, index) {
|
8697
|
-
return /*#__PURE__*/React.createElement(Number
|
8697
|
+
return /*#__PURE__*/React.createElement(Number, _objectSpread2({
|
8698
8698
|
key: index,
|
8699
8699
|
width: width,
|
8700
8700
|
height: height,
|
@@ -10980,54 +10980,71 @@ var WebsocketHeart = /*#__PURE__*/_createClass(function WebsocketHeart(_ref) {
|
|
10980
10980
|
this.heartCheck = null;
|
10981
10981
|
});
|
10982
10982
|
|
10983
|
-
|
10984
|
-
function Xgplay(_ref) {
|
10983
|
+
function Xgplay(_ref, fRef) {
|
10985
10984
|
var config = _ref.config,
|
10986
|
-
type = _ref.type
|
10985
|
+
type = _ref.type,
|
10986
|
+
setRef = _ref.setRef;
|
10987
10987
|
var ref = useRef(null);
|
10988
|
+
var playerRef = useRef(null);
|
10989
|
+
|
10990
|
+
var _useState = useState(null),
|
10991
|
+
_useState2 = _slicedToArray(_useState, 2),
|
10992
|
+
player = _useState2[0],
|
10993
|
+
setPlayer = _useState2[1];
|
10994
|
+
|
10988
10995
|
useEffect(function () {
|
10989
|
-
|
10990
|
-
|
10991
|
-
|
10992
|
-
|
10993
|
-
|
10994
|
-
|
10995
|
-
|
10996
|
-
|
10997
|
-
|
10998
|
-
|
10999
|
-
|
11000
|
-
|
11001
|
-
|
11002
|
-
|
11003
|
-
|
11004
|
-
|
11005
|
-
|
11006
|
-
|
11007
|
-
|
11008
|
-
|
11009
|
-
|
11010
|
-
|
11011
|
-
|
11012
|
-
|
11013
|
-
|
11014
|
-
|
11015
|
-
|
11016
|
-
|
11017
|
-
|
11018
|
-
el: ref.current,
|
11019
|
-
width: '100%',
|
11020
|
-
height: '100%',
|
11021
|
-
autoplay: true,
|
11022
|
-
isLive: true,
|
11023
|
-
autoplayMuted: true
|
11024
|
-
}, config));
|
10996
|
+
if (ref.current) {
|
10997
|
+
if (type.indexOf('hls') !== -1) {
|
10998
|
+
playerRef.current = new HlsJsPlayer(_objectSpread2({
|
10999
|
+
el: ref.current,
|
11000
|
+
width: '100%',
|
11001
|
+
height: '100%',
|
11002
|
+
autoplay: true,
|
11003
|
+
isLive: true,
|
11004
|
+
autoplayMuted: true
|
11005
|
+
}, config));
|
11006
|
+
} else if (type.indexOf('flv') !== -1) {
|
11007
|
+
playerRef.current = new FlvPlayer(_objectSpread2({
|
11008
|
+
el: ref.current,
|
11009
|
+
width: '100%',
|
11010
|
+
height: '100%',
|
11011
|
+
autoplay: true,
|
11012
|
+
isLive: true,
|
11013
|
+
autoplayMuted: true
|
11014
|
+
}, config));
|
11015
|
+
} else if (type.indexOf('mp4') !== -1) {
|
11016
|
+
playerRef.current = new Player(_objectSpread2({
|
11017
|
+
el: ref.current,
|
11018
|
+
width: '100%',
|
11019
|
+
height: '100%',
|
11020
|
+
autoplay: true,
|
11021
|
+
isLive: true,
|
11022
|
+
autoplayMuted: true
|
11023
|
+
}, config));
|
11024
|
+
}
|
11025
11025
|
}
|
11026
11026
|
|
11027
11027
|
return function () {
|
11028
|
-
|
11028
|
+
playerRef.current = null;
|
11029
11029
|
};
|
11030
11030
|
}, []);
|
11031
|
+
useEffect(function () {
|
11032
|
+
if (playerRef.current) {
|
11033
|
+
setRef(playerRef.current);
|
11034
|
+
}
|
11035
|
+
|
11036
|
+
return function () {
|
11037
|
+
var _playerRef$current, _playerRef$current$pl;
|
11038
|
+
|
11039
|
+
(_playerRef$current = playerRef.current) === null || _playerRef$current === void 0 ? void 0 : (_playerRef$current$pl = _playerRef$current.player) === null || _playerRef$current$pl === void 0 ? void 0 : _playerRef$current$pl.destroy(true);
|
11040
|
+
setRef(null);
|
11041
|
+
};
|
11042
|
+
});
|
11043
|
+
useImperativeHandle(fRef, function () {
|
11044
|
+
return {
|
11045
|
+
player: playerRef.current
|
11046
|
+
};
|
11047
|
+
});
|
11031
11048
|
return /*#__PURE__*/React.createElement("div", {
|
11032
11049
|
ref: ref,
|
11033
11050
|
style: {
|
@@ -11036,6 +11053,8 @@ function Xgplay(_ref) {
|
|
11036
11053
|
});
|
11037
11054
|
}
|
11038
11055
|
|
11056
|
+
var Xgplay$1 = /*#__PURE__*/forwardRef(Xgplay);
|
11057
|
+
|
11039
11058
|
/*
|
11040
11059
|
* @Author: lijin
|
11041
11060
|
* @Date: 2021-08-04 16:24:47
|
@@ -11055,7 +11074,7 @@ var IconFont = createFromIconfontCN({
|
|
11055
11074
|
scriptUrl: '//at.alicdn.com/t/font_3425259_s93peuz62an.js'
|
11056
11075
|
});
|
11057
11076
|
|
11058
|
-
function VideoPlayer(_ref) {
|
11077
|
+
function VideoPlayer(_ref, ref) {
|
11059
11078
|
var _ref$footer = _ref.footer,
|
11060
11079
|
footer = _ref$footer === void 0 ? true : _ref$footer,
|
11061
11080
|
_ref$style = _ref.style,
|
@@ -11065,36 +11084,82 @@ function VideoPlayer(_ref) {
|
|
11065
11084
|
} : _ref$style,
|
11066
11085
|
_ref$config = _ref.config,
|
11067
11086
|
config = _ref$config === void 0 ? {} : _ref$config,
|
11087
|
+
layoutIndex = _ref.layoutIndex,
|
11068
11088
|
_ref$url = _ref.url,
|
11069
11089
|
url = _ref$url === void 0 ? [] : _ref$url;
|
11090
|
+
var layouts = [{
|
11091
|
+
title: '1x1布局',
|
11092
|
+
style: {
|
11093
|
+
gridTemplateColumns: '1fr',
|
11094
|
+
gridTemplateRows: '1fr'
|
11095
|
+
},
|
11096
|
+
icon: /*#__PURE__*/React.createElement(IconFont, {
|
11097
|
+
type: "icon-dantupailie"
|
11098
|
+
}),
|
11099
|
+
span: 1
|
11100
|
+
}, {
|
11101
|
+
title: '2x2布局',
|
11102
|
+
style: {
|
11103
|
+
gridTemplateColumns: '1fr 1fr',
|
11104
|
+
gridTemplateRows: '1fr 1fr'
|
11105
|
+
},
|
11106
|
+
icon: /*#__PURE__*/React.createElement(IconFont, {
|
11107
|
+
type: "icon-split-screen-compare-full"
|
11108
|
+
}),
|
11109
|
+
span: 4
|
11110
|
+
}, {
|
11111
|
+
title: '3x3布局',
|
11112
|
+
style: {
|
11113
|
+
gridTemplateColumns: '1fr 1fr 1fr',
|
11114
|
+
gridTemplateRows: '1fr 1fr 1fr'
|
11115
|
+
},
|
11116
|
+
icon: /*#__PURE__*/React.createElement(IconFont, {
|
11117
|
+
type: "icon-all-full",
|
11118
|
+
className: "f21"
|
11119
|
+
}),
|
11120
|
+
span: 9
|
11121
|
+
}];
|
11070
11122
|
|
11071
|
-
var _useState = useState(
|
11123
|
+
var _useState = useState(layoutIndex || 0),
|
11072
11124
|
_useState2 = _slicedToArray(_useState, 2),
|
11073
|
-
|
11074
|
-
|
11125
|
+
currentLayoutIndex = _useState2[0],
|
11126
|
+
setCurrentLayoutIndex = _useState2[1];
|
11075
11127
|
|
11076
|
-
var
|
11128
|
+
var initPlayerIndex = layouts[layoutIndex || 0].span >= url.length ? url.length - 1 >= 0 ? url.length - 1 : 0 : layouts[layoutIndex || 0].span - 1;
|
11129
|
+
|
11130
|
+
var _useState3 = useState(initPlayerIndex),
|
11077
11131
|
_useState4 = _slicedToArray(_useState3, 2),
|
11078
|
-
|
11079
|
-
|
11132
|
+
currentPlayerIndex = _useState4[0],
|
11133
|
+
setCurrentPlayerIndex = _useState4[1];
|
11080
11134
|
|
11081
11135
|
var domRef = useRef(null);
|
11082
|
-
var
|
11136
|
+
var playerRef = useRef({});
|
11083
11137
|
|
11084
|
-
var
|
11085
|
-
|
11086
|
-
|
11087
|
-
|
11088
|
-
|
11138
|
+
var _useState5 = useState([]),
|
11139
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
11140
|
+
players = _useState6[0],
|
11141
|
+
setPlayers = _useState6[1];
|
11142
|
+
|
11143
|
+
var renderDom = useMemo(function () {
|
11144
|
+
var arr = new Array(layouts[currentLayoutIndex].span).fill(0);
|
11145
|
+
return arr.map(function (item, index) {
|
11146
|
+
return /*#__PURE__*/React.createElement("div", {
|
11089
11147
|
key: index,
|
11090
|
-
className: "camera",
|
11091
|
-
|
11092
|
-
|
11093
|
-
}
|
11094
|
-
}, url[index] ? /*#__PURE__*/React.createElement(Xgplay, {
|
11148
|
+
className: "camera ".concat(currentPlayerIndex == index ? 'activeCamera' : ''),
|
11149
|
+
onClickCapture: function onClickCapture() {
|
11150
|
+
setCurrentPlayerIndex(index);
|
11151
|
+
}
|
11152
|
+
}, url[index] ? /*#__PURE__*/React.createElement(Xgplay$1, {
|
11153
|
+
setRef: function setRef(ref) {
|
11154
|
+
return setPlayers(function (players) {
|
11155
|
+
players[index] = ref;
|
11156
|
+
return players;
|
11157
|
+
});
|
11158
|
+
},
|
11095
11159
|
type: url[index],
|
11096
11160
|
config: _objectSpread2({
|
11097
|
-
url: url[index]
|
11161
|
+
url: url[index],
|
11162
|
+
fluid: true
|
11098
11163
|
}, config)
|
11099
11164
|
}) : /*#__PURE__*/React.createElement("div", {
|
11100
11165
|
className: "empty",
|
@@ -11106,7 +11171,7 @@ function VideoPlayer(_ref) {
|
|
11106
11171
|
}
|
11107
11172
|
}));
|
11108
11173
|
});
|
11109
|
-
};
|
11174
|
+
}, [currentLayoutIndex, currentPlayerIndex, playerRef, url]);
|
11110
11175
|
|
11111
11176
|
function exitFullscreen() {
|
11112
11177
|
if (document.exitFullscreen) {
|
@@ -11129,50 +11194,48 @@ function VideoPlayer(_ref) {
|
|
11129
11194
|
}
|
11130
11195
|
}
|
11131
11196
|
|
11197
|
+
var loadCamera = function loadCamera(url) {
|
11198
|
+
var currentPlayer = players[currentPlayerIndex];
|
11199
|
+
|
11200
|
+
if (currentPlayer) {
|
11201
|
+
console.log(currentPlayer, 'currentPlayer');
|
11202
|
+
currentPlayer.src = url; // debugger
|
11203
|
+
// currentPlayer.start(url)
|
11204
|
+
}
|
11205
|
+
};
|
11206
|
+
|
11207
|
+
useImperativeHandle(ref, function () {
|
11208
|
+
return {
|
11209
|
+
players: players,
|
11210
|
+
currentLayoutIndex: currentLayoutIndex,
|
11211
|
+
currentPlayerIndex: currentPlayerIndex,
|
11212
|
+
loadCamera: loadCamera
|
11213
|
+
};
|
11214
|
+
});
|
11132
11215
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
11133
|
-
style: style
|
11134
|
-
ref: contentRef
|
11135
|
-
}, /*#__PURE__*/React.createElement(_Row, {
|
11136
|
-
ref: domRef
|
11137
|
-
}, renderDom()), footer ? /*#__PURE__*/React.createElement("div", {
|
11138
|
-
className: "tools"
|
11216
|
+
style: style
|
11139
11217
|
}, /*#__PURE__*/React.createElement("div", {
|
11140
|
-
|
11141
|
-
|
11142
|
-
|
11143
|
-
|
11144
|
-
|
11145
|
-
},
|
11146
|
-
|
11147
|
-
|
11148
|
-
|
11149
|
-
|
11150
|
-
|
11151
|
-
|
11152
|
-
|
11153
|
-
|
11154
|
-
|
11155
|
-
|
11156
|
-
|
11157
|
-
|
11158
|
-
|
11159
|
-
}, /*#__PURE__*/React.createElement(IconFont, {
|
11160
|
-
type: "icon-split-screen-compare-full"
|
11161
|
-
}))), /*#__PURE__*/React.createElement("div", {
|
11162
|
-
className: "btnbox",
|
11163
|
-
onClick: function onClick() {
|
11164
|
-
setColNumber(3);
|
11165
|
-
setColCountKey(3);
|
11166
|
-
}
|
11167
|
-
}, /*#__PURE__*/React.createElement(_Tooltip, {
|
11168
|
-
placement: "top",
|
11169
|
-
title: '3x3布局'
|
11170
|
-
}, /*#__PURE__*/React.createElement(IconFont, {
|
11171
|
-
type: "icon-all-full",
|
11172
|
-
style: {
|
11173
|
-
fontSize: 21
|
11174
|
-
}
|
11175
|
-
})))) : null));
|
11218
|
+
ref: domRef,
|
11219
|
+
className: "videoContainer",
|
11220
|
+
style: layouts[currentLayoutIndex].style
|
11221
|
+
}, renderDom), footer ? /*#__PURE__*/React.createElement("div", {
|
11222
|
+
className: "tools"
|
11223
|
+
}, layouts.map(function (item, index) {
|
11224
|
+
return /*#__PURE__*/React.createElement("div", {
|
11225
|
+
key: index,
|
11226
|
+
className: "btnbox",
|
11227
|
+
onClick: function onClick() {
|
11228
|
+
var playerIndex = layouts[index || 0].span > url.length ? url.length - 1 >= 0 ? url.length : 0 : layouts[index || 0].span - 1;
|
11229
|
+
setCurrentPlayerIndex(playerIndex);
|
11230
|
+
setCurrentLayoutIndex(index);
|
11231
|
+
}
|
11232
|
+
}, /*#__PURE__*/React.createElement(_Tooltip, {
|
11233
|
+
placement: "top",
|
11234
|
+
title: item.title
|
11235
|
+
}, item.icon));
|
11236
|
+
})) : null));
|
11176
11237
|
}
|
11177
11238
|
|
11178
|
-
|
11239
|
+
var index$3 = /*#__PURE__*/forwardRef(VideoPlayer);
|
11240
|
+
|
11241
|
+
export { Index$9 as AutoScroll, Index$b as Breadcrumb, WButton as Button, index$1 as Card, WCascader as Cascader, Index$3 as Checkbox, Index$8 as CountUp, Index$1 as DatePicker, index as IconFont, Index as Input, WInputNumber as InputNumber, Modal, ModalForm$1 as ModalForm, Modal$1 as ModalTips, Index$7 as Number, NumericInput, Index$2 as Radio, Select, Index$a as Swiper, WSwitch as Switch, index$2 as TabelCard, Table, Index$6 as TreeSelect, index$3 as VideoPlayer, Index$5 as WDatePicker, WForm$1 as WForm, WebsocketHeart };
|
package/dist/index.js
CHANGED
@@ -8573,7 +8573,7 @@ Table.defaultProps = {
|
|
8573
8573
|
var _excluded$8 = ["height", "width", "count", "style", "numberStyle"],
|
8574
8574
|
_excluded2$2 = ["count", "numberCount", "width", "height", "marginRight"];
|
8575
8575
|
|
8576
|
-
var Number
|
8576
|
+
var Number = function Number(_ref) {
|
8577
8577
|
var height = _ref.height,
|
8578
8578
|
width = _ref.width,
|
8579
8579
|
_ref$count = _ref.count,
|
@@ -8695,7 +8695,7 @@ var Number$1 = function Number(_ref) {
|
|
8695
8695
|
})))));
|
8696
8696
|
};
|
8697
8697
|
|
8698
|
-
Number
|
8698
|
+
Number.defaultProps = {
|
8699
8699
|
width: 28,
|
8700
8700
|
height: 40
|
8701
8701
|
};
|
@@ -8732,7 +8732,7 @@ var Index$7 = function Index(props) {
|
|
8732
8732
|
display: 'flex'
|
8733
8733
|
}
|
8734
8734
|
}, numberList.map(function (res, index) {
|
8735
|
-
return /*#__PURE__*/React__default['default'].createElement(Number
|
8735
|
+
return /*#__PURE__*/React__default['default'].createElement(Number, _objectSpread2({
|
8736
8736
|
key: index,
|
8737
8737
|
width: width,
|
8738
8738
|
height: height,
|
@@ -11018,54 +11018,71 @@ var WebsocketHeart = /*#__PURE__*/_createClass(function WebsocketHeart(_ref) {
|
|
11018
11018
|
this.heartCheck = null;
|
11019
11019
|
});
|
11020
11020
|
|
11021
|
-
|
11022
|
-
function Xgplay(_ref) {
|
11021
|
+
function Xgplay(_ref, fRef) {
|
11023
11022
|
var config = _ref.config,
|
11024
|
-
type = _ref.type
|
11023
|
+
type = _ref.type,
|
11024
|
+
setRef = _ref.setRef;
|
11025
11025
|
var ref = React.useRef(null);
|
11026
|
+
var playerRef = React.useRef(null);
|
11027
|
+
|
11028
|
+
var _useState = React.useState(null),
|
11029
|
+
_useState2 = _slicedToArray(_useState, 2),
|
11030
|
+
player = _useState2[0],
|
11031
|
+
setPlayer = _useState2[1];
|
11032
|
+
|
11026
11033
|
React.useEffect(function () {
|
11027
|
-
|
11028
|
-
|
11029
|
-
|
11030
|
-
|
11031
|
-
|
11032
|
-
|
11033
|
-
|
11034
|
-
|
11035
|
-
|
11036
|
-
|
11037
|
-
|
11038
|
-
|
11039
|
-
|
11040
|
-
|
11041
|
-
|
11042
|
-
|
11043
|
-
|
11044
|
-
|
11045
|
-
|
11046
|
-
|
11047
|
-
|
11048
|
-
|
11049
|
-
|
11050
|
-
|
11051
|
-
|
11052
|
-
|
11053
|
-
|
11054
|
-
|
11055
|
-
|
11056
|
-
el: ref.current,
|
11057
|
-
width: '100%',
|
11058
|
-
height: '100%',
|
11059
|
-
autoplay: true,
|
11060
|
-
isLive: true,
|
11061
|
-
autoplayMuted: true
|
11062
|
-
}, config));
|
11034
|
+
if (ref.current) {
|
11035
|
+
if (type.indexOf('hls') !== -1) {
|
11036
|
+
playerRef.current = new HlsJsPlayer__default['default'](_objectSpread2({
|
11037
|
+
el: ref.current,
|
11038
|
+
width: '100%',
|
11039
|
+
height: '100%',
|
11040
|
+
autoplay: true,
|
11041
|
+
isLive: true,
|
11042
|
+
autoplayMuted: true
|
11043
|
+
}, config));
|
11044
|
+
} else if (type.indexOf('flv') !== -1) {
|
11045
|
+
playerRef.current = new FlvPlayer__default['default'](_objectSpread2({
|
11046
|
+
el: ref.current,
|
11047
|
+
width: '100%',
|
11048
|
+
height: '100%',
|
11049
|
+
autoplay: true,
|
11050
|
+
isLive: true,
|
11051
|
+
autoplayMuted: true
|
11052
|
+
}, config));
|
11053
|
+
} else if (type.indexOf('mp4') !== -1) {
|
11054
|
+
playerRef.current = new Player__default['default'](_objectSpread2({
|
11055
|
+
el: ref.current,
|
11056
|
+
width: '100%',
|
11057
|
+
height: '100%',
|
11058
|
+
autoplay: true,
|
11059
|
+
isLive: true,
|
11060
|
+
autoplayMuted: true
|
11061
|
+
}, config));
|
11062
|
+
}
|
11063
11063
|
}
|
11064
11064
|
|
11065
11065
|
return function () {
|
11066
|
-
|
11066
|
+
playerRef.current = null;
|
11067
11067
|
};
|
11068
11068
|
}, []);
|
11069
|
+
React.useEffect(function () {
|
11070
|
+
if (playerRef.current) {
|
11071
|
+
setRef(playerRef.current);
|
11072
|
+
}
|
11073
|
+
|
11074
|
+
return function () {
|
11075
|
+
var _playerRef$current, _playerRef$current$pl;
|
11076
|
+
|
11077
|
+
(_playerRef$current = playerRef.current) === null || _playerRef$current === void 0 ? void 0 : (_playerRef$current$pl = _playerRef$current.player) === null || _playerRef$current$pl === void 0 ? void 0 : _playerRef$current$pl.destroy(true);
|
11078
|
+
setRef(null);
|
11079
|
+
};
|
11080
|
+
});
|
11081
|
+
React.useImperativeHandle(fRef, function () {
|
11082
|
+
return {
|
11083
|
+
player: playerRef.current
|
11084
|
+
};
|
11085
|
+
});
|
11069
11086
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
11070
11087
|
ref: ref,
|
11071
11088
|
style: {
|
@@ -11074,6 +11091,8 @@ function Xgplay(_ref) {
|
|
11074
11091
|
});
|
11075
11092
|
}
|
11076
11093
|
|
11094
|
+
var Xgplay$1 = /*#__PURE__*/React.forwardRef(Xgplay);
|
11095
|
+
|
11077
11096
|
/*
|
11078
11097
|
* @Author: lijin
|
11079
11098
|
* @Date: 2021-08-04 16:24:47
|
@@ -11093,7 +11112,7 @@ var IconFont = icons.createFromIconfontCN({
|
|
11093
11112
|
scriptUrl: '//at.alicdn.com/t/font_3425259_s93peuz62an.js'
|
11094
11113
|
});
|
11095
11114
|
|
11096
|
-
function VideoPlayer(_ref) {
|
11115
|
+
function VideoPlayer(_ref, ref) {
|
11097
11116
|
var _ref$footer = _ref.footer,
|
11098
11117
|
footer = _ref$footer === void 0 ? true : _ref$footer,
|
11099
11118
|
_ref$style = _ref.style,
|
@@ -11103,36 +11122,82 @@ function VideoPlayer(_ref) {
|
|
11103
11122
|
} : _ref$style,
|
11104
11123
|
_ref$config = _ref.config,
|
11105
11124
|
config = _ref$config === void 0 ? {} : _ref$config,
|
11125
|
+
layoutIndex = _ref.layoutIndex,
|
11106
11126
|
_ref$url = _ref.url,
|
11107
11127
|
url = _ref$url === void 0 ? [] : _ref$url;
|
11128
|
+
var layouts = [{
|
11129
|
+
title: '1x1布局',
|
11130
|
+
style: {
|
11131
|
+
gridTemplateColumns: '1fr',
|
11132
|
+
gridTemplateRows: '1fr'
|
11133
|
+
},
|
11134
|
+
icon: /*#__PURE__*/React__default['default'].createElement(IconFont, {
|
11135
|
+
type: "icon-dantupailie"
|
11136
|
+
}),
|
11137
|
+
span: 1
|
11138
|
+
}, {
|
11139
|
+
title: '2x2布局',
|
11140
|
+
style: {
|
11141
|
+
gridTemplateColumns: '1fr 1fr',
|
11142
|
+
gridTemplateRows: '1fr 1fr'
|
11143
|
+
},
|
11144
|
+
icon: /*#__PURE__*/React__default['default'].createElement(IconFont, {
|
11145
|
+
type: "icon-split-screen-compare-full"
|
11146
|
+
}),
|
11147
|
+
span: 4
|
11148
|
+
}, {
|
11149
|
+
title: '3x3布局',
|
11150
|
+
style: {
|
11151
|
+
gridTemplateColumns: '1fr 1fr 1fr',
|
11152
|
+
gridTemplateRows: '1fr 1fr 1fr'
|
11153
|
+
},
|
11154
|
+
icon: /*#__PURE__*/React__default['default'].createElement(IconFont, {
|
11155
|
+
type: "icon-all-full",
|
11156
|
+
className: "f21"
|
11157
|
+
}),
|
11158
|
+
span: 9
|
11159
|
+
}];
|
11108
11160
|
|
11109
|
-
var _useState = React.useState(
|
11161
|
+
var _useState = React.useState(layoutIndex || 0),
|
11110
11162
|
_useState2 = _slicedToArray(_useState, 2),
|
11111
|
-
|
11112
|
-
|
11163
|
+
currentLayoutIndex = _useState2[0],
|
11164
|
+
setCurrentLayoutIndex = _useState2[1];
|
11113
11165
|
|
11114
|
-
var
|
11166
|
+
var initPlayerIndex = layouts[layoutIndex || 0].span >= url.length ? url.length - 1 >= 0 ? url.length - 1 : 0 : layouts[layoutIndex || 0].span - 1;
|
11167
|
+
|
11168
|
+
var _useState3 = React.useState(initPlayerIndex),
|
11115
11169
|
_useState4 = _slicedToArray(_useState3, 2),
|
11116
|
-
|
11117
|
-
|
11170
|
+
currentPlayerIndex = _useState4[0],
|
11171
|
+
setCurrentPlayerIndex = _useState4[1];
|
11118
11172
|
|
11119
11173
|
var domRef = React.useRef(null);
|
11120
|
-
var
|
11174
|
+
var playerRef = React.useRef({});
|
11121
11175
|
|
11122
|
-
var
|
11123
|
-
|
11124
|
-
|
11125
|
-
|
11126
|
-
|
11176
|
+
var _useState5 = React.useState([]),
|
11177
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
11178
|
+
players = _useState6[0],
|
11179
|
+
setPlayers = _useState6[1];
|
11180
|
+
|
11181
|
+
var renderDom = React.useMemo(function () {
|
11182
|
+
var arr = new Array(layouts[currentLayoutIndex].span).fill(0);
|
11183
|
+
return arr.map(function (item, index) {
|
11184
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
11127
11185
|
key: index,
|
11128
|
-
className: "camera",
|
11129
|
-
|
11130
|
-
|
11131
|
-
}
|
11132
|
-
}, url[index] ? /*#__PURE__*/React__default['default'].createElement(Xgplay, {
|
11186
|
+
className: "camera ".concat(currentPlayerIndex == index ? 'activeCamera' : ''),
|
11187
|
+
onClickCapture: function onClickCapture() {
|
11188
|
+
setCurrentPlayerIndex(index);
|
11189
|
+
}
|
11190
|
+
}, url[index] ? /*#__PURE__*/React__default['default'].createElement(Xgplay$1, {
|
11191
|
+
setRef: function setRef(ref) {
|
11192
|
+
return setPlayers(function (players) {
|
11193
|
+
players[index] = ref;
|
11194
|
+
return players;
|
11195
|
+
});
|
11196
|
+
},
|
11133
11197
|
type: url[index],
|
11134
11198
|
config: _objectSpread2({
|
11135
|
-
url: url[index]
|
11199
|
+
url: url[index],
|
11200
|
+
fluid: true
|
11136
11201
|
}, config)
|
11137
11202
|
}) : /*#__PURE__*/React__default['default'].createElement("div", {
|
11138
11203
|
className: "empty",
|
@@ -11144,7 +11209,7 @@ function VideoPlayer(_ref) {
|
|
11144
11209
|
}
|
11145
11210
|
}));
|
11146
11211
|
});
|
11147
|
-
};
|
11212
|
+
}, [currentLayoutIndex, currentPlayerIndex, playerRef, url]);
|
11148
11213
|
|
11149
11214
|
function exitFullscreen() {
|
11150
11215
|
if (document.exitFullscreen) {
|
@@ -11167,52 +11232,50 @@ function VideoPlayer(_ref) {
|
|
11167
11232
|
}
|
11168
11233
|
}
|
11169
11234
|
|
11235
|
+
var loadCamera = function loadCamera(url) {
|
11236
|
+
var currentPlayer = players[currentPlayerIndex];
|
11237
|
+
|
11238
|
+
if (currentPlayer) {
|
11239
|
+
console.log(currentPlayer, 'currentPlayer');
|
11240
|
+
currentPlayer.src = url; // debugger
|
11241
|
+
// currentPlayer.start(url)
|
11242
|
+
}
|
11243
|
+
};
|
11244
|
+
|
11245
|
+
React.useImperativeHandle(ref, function () {
|
11246
|
+
return {
|
11247
|
+
players: players,
|
11248
|
+
currentLayoutIndex: currentLayoutIndex,
|
11249
|
+
currentPlayerIndex: currentPlayerIndex,
|
11250
|
+
loadCamera: loadCamera
|
11251
|
+
};
|
11252
|
+
});
|
11170
11253
|
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("div", {
|
11171
|
-
style: style
|
11172
|
-
ref: contentRef
|
11173
|
-
}, /*#__PURE__*/React__default['default'].createElement(_Row__default['default'], {
|
11174
|
-
ref: domRef
|
11175
|
-
}, renderDom()), footer ? /*#__PURE__*/React__default['default'].createElement("div", {
|
11176
|
-
className: "tools"
|
11254
|
+
style: style
|
11177
11255
|
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
11178
|
-
|
11179
|
-
|
11180
|
-
|
11181
|
-
|
11182
|
-
|
11183
|
-
},
|
11184
|
-
|
11185
|
-
|
11186
|
-
|
11187
|
-
|
11188
|
-
|
11189
|
-
|
11190
|
-
|
11191
|
-
|
11192
|
-
|
11193
|
-
|
11194
|
-
|
11195
|
-
|
11196
|
-
|
11197
|
-
}, /*#__PURE__*/React__default['default'].createElement(IconFont, {
|
11198
|
-
type: "icon-split-screen-compare-full"
|
11199
|
-
}))), /*#__PURE__*/React__default['default'].createElement("div", {
|
11200
|
-
className: "btnbox",
|
11201
|
-
onClick: function onClick() {
|
11202
|
-
setColNumber(3);
|
11203
|
-
setColCountKey(3);
|
11204
|
-
}
|
11205
|
-
}, /*#__PURE__*/React__default['default'].createElement(_Tooltip__default['default'], {
|
11206
|
-
placement: "top",
|
11207
|
-
title: '3x3布局'
|
11208
|
-
}, /*#__PURE__*/React__default['default'].createElement(IconFont, {
|
11209
|
-
type: "icon-all-full",
|
11210
|
-
style: {
|
11211
|
-
fontSize: 21
|
11212
|
-
}
|
11213
|
-
})))) : null));
|
11256
|
+
ref: domRef,
|
11257
|
+
className: "videoContainer",
|
11258
|
+
style: layouts[currentLayoutIndex].style
|
11259
|
+
}, renderDom), footer ? /*#__PURE__*/React__default['default'].createElement("div", {
|
11260
|
+
className: "tools"
|
11261
|
+
}, layouts.map(function (item, index) {
|
11262
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
11263
|
+
key: index,
|
11264
|
+
className: "btnbox",
|
11265
|
+
onClick: function onClick() {
|
11266
|
+
var playerIndex = layouts[index || 0].span > url.length ? url.length - 1 >= 0 ? url.length : 0 : layouts[index || 0].span - 1;
|
11267
|
+
setCurrentPlayerIndex(playerIndex);
|
11268
|
+
setCurrentLayoutIndex(index);
|
11269
|
+
}
|
11270
|
+
}, /*#__PURE__*/React__default['default'].createElement(_Tooltip__default['default'], {
|
11271
|
+
placement: "top",
|
11272
|
+
title: item.title
|
11273
|
+
}, item.icon));
|
11274
|
+
})) : null));
|
11214
11275
|
}
|
11215
11276
|
|
11277
|
+
var index$3 = /*#__PURE__*/React.forwardRef(VideoPlayer);
|
11278
|
+
|
11216
11279
|
exports.AutoScroll = Index$9;
|
11217
11280
|
exports.Breadcrumb = Index$b;
|
11218
11281
|
exports.Button = WButton;
|
@@ -11236,7 +11299,7 @@ exports.Switch = WSwitch;
|
|
11236
11299
|
exports.TabelCard = index$2;
|
11237
11300
|
exports.Table = Table;
|
11238
11301
|
exports.TreeSelect = Index$6;
|
11239
|
-
exports.VideoPlayer =
|
11302
|
+
exports.VideoPlayer = index$3;
|
11240
11303
|
exports.WDatePicker = Index$5;
|
11241
11304
|
exports.WForm = WForm$1;
|
11242
11305
|
exports.WebsocketHeart = WebsocketHeart;
|