wargerm 0.4.12 → 0.4.13

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.
@@ -1,12 +1,13 @@
1
- /// <reference types="react" />
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
- export default function VideoPlayer({ footer, style, config, url, }: propsType): JSX.Element;
12
- export {};
12
+ declare const _default: React.ForwardRefExoticComponent<propsType & React.RefAttributes<unknown>>;
13
+ export default _default;
@@ -1,2 +1,3 @@
1
- /// <reference types="react" />
2
- export default function Xgplay({ config, type }: any): JSX.Element;
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;
@@ -1418,6 +1420,9 @@ button[data-prefers-color='dark'] .swiper-pagination-bullet {
1418
1420
  grid-gap: 1px 1px;
1419
1421
  background: #0f6ab7;
1420
1422
  }
1423
+ [data-prefers-color='dark'] .xgplayer-skin-default {
1424
+ height: 100% !important;
1425
+ }
1421
1426
 
1422
1427
  /* Color
1423
1428
  ----------------------- */
@@ -2753,11 +2758,13 @@ button[data-prefers-color='light'] .swiper-pagination-bullet {
2753
2758
  -ms-user-select: none;
2754
2759
  user-select: none;
2755
2760
  }
2756
- [data-prefers-color='light'] .row {
2757
- height: calc(100% -30px);
2758
- }
2759
2761
  [data-prefers-color='light'] .camera {
2760
2762
  border: 1px solid #216fa3;
2763
+ width: 100%;
2764
+ height: 100%;
2765
+ }
2766
+ [data-prefers-color='light'] .activeCamera {
2767
+ border: 1px solid red;
2761
2768
  }
2762
2769
  [data-prefers-color='light'] .camera:hover {
2763
2770
  border: 1px solid red;
@@ -2799,6 +2806,9 @@ button[data-prefers-color='light'] .swiper-pagination-bullet {
2799
2806
  grid-gap: 1px 1px;
2800
2807
  background: #0f6ab7;
2801
2808
  }
2809
+ [data-prefers-color='light'] .xgplayer-skin-default {
2810
+ height: 100% !important;
2811
+ }
2802
2812
 
2803
2813
  .frame {
2804
2814
  width: 40px;
@@ -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;
@@ -1418,6 +1420,9 @@ button[data-prefers-color='dark'] .swiper-pagination-bullet {
1418
1420
  grid-gap: 1px 1px;
1419
1421
  background: #0f6ab7;
1420
1422
  }
1423
+ [data-prefers-color='dark'] .xgplayer-skin-default {
1424
+ height: 100% !important;
1425
+ }
1421
1426
 
1422
1427
  /* Color
1423
1428
  ----------------------- */
@@ -2753,11 +2758,13 @@ button[data-prefers-color='light'] .swiper-pagination-bullet {
2753
2758
  -ms-user-select: none;
2754
2759
  user-select: none;
2755
2760
  }
2756
- [data-prefers-color='light'] .row {
2757
- height: calc(100% -30px);
2758
- }
2759
2761
  [data-prefers-color='light'] .camera {
2760
2762
  border: 1px solid #216fa3;
2763
+ width: 100%;
2764
+ height: 100%;
2765
+ }
2766
+ [data-prefers-color='light'] .activeCamera {
2767
+ border: 1px solid red;
2761
2768
  }
2762
2769
  [data-prefers-color='light'] .camera:hover {
2763
2770
  border: 1px solid red;
@@ -2799,6 +2806,9 @@ button[data-prefers-color='light'] .swiper-pagination-bullet {
2799
2806
  grid-gap: 1px 1px;
2800
2807
  background: #0f6ab7;
2801
2808
  }
2809
+ [data-prefers-color='light'] .xgplayer-skin-default {
2810
+ height: 100% !important;
2811
+ }
2802
2812
 
2803
2813
  .frame {
2804
2814
  width: 40px;
package/dist/index.esm.js CHANGED
@@ -10980,45 +10980,64 @@ var WebsocketHeart = /*#__PURE__*/_createClass(function WebsocketHeart(_ref) {
10980
10980
  this.heartCheck = null;
10981
10981
  });
10982
10982
 
10983
- var player = null;
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
- if (type.indexOf('hls') !== -1) {
10990
- player = new HlsJsPlayer(_objectSpread2({
10991
- el: ref.current,
10992
- width: '100%',
10993
- height: '100%',
10994
- autoplay: true,
10995
- isLive: true,
10996
- autoplayMuted: true
10997
- }, config));
10998
- } else if (type.indexOf('flv') !== -1) {
10999
- player = new FlvPlayer(_objectSpread2({
11000
- el: ref.current,
11001
- width: '100%',
11002
- height: '100%',
11003
- autoplay: true,
11004
- isLive: true,
11005
- autoplayMuted: true
11006
- }, config));
11007
- } else if (type.indexOf('mp4') !== -1) {
11008
- player = new Player(_objectSpread2({
11009
- el: ref.current,
11010
- width: '100%',
11011
- height: '100%',
11012
- autoplay: true,
11013
- isLive: true,
11014
- autoplayMuted: true
11015
- }, 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
+ }
11016
11025
  }
11017
11026
 
11018
11027
  return function () {
11019
- player = null;
11028
+ playerRef.current = null;
11020
11029
  };
11021
11030
  }, []);
11031
+ useEffect(function () {
11032
+ if (playerRef.current) {
11033
+ setRef(playerRef.current);
11034
+ }
11035
+ });
11036
+ useImperativeHandle(fRef, function () {
11037
+ return {
11038
+ player: playerRef.current
11039
+ };
11040
+ });
11022
11041
  return /*#__PURE__*/React.createElement("div", {
11023
11042
  ref: ref,
11024
11043
  style: {
@@ -11027,6 +11046,8 @@ function Xgplay(_ref) {
11027
11046
  });
11028
11047
  }
11029
11048
 
11049
+ var Xgplay$1 = /*#__PURE__*/forwardRef(Xgplay);
11050
+
11030
11051
  /*
11031
11052
  * @Author: lijin
11032
11053
  * @Date: 2021-08-04 16:24:47
@@ -11046,7 +11067,7 @@ var IconFont = createFromIconfontCN({
11046
11067
  scriptUrl: '//at.alicdn.com/t/font_3425259_s93peuz62an.js'
11047
11068
  });
11048
11069
 
11049
- function VideoPlayer(_ref) {
11070
+ function VideoPlayer(_ref, ref) {
11050
11071
  var _ref$footer = _ref.footer,
11051
11072
  footer = _ref$footer === void 0 ? true : _ref$footer,
11052
11073
  _ref$style = _ref.style,
@@ -11056,6 +11077,7 @@ function VideoPlayer(_ref) {
11056
11077
  } : _ref$style,
11057
11078
  _ref$config = _ref.config,
11058
11079
  config = _ref$config === void 0 ? {} : _ref$config,
11080
+ layoutIndex = _ref.layoutIndex,
11059
11081
  _ref$url = _ref.url,
11060
11082
  url = _ref$url === void 0 ? [] : _ref$url;
11061
11083
  var layouts = [{
@@ -11091,23 +11113,46 @@ function VideoPlayer(_ref) {
11091
11113
  span: 9
11092
11114
  }];
11093
11115
 
11094
- var _useState = useState(0),
11116
+ var _useState = useState(layoutIndex || 0),
11095
11117
  _useState2 = _slicedToArray(_useState, 2),
11096
11118
  currentLayoutIndex = _useState2[0],
11097
11119
  setCurrentLayoutIndex = _useState2[1];
11098
11120
 
11121
+ var initPlayerIndex = layouts[layoutIndex || 0].span >= url.length ? url.length - 1 >= 0 ? url.length - 1 : 0 : layouts[layoutIndex || 0].span - 1;
11122
+
11123
+ var _useState3 = useState(initPlayerIndex),
11124
+ _useState4 = _slicedToArray(_useState3, 2),
11125
+ currentPlayerIndex = _useState4[0],
11126
+ setCurrentPlayerIndex = _useState4[1];
11127
+
11099
11128
  var domRef = useRef(null);
11100
- var contentRef = useRef(null);
11129
+ var playerRef = useRef({});
11130
+
11131
+ var _useState5 = useState([]),
11132
+ _useState6 = _slicedToArray(_useState5, 2),
11133
+ players = _useState6[0],
11134
+ setPlayers = _useState6[1];
11135
+
11101
11136
  var renderDom = useMemo(function () {
11102
11137
  var arr = new Array(layouts[currentLayoutIndex].span).fill(0);
11103
11138
  return arr.map(function (item, index) {
11104
11139
  return /*#__PURE__*/React.createElement("div", {
11105
11140
  key: index,
11106
- className: "camera"
11107
- }, url[index] ? /*#__PURE__*/React.createElement(Xgplay, {
11141
+ className: "camera ".concat(currentPlayerIndex == index ? 'activeCamera' : ''),
11142
+ onClickCapture: function onClickCapture() {
11143
+ setCurrentPlayerIndex(index);
11144
+ }
11145
+ }, url[index] ? /*#__PURE__*/React.createElement(Xgplay$1, {
11146
+ setRef: function setRef(ref) {
11147
+ return setPlayers(function (players) {
11148
+ players[index] = ref;
11149
+ return players;
11150
+ });
11151
+ },
11108
11152
  type: url[index],
11109
11153
  config: _objectSpread2({
11110
- url: url[index]
11154
+ url: url[index],
11155
+ fluid: true
11111
11156
  }, config)
11112
11157
  }) : /*#__PURE__*/React.createElement("div", {
11113
11158
  className: "empty",
@@ -11119,7 +11164,7 @@ function VideoPlayer(_ref) {
11119
11164
  }
11120
11165
  }));
11121
11166
  });
11122
- }, [currentLayoutIndex]);
11167
+ }, [currentLayoutIndex, currentPlayerIndex, playerRef, url]);
11123
11168
 
11124
11169
  function exitFullscreen() {
11125
11170
  if (document.exitFullscreen) {
@@ -11142,9 +11187,25 @@ function VideoPlayer(_ref) {
11142
11187
  }
11143
11188
  }
11144
11189
 
11190
+ var loadCamera = function loadCamera(url) {
11191
+ var currentPlayer = players[currentPlayerIndex];
11192
+
11193
+ if (currentPlayer) {
11194
+ debugger;
11195
+ currentPlayer.src = url;
11196
+ }
11197
+ };
11198
+
11199
+ useImperativeHandle(ref, function () {
11200
+ return {
11201
+ players: players,
11202
+ currentLayoutIndex: currentLayoutIndex,
11203
+ currentPlayerIndex: currentPlayerIndex,
11204
+ loadCamera: loadCamera
11205
+ };
11206
+ });
11145
11207
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
11146
- style: style,
11147
- ref: contentRef
11208
+ style: style
11148
11209
  }, /*#__PURE__*/React.createElement("div", {
11149
11210
  ref: domRef,
11150
11211
  className: "videoContainer",
@@ -11156,7 +11217,9 @@ function VideoPlayer(_ref) {
11156
11217
  key: index,
11157
11218
  className: "btnbox",
11158
11219
  onClick: function onClick() {
11159
- return setCurrentLayoutIndex(index);
11220
+ var playerIndex = layouts[index || 0].span > url.length ? url.length - 1 >= 0 ? url.length : 0 : layouts[index || 0].span - 1;
11221
+ setCurrentPlayerIndex(playerIndex);
11222
+ setCurrentLayoutIndex(index);
11160
11223
  }
11161
11224
  }, /*#__PURE__*/React.createElement(_Tooltip, {
11162
11225
  placement: "top",
@@ -11165,4 +11228,6 @@ function VideoPlayer(_ref) {
11165
11228
  })) : null));
11166
11229
  }
11167
11230
 
11168
- 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, VideoPlayer, Index$5 as WDatePicker, WForm$1 as WForm, WebsocketHeart };
11231
+ var index$3 = /*#__PURE__*/forwardRef(VideoPlayer);
11232
+
11233
+ 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
@@ -11018,45 +11018,64 @@ var WebsocketHeart = /*#__PURE__*/_createClass(function WebsocketHeart(_ref) {
11018
11018
  this.heartCheck = null;
11019
11019
  });
11020
11020
 
11021
- var player = null;
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
- if (type.indexOf('hls') !== -1) {
11028
- player = new HlsJsPlayer__default['default'](_objectSpread2({
11029
- el: ref.current,
11030
- width: '100%',
11031
- height: '100%',
11032
- autoplay: true,
11033
- isLive: true,
11034
- autoplayMuted: true
11035
- }, config));
11036
- } else if (type.indexOf('flv') !== -1) {
11037
- player = new FlvPlayer__default['default'](_objectSpread2({
11038
- el: ref.current,
11039
- width: '100%',
11040
- height: '100%',
11041
- autoplay: true,
11042
- isLive: true,
11043
- autoplayMuted: true
11044
- }, config));
11045
- } else if (type.indexOf('mp4') !== -1) {
11046
- player = new Player__default['default'](_objectSpread2({
11047
- el: ref.current,
11048
- width: '100%',
11049
- height: '100%',
11050
- autoplay: true,
11051
- isLive: true,
11052
- autoplayMuted: true
11053
- }, 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
+ }
11054
11063
  }
11055
11064
 
11056
11065
  return function () {
11057
- player = null;
11066
+ playerRef.current = null;
11058
11067
  };
11059
11068
  }, []);
11069
+ React.useEffect(function () {
11070
+ if (playerRef.current) {
11071
+ setRef(playerRef.current);
11072
+ }
11073
+ });
11074
+ React.useImperativeHandle(fRef, function () {
11075
+ return {
11076
+ player: playerRef.current
11077
+ };
11078
+ });
11060
11079
  return /*#__PURE__*/React__default['default'].createElement("div", {
11061
11080
  ref: ref,
11062
11081
  style: {
@@ -11065,6 +11084,8 @@ function Xgplay(_ref) {
11065
11084
  });
11066
11085
  }
11067
11086
 
11087
+ var Xgplay$1 = /*#__PURE__*/React.forwardRef(Xgplay);
11088
+
11068
11089
  /*
11069
11090
  * @Author: lijin
11070
11091
  * @Date: 2021-08-04 16:24:47
@@ -11084,7 +11105,7 @@ var IconFont = icons.createFromIconfontCN({
11084
11105
  scriptUrl: '//at.alicdn.com/t/font_3425259_s93peuz62an.js'
11085
11106
  });
11086
11107
 
11087
- function VideoPlayer(_ref) {
11108
+ function VideoPlayer(_ref, ref) {
11088
11109
  var _ref$footer = _ref.footer,
11089
11110
  footer = _ref$footer === void 0 ? true : _ref$footer,
11090
11111
  _ref$style = _ref.style,
@@ -11094,6 +11115,7 @@ function VideoPlayer(_ref) {
11094
11115
  } : _ref$style,
11095
11116
  _ref$config = _ref.config,
11096
11117
  config = _ref$config === void 0 ? {} : _ref$config,
11118
+ layoutIndex = _ref.layoutIndex,
11097
11119
  _ref$url = _ref.url,
11098
11120
  url = _ref$url === void 0 ? [] : _ref$url;
11099
11121
  var layouts = [{
@@ -11129,23 +11151,46 @@ function VideoPlayer(_ref) {
11129
11151
  span: 9
11130
11152
  }];
11131
11153
 
11132
- var _useState = React.useState(0),
11154
+ var _useState = React.useState(layoutIndex || 0),
11133
11155
  _useState2 = _slicedToArray(_useState, 2),
11134
11156
  currentLayoutIndex = _useState2[0],
11135
11157
  setCurrentLayoutIndex = _useState2[1];
11136
11158
 
11159
+ var initPlayerIndex = layouts[layoutIndex || 0].span >= url.length ? url.length - 1 >= 0 ? url.length - 1 : 0 : layouts[layoutIndex || 0].span - 1;
11160
+
11161
+ var _useState3 = React.useState(initPlayerIndex),
11162
+ _useState4 = _slicedToArray(_useState3, 2),
11163
+ currentPlayerIndex = _useState4[0],
11164
+ setCurrentPlayerIndex = _useState4[1];
11165
+
11137
11166
  var domRef = React.useRef(null);
11138
- var contentRef = React.useRef(null);
11167
+ var playerRef = React.useRef({});
11168
+
11169
+ var _useState5 = React.useState([]),
11170
+ _useState6 = _slicedToArray(_useState5, 2),
11171
+ players = _useState6[0],
11172
+ setPlayers = _useState6[1];
11173
+
11139
11174
  var renderDom = React.useMemo(function () {
11140
11175
  var arr = new Array(layouts[currentLayoutIndex].span).fill(0);
11141
11176
  return arr.map(function (item, index) {
11142
11177
  return /*#__PURE__*/React__default['default'].createElement("div", {
11143
11178
  key: index,
11144
- className: "camera"
11145
- }, url[index] ? /*#__PURE__*/React__default['default'].createElement(Xgplay, {
11179
+ className: "camera ".concat(currentPlayerIndex == index ? 'activeCamera' : ''),
11180
+ onClickCapture: function onClickCapture() {
11181
+ setCurrentPlayerIndex(index);
11182
+ }
11183
+ }, url[index] ? /*#__PURE__*/React__default['default'].createElement(Xgplay$1, {
11184
+ setRef: function setRef(ref) {
11185
+ return setPlayers(function (players) {
11186
+ players[index] = ref;
11187
+ return players;
11188
+ });
11189
+ },
11146
11190
  type: url[index],
11147
11191
  config: _objectSpread2({
11148
- url: url[index]
11192
+ url: url[index],
11193
+ fluid: true
11149
11194
  }, config)
11150
11195
  }) : /*#__PURE__*/React__default['default'].createElement("div", {
11151
11196
  className: "empty",
@@ -11157,7 +11202,7 @@ function VideoPlayer(_ref) {
11157
11202
  }
11158
11203
  }));
11159
11204
  });
11160
- }, [currentLayoutIndex]);
11205
+ }, [currentLayoutIndex, currentPlayerIndex, playerRef, url]);
11161
11206
 
11162
11207
  function exitFullscreen() {
11163
11208
  if (document.exitFullscreen) {
@@ -11180,9 +11225,25 @@ function VideoPlayer(_ref) {
11180
11225
  }
11181
11226
  }
11182
11227
 
11228
+ var loadCamera = function loadCamera(url) {
11229
+ var currentPlayer = players[currentPlayerIndex];
11230
+
11231
+ if (currentPlayer) {
11232
+ debugger;
11233
+ currentPlayer.src = url;
11234
+ }
11235
+ };
11236
+
11237
+ React.useImperativeHandle(ref, function () {
11238
+ return {
11239
+ players: players,
11240
+ currentLayoutIndex: currentLayoutIndex,
11241
+ currentPlayerIndex: currentPlayerIndex,
11242
+ loadCamera: loadCamera
11243
+ };
11244
+ });
11183
11245
  return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("div", {
11184
- style: style,
11185
- ref: contentRef
11246
+ style: style
11186
11247
  }, /*#__PURE__*/React__default['default'].createElement("div", {
11187
11248
  ref: domRef,
11188
11249
  className: "videoContainer",
@@ -11194,7 +11255,9 @@ function VideoPlayer(_ref) {
11194
11255
  key: index,
11195
11256
  className: "btnbox",
11196
11257
  onClick: function onClick() {
11197
- return setCurrentLayoutIndex(index);
11258
+ var playerIndex = layouts[index || 0].span > url.length ? url.length - 1 >= 0 ? url.length : 0 : layouts[index || 0].span - 1;
11259
+ setCurrentPlayerIndex(playerIndex);
11260
+ setCurrentLayoutIndex(index);
11198
11261
  }
11199
11262
  }, /*#__PURE__*/React__default['default'].createElement(_Tooltip__default['default'], {
11200
11263
  placement: "top",
@@ -11203,6 +11266,8 @@ function VideoPlayer(_ref) {
11203
11266
  })) : null));
11204
11267
  }
11205
11268
 
11269
+ var index$3 = /*#__PURE__*/React.forwardRef(VideoPlayer);
11270
+
11206
11271
  exports.AutoScroll = Index$9;
11207
11272
  exports.Breadcrumb = Index$b;
11208
11273
  exports.Button = WButton;
@@ -11226,7 +11291,7 @@ exports.Switch = WSwitch;
11226
11291
  exports.TabelCard = index$2;
11227
11292
  exports.Table = Table;
11228
11293
  exports.TreeSelect = Index$6;
11229
- exports.VideoPlayer = VideoPlayer;
11294
+ exports.VideoPlayer = index$3;
11230
11295
  exports.WDatePicker = Index$5;
11231
11296
  exports.WForm = WForm$1;
11232
11297
  exports.WebsocketHeart = WebsocketHeart;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "wargerm",
4
- "version": "0.4.12",
4
+ "version": "0.4.13",
5
5
  "scripts": {
6
6
  "dev": "dumi dev",
7
7
  "docs:build": "dumi build",