@vtx/player 1.9.2 → 1.9.3

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.
Files changed (114) hide show
  1. package/README.md +2 -2
  2. package/lib/api/fetch.js +69 -67
  3. package/lib/api/fetch.js.map +1 -1
  4. package/lib/api/index.js +47 -34
  5. package/lib/api/index.js.map +1 -1
  6. package/lib/api/types.d.ts +5 -5
  7. package/lib/api/types.js +1 -0
  8. package/lib/api/types.js.map +1 -1
  9. package/lib/bd/PlayerManager.js +7 -8
  10. package/lib/bd/PlayerManager.js.map +1 -1
  11. package/lib/bill-player/index.d.ts +1 -1
  12. package/lib/bill-player/index.js +11 -9
  13. package/lib/bill-player/index.js.map +1 -1
  14. package/lib/bill-player/style/index.less +320 -320
  15. package/lib/components/set-tag-video/index.js +8 -7
  16. package/lib/components/set-tag-video/index.js.map +1 -1
  17. package/lib/components/set-tag-video/style/index.less +125 -125
  18. package/lib/components/split-screen/index.d.ts +1 -1
  19. package/lib/components/split-screen/index.js +5 -3
  20. package/lib/components/split-screen/index.js.map +1 -1
  21. package/lib/components/tag-video/index.js +11 -10
  22. package/lib/components/tag-video/index.js.map +1 -1
  23. package/lib/components/tag-video/style/index.less +69 -69
  24. package/lib/components/video-scale/index.d.ts +1 -1
  25. package/lib/components/video-scale/index.js +3 -2
  26. package/lib/components/video-scale/index.js.map +1 -1
  27. package/lib/config.js +2 -1
  28. package/lib/config.js.map +1 -1
  29. package/lib/context/index.js +5 -3
  30. package/lib/context/index.js.map +1 -1
  31. package/lib/controls/index.d.ts +11 -11
  32. package/lib/controls/index.js +22 -14
  33. package/lib/controls/index.js.map +1 -1
  34. package/lib/controls/style/index.less +192 -192
  35. package/lib/h264/PlayerManager.js +7 -8
  36. package/lib/h264/PlayerManager.js.map +1 -1
  37. package/lib/history-control/index.d.ts +2 -2
  38. package/lib/history-control/index.js +10 -8
  39. package/lib/history-control/index.js.map +1 -1
  40. package/lib/history-control/style/index.less +252 -252
  41. package/lib/history-control-v2/components/grid-item/index.js +11 -10
  42. package/lib/history-control-v2/components/grid-item/index.js.map +1 -1
  43. package/lib/history-control-v2/components/panel/VideoTable.d.ts +1 -1
  44. package/lib/history-control-v2/components/panel/VideoTable.js +54 -51
  45. package/lib/history-control-v2/components/panel/VideoTable.js.map +1 -1
  46. package/lib/history-control-v2/components/panel/index.js +16 -14
  47. package/lib/history-control-v2/components/panel/index.js.map +1 -1
  48. package/lib/history-control-v2/context.js +2 -1
  49. package/lib/history-control-v2/context.js.map +1 -1
  50. package/lib/history-control-v2/index.d.ts +4 -4
  51. package/lib/history-control-v2/index.js +75 -71
  52. package/lib/history-control-v2/index.js.map +1 -1
  53. package/lib/history-control-v2/style/index.less +437 -437
  54. package/lib/history-control-v2/utils.js +18 -13
  55. package/lib/history-control-v2/utils.js.map +1 -1
  56. package/lib/history-player/index.d.ts +1 -1
  57. package/lib/history-player/index.js +110 -107
  58. package/lib/history-player/index.js.map +1 -1
  59. package/lib/history-player/style/index.less +102 -102
  60. package/lib/hooks/useSettings.js +2 -1
  61. package/lib/hooks/useSettings.js.map +1 -1
  62. package/lib/icc/PlayerManager.js +8 -9
  63. package/lib/icc/PlayerManager.js.map +1 -1
  64. package/lib/icc/api.d.ts +68 -0
  65. package/lib/icc/api.js +3 -2
  66. package/lib/icc/api.js.map +1 -1
  67. package/lib/icons/index.d.ts +36 -36
  68. package/lib/icons/index.js +73 -37
  69. package/lib/icons/index.js.map +1 -1
  70. package/lib/icons/index.less +32 -32
  71. package/lib/index.js +1 -1
  72. package/lib/index.js.map +1 -1
  73. package/lib/live-channel-player/index.d.ts +1 -1
  74. package/lib/live-channel-player/index.js +32 -29
  75. package/lib/live-channel-player/index.js.map +1 -1
  76. package/lib/live-control/index.d.ts +2 -2
  77. package/lib/live-control/index.js +13 -12
  78. package/lib/live-control/index.js.map +1 -1
  79. package/lib/live-control/style/index.less +99 -99
  80. package/lib/live-control-v2/index.d.ts +3 -3
  81. package/lib/live-control-v2/index.js +22 -19
  82. package/lib/live-control-v2/index.js.map +1 -1
  83. package/lib/live-control-v2/style/index.less +192 -192
  84. package/lib/live-player/index.d.ts +1 -0
  85. package/lib/live-player/index.js +74 -66
  86. package/lib/live-player/index.js.map +1 -1
  87. package/lib/live-player/style/index.less +75 -75
  88. package/lib/mpegts/PlayerManager.js +7 -8
  89. package/lib/mpegts/PlayerManager.js.map +1 -1
  90. package/lib/player/index.d.ts +3 -1
  91. package/lib/player/index.js +61 -52
  92. package/lib/player/index.js.map +1 -1
  93. package/lib/rsl/PlayerManager.d.ts +1 -1
  94. package/lib/rsl/PlayerManager.js +7 -8
  95. package/lib/rsl/PlayerManager.js.map +1 -1
  96. package/lib/typings/@vtx/utils/index.d.ts +28 -28
  97. package/lib/typings/h5player.d.ts +150 -150
  98. package/lib/typings/mpegts.d.ts +7 -7
  99. package/lib/typings/webrtcplayer.d.ts +56 -56
  100. package/lib/typings/wfsplayer.d.ts +56 -56
  101. package/lib/typings/wsplayer.d.ts +99 -99
  102. package/lib/utils/index.d.ts +1 -1
  103. package/lib/utils/index.js +30 -43
  104. package/lib/utils/index.js.map +1 -1
  105. package/lib/vite-env.d.ts +1 -1
  106. package/lib/vtxHls/PlayerManager.js +7 -8
  107. package/lib/vtxHls/PlayerManager.js.map +1 -1
  108. package/lib/vtxHls/WhepManager.js +10 -11
  109. package/lib/vtxHls/WhepManager.js.map +1 -1
  110. package/lib/webrtc/PlayerManager.js +7 -8
  111. package/lib/webrtc/PlayerManager.js.map +1 -1
  112. package/lib/wfs/PlayerManager.js +7 -8
  113. package/lib/wfs/PlayerManager.js.map +1 -1
  114. package/package.json +125 -125
@@ -1,192 +1,192 @@
1
- .vtx-live-control-v2 {
2
- display: flex;
3
- flex-direction: column;
4
-
5
- .player-grid-container {
6
- display: grid;
7
- flex-grow: 1;
8
- grid-gap: 1px;
9
- height: 0;
10
- background-color: rgba(0, 0, 0, 0.8);
11
-
12
- &._1 {
13
- grid-template-rows: 1fr;
14
- grid-template-columns: 1fr;
15
- }
16
-
17
- &._4 {
18
- grid-template-rows: 1fr 1fr;
19
- grid-template-columns: 1fr 1fr;
20
- }
21
- &._9 {
22
- grid-template-rows: 1fr 1fr 1fr;
23
- grid-template-columns: 1fr 1fr 1fr;
24
- }
25
- &._16 {
26
- grid-template-rows: 1fr 1fr 1fr 1fr;
27
- grid-template-columns: 1fr 1fr 1fr 1fr;
28
- }
29
- &._25 {
30
- grid-template-rows: 1fr 1fr 1fr 1fr 1fr;
31
- grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
32
- }
33
- &._6 {
34
- grid-template-rows: 1fr 1fr 1fr;
35
- grid-template-columns: 1fr 1fr 1fr;
36
- :nth-child(1) {
37
- grid-column-start: 1;
38
- grid-column-end: 3;
39
- grid-row-start: 1;
40
- grid-row-end: 3;
41
- }
42
- }
43
- &._8 {
44
- grid-template-rows: 1fr 1fr 1fr 1fr;
45
- grid-template-columns: 1fr 1fr 1fr 1fr;
46
- :nth-child(1) {
47
- grid-column-start: 1;
48
- grid-column-end: 4;
49
- grid-row-start: 1;
50
- grid-row-end: 4;
51
- }
52
- }
53
- &._10 {
54
- grid-template-rows: 1fr 1fr 1fr 1fr 1fr;
55
- grid-template-columns: 1fr 1fr 1fr;
56
- :nth-child(1) {
57
- grid-column-start: 1;
58
- grid-column-end: 3;
59
- grid-row-start: 1;
60
- grid-row-end: 4;
61
- }
62
- }
63
- &._13 {
64
- grid-template-rows: 1fr 1fr 1fr 1fr;
65
- grid-template-columns: 1fr 1fr 1fr 1fr;
66
- :nth-child(1) {
67
- grid-column-start: 1;
68
- grid-column-end: 3;
69
- grid-row-start: 1;
70
- grid-row-end: 3;
71
- }
72
- }
73
- &._14 {
74
- grid-template-rows: 1fr 1fr 1fr 1fr 1fr;
75
- grid-template-columns: 1fr 1fr 1fr 1fr;
76
- :nth-child(1) {
77
- grid-column-start: 1;
78
- grid-column-end: 3;
79
- grid-row-start: 1;
80
- grid-row-end: 4;
81
- }
82
- :nth-child(2) {
83
- grid-column-start: 3;
84
- grid-column-end: 5;
85
- }
86
- }
87
- &._17 {
88
- grid-template-rows: 1fr 1fr 1fr 1fr 1fr;
89
- grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
90
- :nth-child(1) {
91
- grid-column-start: 1;
92
- grid-column-end: 4;
93
- grid-row-start: 1;
94
- grid-row-end: 4;
95
- }
96
- }
97
- &._22 {
98
- grid-template-rows: 1fr 1fr 1fr 1fr 1fr;
99
- grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
100
- :nth-child(1) {
101
- grid-column-start: 1;
102
- grid-column-end: 3;
103
- grid-row-start: 1;
104
- grid-row-end: 3;
105
- }
106
- }
107
- .grid-item-container {
108
- display: flex;
109
- flex-direction: column;
110
- min-width: 0;
111
- min-height: 0;
112
- background-color: #2b3d51;
113
- align-items: center;
114
- &.emptyImg {
115
- background-image: url('../images/empty.png');
116
- background-repeat: no-repeat;
117
- background-position: center;
118
- }
119
- &.active {
120
- box-shadow: 0 0 0 1px #52c41a;
121
- }
122
- > .content {
123
- width: 100%;
124
- height: calc(100% - 26px);
125
- display: flex;
126
- align-items: center;
127
- justify-content: center;
128
- }
129
- }
130
- }
131
-
132
- .bottom-controls {
133
- display: flex;
134
- align-items: center;
135
- width: 100%;
136
- height: 33px;
137
- padding: 0 12px;
138
- background-color: #243241;
139
-
140
- .right {
141
- margin-left: auto;
142
-
143
- > div {
144
- height: 24px;
145
- }
146
- }
147
- .split-line {
148
- margin-top: 6px;
149
- width: 1px;
150
- background-color: rgba(255, 255, 255, 0.1);
151
- height: 14px;
152
- }
153
- .controls-icon-hover {
154
- color: rgba(255, 255, 255, 0.65);
155
- display: flex;
156
- align-items: center;
157
- padding-top: 2px;
158
- .hover-hide {
159
- display: inline-block;
160
- vertical-align: 0.1em;
161
- font-size: 12px;
162
- }
163
- .hover-show {
164
- display: none;
165
- vertical-align: 0.1em;
166
- font-size: 12px;
167
- }
168
- &:hover {
169
- .hover-hide {
170
- display: none;
171
- }
172
- .hover-show {
173
- display: inline-block;
174
- color: #1890ff;
175
- vertical-align: 0.2em;
176
- }
177
- }
178
- }
179
- .grid-change-disable {
180
- color: rgba(255, 255, 255, 0.65);
181
- display: flex;
182
- align-items: center;
183
- padding-top: 2px;
184
- cursor: not-allowed;
185
- .arrow {
186
- display: inline-block;
187
- vertical-align: 0.1em;
188
- font-size: 12px;
189
- }
190
- }
191
- }
192
- }
1
+ .vtx-live-control-v2 {
2
+ display: flex;
3
+ flex-direction: column;
4
+
5
+ .player-grid-container {
6
+ display: grid;
7
+ flex-grow: 1;
8
+ grid-gap: 1px;
9
+ height: 0;
10
+ background-color: rgba(0, 0, 0, 0.8);
11
+
12
+ &._1 {
13
+ grid-template-rows: 1fr;
14
+ grid-template-columns: 1fr;
15
+ }
16
+
17
+ &._4 {
18
+ grid-template-rows: 1fr 1fr;
19
+ grid-template-columns: 1fr 1fr;
20
+ }
21
+ &._9 {
22
+ grid-template-rows: 1fr 1fr 1fr;
23
+ grid-template-columns: 1fr 1fr 1fr;
24
+ }
25
+ &._16 {
26
+ grid-template-rows: 1fr 1fr 1fr 1fr;
27
+ grid-template-columns: 1fr 1fr 1fr 1fr;
28
+ }
29
+ &._25 {
30
+ grid-template-rows: 1fr 1fr 1fr 1fr 1fr;
31
+ grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
32
+ }
33
+ &._6 {
34
+ grid-template-rows: 1fr 1fr 1fr;
35
+ grid-template-columns: 1fr 1fr 1fr;
36
+ :nth-child(1) {
37
+ grid-column-start: 1;
38
+ grid-column-end: 3;
39
+ grid-row-start: 1;
40
+ grid-row-end: 3;
41
+ }
42
+ }
43
+ &._8 {
44
+ grid-template-rows: 1fr 1fr 1fr 1fr;
45
+ grid-template-columns: 1fr 1fr 1fr 1fr;
46
+ :nth-child(1) {
47
+ grid-column-start: 1;
48
+ grid-column-end: 4;
49
+ grid-row-start: 1;
50
+ grid-row-end: 4;
51
+ }
52
+ }
53
+ &._10 {
54
+ grid-template-rows: 1fr 1fr 1fr 1fr 1fr;
55
+ grid-template-columns: 1fr 1fr 1fr;
56
+ :nth-child(1) {
57
+ grid-column-start: 1;
58
+ grid-column-end: 3;
59
+ grid-row-start: 1;
60
+ grid-row-end: 4;
61
+ }
62
+ }
63
+ &._13 {
64
+ grid-template-rows: 1fr 1fr 1fr 1fr;
65
+ grid-template-columns: 1fr 1fr 1fr 1fr;
66
+ :nth-child(1) {
67
+ grid-column-start: 1;
68
+ grid-column-end: 3;
69
+ grid-row-start: 1;
70
+ grid-row-end: 3;
71
+ }
72
+ }
73
+ &._14 {
74
+ grid-template-rows: 1fr 1fr 1fr 1fr 1fr;
75
+ grid-template-columns: 1fr 1fr 1fr 1fr;
76
+ :nth-child(1) {
77
+ grid-column-start: 1;
78
+ grid-column-end: 3;
79
+ grid-row-start: 1;
80
+ grid-row-end: 4;
81
+ }
82
+ :nth-child(2) {
83
+ grid-column-start: 3;
84
+ grid-column-end: 5;
85
+ }
86
+ }
87
+ &._17 {
88
+ grid-template-rows: 1fr 1fr 1fr 1fr 1fr;
89
+ grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
90
+ :nth-child(1) {
91
+ grid-column-start: 1;
92
+ grid-column-end: 4;
93
+ grid-row-start: 1;
94
+ grid-row-end: 4;
95
+ }
96
+ }
97
+ &._22 {
98
+ grid-template-rows: 1fr 1fr 1fr 1fr 1fr;
99
+ grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
100
+ :nth-child(1) {
101
+ grid-column-start: 1;
102
+ grid-column-end: 3;
103
+ grid-row-start: 1;
104
+ grid-row-end: 3;
105
+ }
106
+ }
107
+ .grid-item-container {
108
+ display: flex;
109
+ flex-direction: column;
110
+ min-width: 0;
111
+ min-height: 0;
112
+ background-color: #2b3d51;
113
+ align-items: center;
114
+ &.emptyImg {
115
+ background-image: url('../images/empty.png');
116
+ background-repeat: no-repeat;
117
+ background-position: center;
118
+ }
119
+ &.active {
120
+ box-shadow: 0 0 0 1px #52c41a;
121
+ }
122
+ > .content {
123
+ width: 100%;
124
+ height: calc(100% - 26px);
125
+ display: flex;
126
+ align-items: center;
127
+ justify-content: center;
128
+ }
129
+ }
130
+ }
131
+
132
+ .bottom-controls {
133
+ display: flex;
134
+ align-items: center;
135
+ width: 100%;
136
+ height: 33px;
137
+ padding: 0 12px;
138
+ background-color: #243241;
139
+
140
+ .right {
141
+ margin-left: auto;
142
+
143
+ > div {
144
+ height: 24px;
145
+ }
146
+ }
147
+ .split-line {
148
+ margin-top: 6px;
149
+ width: 1px;
150
+ background-color: rgba(255, 255, 255, 0.1);
151
+ height: 14px;
152
+ }
153
+ .controls-icon-hover {
154
+ color: rgba(255, 255, 255, 0.65);
155
+ display: flex;
156
+ align-items: center;
157
+ padding-top: 2px;
158
+ .hover-hide {
159
+ display: inline-block;
160
+ vertical-align: 0.1em;
161
+ font-size: 12px;
162
+ }
163
+ .hover-show {
164
+ display: none;
165
+ vertical-align: 0.1em;
166
+ font-size: 12px;
167
+ }
168
+ &:hover {
169
+ .hover-hide {
170
+ display: none;
171
+ }
172
+ .hover-show {
173
+ display: inline-block;
174
+ color: #1890ff;
175
+ vertical-align: 0.2em;
176
+ }
177
+ }
178
+ }
179
+ .grid-change-disable {
180
+ color: rgba(255, 255, 255, 0.65);
181
+ display: flex;
182
+ align-items: center;
183
+ padding-top: 2px;
184
+ cursor: not-allowed;
185
+ .arrow {
186
+ display: inline-block;
187
+ vertical-align: 0.1em;
188
+ font-size: 12px;
189
+ }
190
+ }
191
+ }
192
+ }
@@ -49,6 +49,7 @@ interface VtxPlayerProps {
49
49
  loaded?: () => void;
50
50
  /** 加载失败重新调用接口 */
51
51
  reload?: () => void;
52
+ onClose?: () => void;
52
53
  }
53
54
  declare const _default: React.ForwardRefExoticComponent<VtxPlayerProps & React.RefAttributes<unknown>>;
54
55
  export default _default;
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports["default"] = void 0;
7
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
8
8
  var _jsxRuntime = require("react/jsx-runtime");
9
9
  var _react = require("react");
10
10
  var _controls = require("../controls");
@@ -14,14 +14,13 @@ var _player = _interopRequireDefault(require("../player"));
14
14
  var _utils = require("../utils");
15
15
  var _ahooks = require("ahooks");
16
16
  var _space = _interopRequireDefault(require("antd/lib/space"));
17
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
18
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
19
- function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
17
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
18
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
20
19
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
21
- function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
22
- function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
23
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
24
- function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
20
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
21
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
22
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
23
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
25
24
  var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
26
25
  function adopt(value) {
27
26
  return value instanceof P ? value : new P(function (resolve) {
@@ -78,7 +77,8 @@ var LivePlayer = function LivePlayer(props, selfRef) {
78
77
  info = _props$info === void 0 ? [] : _props$info,
79
78
  screenshot = props.screenshot,
80
79
  loaded = props.loaded,
81
- _reload = props.reload;
80
+ _reload = props.reload,
81
+ _onClose = props.onClose;
82
82
  var ref = (0, _react.useRef)(null);
83
83
  var wrapRef = (0, _react.useRef)(null);
84
84
  var controlsRef = (0, _react.useRef)(null);
@@ -116,68 +116,75 @@ var LivePlayer = function LivePlayer(props, selfRef) {
116
116
  }
117
117
  var player = null;
118
118
  (function () {
119
- return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
119
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regenerator["default"].mark(function _callee() {
120
120
  var token;
121
- return _regeneratorRuntime().wrap(function _callee$(_context) {
122
- while (1) switch (_context.prev = _context.next) {
123
- case 0:
124
- if (!(type === 'icc_ws')) {
125
- _context.next = 5;
126
- break;
127
- }
128
- _context.next = 3;
129
- return _api["default"].getToken({
130
- deviceId: deviceId
131
- });
132
- case 3:
133
- token = _context.sent;
134
- localStorage.setItem('accessToken', token);
135
- case 5:
136
- _context.next = 7;
137
- return new _player["default"]({
138
- url: url,
139
- deviceIp: deviceIp,
140
- deviceId: deviceId,
141
- devicePort: devicePort,
142
- userName: userName,
143
- password: password,
144
- streamType: streamType,
145
- deviceCode: deviceCode,
146
- channelNum: channelNum,
147
- enableAgent: enableAgent,
148
- container: container,
149
- type: type,
150
- reload: function reload() {
151
- if (typeof _reload === 'function') {
152
- _reload();
153
- }
121
+ return _regenerator["default"].wrap(function _callee$(_context) {
122
+ while (1) {
123
+ switch (_context.prev = _context.next) {
124
+ case 0:
125
+ if (!(type === 'icc_ws')) {
126
+ _context.next = 5;
127
+ break;
154
128
  }
155
- });
156
- case 7:
157
- player = _context.sent;
158
- playerRef.current = player;
159
- setState({
160
- loading: true,
161
- error: false
162
- });
163
- player.play().then(function () {
164
- setState({
165
- play: true,
166
- error: false
129
+ _context.next = 3;
130
+ return _api["default"].getToken({
131
+ deviceId: deviceId
167
132
  });
168
- })["catch"](function () {
169
- return setState({
170
- error: true
133
+ case 3:
134
+ token = _context.sent;
135
+ localStorage.setItem('accessToken', token);
136
+ case 5:
137
+ _context.next = 7;
138
+ return new _player["default"]({
139
+ url: url,
140
+ deviceIp: deviceIp,
141
+ deviceId: deviceId,
142
+ devicePort: devicePort,
143
+ userName: userName,
144
+ password: password,
145
+ streamType: streamType,
146
+ deviceCode: deviceCode,
147
+ channelNum: channelNum,
148
+ enableAgent: enableAgent,
149
+ container: container,
150
+ type: type,
151
+ reload: function reload() {
152
+ if (typeof _reload === 'function') {
153
+ _reload();
154
+ }
155
+ },
156
+ onClose: function onClose() {
157
+ if (typeof _onClose === 'function') {
158
+ _onClose();
159
+ }
160
+ }
171
161
  });
172
- })["finally"](function () {
162
+ case 7:
163
+ player = _context.sent;
164
+ playerRef.current = player;
173
165
  setState({
174
- loading: false
166
+ loading: true,
167
+ error: false
168
+ });
169
+ player.play().then(function () {
170
+ setState({
171
+ play: true,
172
+ error: false
173
+ });
174
+ })["catch"](function () {
175
+ return setState({
176
+ error: true
177
+ });
178
+ })["finally"](function () {
179
+ setState({
180
+ loading: false
181
+ });
182
+ loaded && loaded();
175
183
  });
176
- loaded && loaded();
177
- });
178
- case 11:
179
- case "end":
180
- return _context.stop();
184
+ case 11:
185
+ case "end":
186
+ return _context.stop();
187
+ }
181
188
  }
182
189
  }, _callee);
183
190
  }));
@@ -257,5 +264,6 @@ var LivePlayer = function LivePlayer(props, selfRef) {
257
264
  })) : null;
258
265
  };
259
266
  // LivePlayer.displayName = 'live-player';
260
- var _default = exports["default"] = /*#__PURE__*/(0, _react.forwardRef)(LivePlayer);
267
+ var _default = /*#__PURE__*/(0, _react.forwardRef)(LivePlayer);
268
+ exports["default"] = _default;
261
269
  //# sourceMappingURL=index.js.map