wargerm 0.6.20 → 0.6.21

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.
@@ -7,9 +7,8 @@ declare type propsType = {
7
7
  };
8
8
  layouts?: Array<any>;
9
9
  layoutIndex?: number;
10
- config?: Object;
10
+ config?: Record<any, any>;
11
11
  url?: string[];
12
- onDoubleClickCapture?: any;
13
12
  };
14
13
  declare const _default: React.ForwardRefExoticComponent<propsType & React.RefAttributes<unknown>>;
15
14
  export default _default;
package/dist/index.esm.js CHANGED
@@ -8146,6 +8146,10 @@ function Xgplay(_ref, fRef) {
8146
8146
  var ref = useRef(null);
8147
8147
  var playerRef = useRef(null);
8148
8148
  useEffect(function () {
8149
+ var onRequestFullscreen = function onRequestFullscreen() {
8150
+ config.onRequestFullscreen && config.onRequestFullscreen();
8151
+ };
8152
+
8149
8153
  if (ref.current) {
8150
8154
  if ((type === null || type === void 0 ? void 0 : type.indexOf('m3u8')) !== -1) {
8151
8155
  playerRef.current = new HlsJsPlayer(_objectSpread2({
@@ -8190,15 +8194,18 @@ function Xgplay(_ref, fRef) {
8190
8194
  }, config));
8191
8195
  setRef(playerRef.current);
8192
8196
  }
8197
+
8198
+ playerRef.current.on('requestFullscreen', onRequestFullscreen);
8193
8199
  }
8194
8200
 
8195
8201
  return function () {
8196
- var _playerRef$current, _playerRef$current2, _playerRef$current2$h, _playerRef$current3, _playerRef$current3$f, _playerRef$current4;
8202
+ var _playerRef$current, _playerRef$current2, _playerRef$current3, _playerRef$current3$h, _playerRef$current4, _playerRef$current4$f, _playerRef$current5;
8197
8203
 
8198
- (_playerRef$current = playerRef.current) === null || _playerRef$current === void 0 ? void 0 : _playerRef$current.pause();
8199
- (_playerRef$current2 = playerRef.current) === null || _playerRef$current2 === void 0 ? void 0 : (_playerRef$current2$h = _playerRef$current2.hls) === null || _playerRef$current2$h === void 0 ? void 0 : _playerRef$current2$h.destroy();
8200
- (_playerRef$current3 = playerRef.current) === null || _playerRef$current3 === void 0 ? void 0 : (_playerRef$current3$f = _playerRef$current3.flv) === null || _playerRef$current3$f === void 0 ? void 0 : _playerRef$current3$f.destroy();
8201
- (_playerRef$current4 = playerRef.current) === null || _playerRef$current4 === void 0 ? void 0 : _playerRef$current4.destroy(true);
8204
+ (_playerRef$current = playerRef.current) === null || _playerRef$current === void 0 ? void 0 : _playerRef$current.off('requestFullscreen', onRequestFullscreen);
8205
+ (_playerRef$current2 = playerRef.current) === null || _playerRef$current2 === void 0 ? void 0 : _playerRef$current2.pause();
8206
+ (_playerRef$current3 = playerRef.current) === null || _playerRef$current3 === void 0 ? void 0 : (_playerRef$current3$h = _playerRef$current3.hls) === null || _playerRef$current3$h === void 0 ? void 0 : _playerRef$current3$h.destroy();
8207
+ (_playerRef$current4 = playerRef.current) === null || _playerRef$current4 === void 0 ? void 0 : (_playerRef$current4$f = _playerRef$current4.flv) === null || _playerRef$current4$f === void 0 ? void 0 : _playerRef$current4$f.destroy();
8208
+ (_playerRef$current5 = playerRef.current) === null || _playerRef$current5 === void 0 ? void 0 : _playerRef$current5.destroy(true);
8202
8209
  setRef(null);
8203
8210
  playerRef.current = null;
8204
8211
  };
@@ -8244,7 +8251,6 @@ function VideoPlayer(_ref, ref) {
8244
8251
  _ref$config = _ref.config,
8245
8252
  config = _ref$config === void 0 ? {} : _ref$config,
8246
8253
  layoutIndex = _ref.layoutIndex,
8247
- _onDoubleClickCapture = _ref.onDoubleClickCapture,
8248
8254
  _ref$url = _ref.url,
8249
8255
  url = _ref$url === void 0 ? [] : _ref$url,
8250
8256
  _ref$layouts = _ref.layouts,
@@ -8319,9 +8325,6 @@ function VideoPlayer(_ref, ref) {
8319
8325
  className: "camera ".concat(currentPlayerIndex == index && arr.length > 1 ? 'activeCamera' : 'noneborder'),
8320
8326
  onClickCapture: function onClickCapture() {
8321
8327
  setCurrentPlayerIndex(index);
8322
- },
8323
- onDoubleClickCapture: function onDoubleClickCapture() {
8324
- _onDoubleClickCapture && _onDoubleClickCapture(index, !document.fullscreenElement);
8325
8328
  }
8326
8329
  }, urls[index] ? /*#__PURE__*/React.createElement(Xgplay$1, {
8327
8330
  setRef: function setRef(ref) {
@@ -8331,10 +8334,16 @@ function VideoPlayer(_ref, ref) {
8331
8334
  });
8332
8335
  },
8333
8336
  type: urls[index],
8334
- config: _objectSpread2({
8337
+ config: _objectSpread2(_objectSpread2({
8335
8338
  url: urls[index],
8336
- fluid: true
8337
- }, config)
8339
+ fluid: true,
8340
+ // cssFullscreen: true,
8341
+ closeVideoClick: true
8342
+ }, config), {}, {
8343
+ onRequestFullscreen: function onRequestFullscreen() {
8344
+ config.onRequestFullscreen && config.onRequestFullscreen(index);
8345
+ }
8346
+ })
8338
8347
  }) : /*#__PURE__*/React.createElement("div", {
8339
8348
  className: "empty",
8340
8349
  onDoubleClick: function onDoubleClick() {
package/dist/index.js CHANGED
@@ -8211,6 +8211,10 @@ function Xgplay(_ref, fRef) {
8211
8211
  var ref = React.useRef(null);
8212
8212
  var playerRef = React.useRef(null);
8213
8213
  React.useEffect(function () {
8214
+ var onRequestFullscreen = function onRequestFullscreen() {
8215
+ config.onRequestFullscreen && config.onRequestFullscreen();
8216
+ };
8217
+
8214
8218
  if (ref.current) {
8215
8219
  if ((type === null || type === void 0 ? void 0 : type.indexOf('m3u8')) !== -1) {
8216
8220
  playerRef.current = new HlsJsPlayer__default['default'](_objectSpread2({
@@ -8255,15 +8259,18 @@ function Xgplay(_ref, fRef) {
8255
8259
  }, config));
8256
8260
  setRef(playerRef.current);
8257
8261
  }
8262
+
8263
+ playerRef.current.on('requestFullscreen', onRequestFullscreen);
8258
8264
  }
8259
8265
 
8260
8266
  return function () {
8261
- var _playerRef$current, _playerRef$current2, _playerRef$current2$h, _playerRef$current3, _playerRef$current3$f, _playerRef$current4;
8267
+ var _playerRef$current, _playerRef$current2, _playerRef$current3, _playerRef$current3$h, _playerRef$current4, _playerRef$current4$f, _playerRef$current5;
8262
8268
 
8263
- (_playerRef$current = playerRef.current) === null || _playerRef$current === void 0 ? void 0 : _playerRef$current.pause();
8264
- (_playerRef$current2 = playerRef.current) === null || _playerRef$current2 === void 0 ? void 0 : (_playerRef$current2$h = _playerRef$current2.hls) === null || _playerRef$current2$h === void 0 ? void 0 : _playerRef$current2$h.destroy();
8265
- (_playerRef$current3 = playerRef.current) === null || _playerRef$current3 === void 0 ? void 0 : (_playerRef$current3$f = _playerRef$current3.flv) === null || _playerRef$current3$f === void 0 ? void 0 : _playerRef$current3$f.destroy();
8266
- (_playerRef$current4 = playerRef.current) === null || _playerRef$current4 === void 0 ? void 0 : _playerRef$current4.destroy(true);
8269
+ (_playerRef$current = playerRef.current) === null || _playerRef$current === void 0 ? void 0 : _playerRef$current.off('requestFullscreen', onRequestFullscreen);
8270
+ (_playerRef$current2 = playerRef.current) === null || _playerRef$current2 === void 0 ? void 0 : _playerRef$current2.pause();
8271
+ (_playerRef$current3 = playerRef.current) === null || _playerRef$current3 === void 0 ? void 0 : (_playerRef$current3$h = _playerRef$current3.hls) === null || _playerRef$current3$h === void 0 ? void 0 : _playerRef$current3$h.destroy();
8272
+ (_playerRef$current4 = playerRef.current) === null || _playerRef$current4 === void 0 ? void 0 : (_playerRef$current4$f = _playerRef$current4.flv) === null || _playerRef$current4$f === void 0 ? void 0 : _playerRef$current4$f.destroy();
8273
+ (_playerRef$current5 = playerRef.current) === null || _playerRef$current5 === void 0 ? void 0 : _playerRef$current5.destroy(true);
8267
8274
  setRef(null);
8268
8275
  playerRef.current = null;
8269
8276
  };
@@ -8309,7 +8316,6 @@ function VideoPlayer(_ref, ref) {
8309
8316
  _ref$config = _ref.config,
8310
8317
  config = _ref$config === void 0 ? {} : _ref$config,
8311
8318
  layoutIndex = _ref.layoutIndex,
8312
- _onDoubleClickCapture = _ref.onDoubleClickCapture,
8313
8319
  _ref$url = _ref.url,
8314
8320
  url = _ref$url === void 0 ? [] : _ref$url,
8315
8321
  _ref$layouts = _ref.layouts,
@@ -8384,9 +8390,6 @@ function VideoPlayer(_ref, ref) {
8384
8390
  className: "camera ".concat(currentPlayerIndex == index && arr.length > 1 ? 'activeCamera' : 'noneborder'),
8385
8391
  onClickCapture: function onClickCapture() {
8386
8392
  setCurrentPlayerIndex(index);
8387
- },
8388
- onDoubleClickCapture: function onDoubleClickCapture() {
8389
- _onDoubleClickCapture && _onDoubleClickCapture(index, !document.fullscreenElement);
8390
8393
  }
8391
8394
  }, urls[index] ? /*#__PURE__*/React__default['default'].createElement(Xgplay$1, {
8392
8395
  setRef: function setRef(ref) {
@@ -8396,10 +8399,16 @@ function VideoPlayer(_ref, ref) {
8396
8399
  });
8397
8400
  },
8398
8401
  type: urls[index],
8399
- config: _objectSpread2({
8402
+ config: _objectSpread2(_objectSpread2({
8400
8403
  url: urls[index],
8401
- fluid: true
8402
- }, config)
8404
+ fluid: true,
8405
+ // cssFullscreen: true,
8406
+ closeVideoClick: true
8407
+ }, config), {}, {
8408
+ onRequestFullscreen: function onRequestFullscreen() {
8409
+ config.onRequestFullscreen && config.onRequestFullscreen(index);
8410
+ }
8411
+ })
8403
8412
  }) : /*#__PURE__*/React__default['default'].createElement("div", {
8404
8413
  className: "empty",
8405
8414
  onDoubleClick: function onDoubleClick() {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "wargerm",
4
- "version": "0.6.20",
4
+ "version": "0.6.21",
5
5
  "scripts": {
6
6
  "dev": "dumi dev",
7
7
  "docs:build": "dumi build",