@vtx/player 1.7.14 → 1.7.15

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 (143) hide show
  1. package/README.md +2 -2
  2. package/lib/api/fetch.js +91 -62
  3. package/lib/api/fetch.js.map +1 -1
  4. package/lib/api/index.js +63 -18
  5. package/lib/api/index.js.map +1 -1
  6. package/lib/api/types.d.ts +5 -5
  7. package/lib/bd/PlayerManager.js +68 -38
  8. package/lib/bd/PlayerManager.js.map +1 -1
  9. package/lib/bill-player/index.d.ts +1 -1
  10. package/lib/bill-player/index.js +121 -66
  11. package/lib/bill-player/index.js.map +1 -1
  12. package/lib/bill-player/style/css.js +9 -0
  13. package/lib/bill-player/style/css.js.map +1 -1
  14. package/lib/bill-player/style/index.js +9 -0
  15. package/lib/bill-player/style/index.js.map +1 -1
  16. package/lib/bill-player/style/index.less +297 -297
  17. package/lib/components/set-tag-video/index.js +34 -6
  18. package/lib/components/set-tag-video/index.js.map +1 -1
  19. package/lib/components/set-tag-video/style/css.js.map +1 -1
  20. package/lib/components/set-tag-video/style/index.js.map +1 -1
  21. package/lib/components/set-tag-video/style/index.less +125 -125
  22. package/lib/components/split-screen/index.d.ts +1 -1
  23. package/lib/components/split-screen/index.js +14 -3
  24. package/lib/components/split-screen/index.js.map +1 -1
  25. package/lib/components/split-screen/style/css.js.map +1 -1
  26. package/lib/components/split-screen/style/index.js.map +1 -1
  27. package/lib/components/tag-video/index.js +38 -10
  28. package/lib/components/tag-video/index.js.map +1 -1
  29. package/lib/components/tag-video/style/css.js.map +1 -1
  30. package/lib/components/tag-video/style/index.js.map +1 -1
  31. package/lib/components/tag-video/style/index.less +69 -69
  32. package/lib/components/video-scale/index.d.ts +1 -1
  33. package/lib/components/video-scale/index.js +9 -2
  34. package/lib/components/video-scale/index.js.map +1 -1
  35. package/lib/components/video-scale/style/css.js.map +1 -1
  36. package/lib/components/video-scale/style/index.js.map +1 -1
  37. package/lib/context/index.js +4 -0
  38. package/lib/context/index.js.map +1 -1
  39. package/lib/controls/index.d.ts +11 -11
  40. package/lib/controls/index.js +99 -34
  41. package/lib/controls/index.js.map +1 -1
  42. package/lib/controls/style/css.js +5 -0
  43. package/lib/controls/style/css.js.map +1 -1
  44. package/lib/controls/style/index.js +5 -0
  45. package/lib/controls/style/index.js.map +1 -1
  46. package/lib/controls/style/index.less +188 -188
  47. package/lib/h264/PlayerManager.js +27 -18
  48. package/lib/h264/PlayerManager.js.map +1 -1
  49. package/lib/history-control/index.d.ts +2 -2
  50. package/lib/history-control/index.js +121 -61
  51. package/lib/history-control/index.js.map +1 -1
  52. package/lib/history-control/style/css.js +6 -0
  53. package/lib/history-control/style/css.js.map +1 -1
  54. package/lib/history-control/style/index.js +6 -0
  55. package/lib/history-control/style/index.js.map +1 -1
  56. package/lib/history-control/style/index.less +252 -252
  57. package/lib/history-control-v2/components/grid-item/index.js +79 -38
  58. package/lib/history-control-v2/components/grid-item/index.js.map +1 -1
  59. package/lib/history-control-v2/components/panel/index.js +114 -44
  60. package/lib/history-control-v2/components/panel/index.js.map +1 -1
  61. package/lib/history-control-v2/context.js +2 -0
  62. package/lib/history-control-v2/context.js.map +1 -1
  63. package/lib/history-control-v2/index.d.ts +4 -4
  64. package/lib/history-control-v2/index.js +166 -97
  65. package/lib/history-control-v2/index.js.map +1 -1
  66. package/lib/history-control-v2/style/css.js +10 -0
  67. package/lib/history-control-v2/style/css.js.map +1 -1
  68. package/lib/history-control-v2/style/index.js +10 -0
  69. package/lib/history-control-v2/style/index.js.map +1 -1
  70. package/lib/history-control-v2/style/index.less +437 -437
  71. package/lib/history-control-v2/utils.js +21 -1
  72. package/lib/history-control-v2/utils.js.map +1 -1
  73. package/lib/history-player/index.d.ts +3 -3
  74. package/lib/history-player/index.js +210 -146
  75. package/lib/history-player/index.js.map +1 -1
  76. package/lib/history-player/style/css.js +3 -0
  77. package/lib/history-player/style/css.js.map +1 -1
  78. package/lib/history-player/style/index.js +3 -0
  79. package/lib/history-player/style/index.js.map +1 -1
  80. package/lib/history-player/style/index.less +102 -102
  81. package/lib/hooks/useSettings.js +6 -1
  82. package/lib/hooks/useSettings.js.map +1 -1
  83. package/lib/icc/PlayerManager.js +57 -26
  84. package/lib/icc/PlayerManager.js.map +1 -1
  85. package/lib/icc/api.d.ts +68 -0
  86. package/lib/icc/api.js +16 -2
  87. package/lib/icc/api.js.map +1 -1
  88. package/lib/icons/index.d.ts +36 -36
  89. package/lib/icons/index.js +171 -23
  90. package/lib/icons/index.js.map +1 -1
  91. package/lib/icons/index.less +32 -32
  92. package/lib/index.js +10 -0
  93. package/lib/index.js.map +1 -1
  94. package/lib/live-channel-player/index.d.ts +1 -1
  95. package/lib/live-channel-player/index.js +67 -31
  96. package/lib/live-channel-player/index.js.map +1 -1
  97. package/lib/live-channel-player/style/css.js +1 -0
  98. package/lib/live-channel-player/style/css.js.map +1 -1
  99. package/lib/live-channel-player/style/index.js +1 -0
  100. package/lib/live-channel-player/style/index.js.map +1 -1
  101. package/lib/live-control/index.d.ts +2 -2
  102. package/lib/live-control/index.js +86 -35
  103. package/lib/live-control/index.js.map +1 -1
  104. package/lib/live-control/style/css.js +4 -0
  105. package/lib/live-control/style/css.js.map +1 -1
  106. package/lib/live-control/style/index.js +4 -0
  107. package/lib/live-control/style/index.js.map +1 -1
  108. package/lib/live-control/style/index.less +99 -99
  109. package/lib/live-control-v2/index.d.ts +3 -3
  110. package/lib/live-control-v2/index.js +141 -108
  111. package/lib/live-control-v2/index.js.map +1 -1
  112. package/lib/live-control-v2/style/css.js +7 -0
  113. package/lib/live-control-v2/style/css.js.map +1 -1
  114. package/lib/live-control-v2/style/index.js +7 -0
  115. package/lib/live-control-v2/style/index.js.map +1 -1
  116. package/lib/live-control-v2/style/index.less +192 -192
  117. package/lib/live-player/index.js +136 -95
  118. package/lib/live-player/index.js.map +1 -1
  119. package/lib/live-player/style/css.js +2 -0
  120. package/lib/live-player/style/css.js.map +1 -1
  121. package/lib/live-player/style/index.js +2 -0
  122. package/lib/live-player/style/index.js.map +1 -1
  123. package/lib/live-player/style/index.less +75 -75
  124. package/lib/player/index.d.ts +1 -1
  125. package/lib/player/index.js +244 -79
  126. package/lib/player/index.js.map +1 -1
  127. package/lib/rsl/PlayerManager.js +64 -18
  128. package/lib/rsl/PlayerManager.js.map +1 -1
  129. package/lib/typings/@vtx/utils/index.d.ts +28 -28
  130. package/lib/typings/h5player.d.ts +146 -146
  131. package/lib/typings/webrtcplayer.d.ts +56 -56
  132. package/lib/typings/wsplayer.d.ts +99 -99
  133. package/lib/utils/index.d.ts +1 -1
  134. package/lib/utils/index.js +91 -12
  135. package/lib/utils/index.js.map +1 -1
  136. package/lib/vite-env.d.ts +1 -1
  137. package/lib/vtxHls/PlayerManager.js +20 -6
  138. package/lib/vtxHls/PlayerManager.js.map +1 -1
  139. package/lib/vtxHls/WhepManager.js +72 -9
  140. package/lib/vtxHls/WhepManager.js.map +1 -1
  141. package/lib/webrtc/PlayerManager.js +41 -28
  142. package/lib/webrtc/PlayerManager.js.map +1 -1
  143. package/package.json +125 -125
@@ -1,9 +1,9 @@
1
1
  /// <reference types="react" />
2
2
  import { IChannel, IGetHistoryUrlParams, IHistoryControlProps, IHistoryControlV2Handle, IHistoryPlayInfoParams } from './interface';
3
- export type HistoryControlV2Handle = IHistoryControlV2Handle;
4
- export type HistoryPlayInfoParams = IHistoryPlayInfoParams;
5
- export type GetHistoryUrlParams = IGetHistoryUrlParams;
6
- export type Channel = IChannel;
3
+ export declare type HistoryControlV2Handle = IHistoryControlV2Handle;
4
+ export declare type HistoryPlayInfoParams = IHistoryPlayInfoParams;
5
+ export declare type GetHistoryUrlParams = IGetHistoryUrlParams;
6
+ export declare type Channel = IChannel;
7
7
  /**
8
8
  * 历史视频控制器
9
9
  */
@@ -1,45 +1,77 @@
1
1
  "use strict";
2
2
 
3
3
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports["default"] = exports.HistoryControlV2 = void 0;
9
+
8
10
  var _jsxRuntime = require("react/jsx-runtime");
11
+
9
12
  var _react = require("react");
13
+
10
14
  var _api = require("../api");
15
+
11
16
  var _splitScreen = _interopRequireWildcard(require("../components/split-screen"));
17
+
12
18
  var _videoScale = _interopRequireDefault(require("../components/video-scale"));
19
+
13
20
  var _icons = require("../icons");
21
+
14
22
  var _utils = require("../utils");
23
+
15
24
  var _icons2 = require("@ant-design/icons");
25
+
16
26
  var _ahooks = require("ahooks");
27
+
17
28
  var _space = _interopRequireDefault(require("antd/lib/space"));
29
+
18
30
  var _spin = _interopRequireDefault(require("antd/lib/spin"));
31
+
19
32
  var _gridItem = _interopRequireDefault(require("./components/grid-item"));
33
+
20
34
  var _panel = _interopRequireDefault(require("./components/panel"));
35
+
21
36
  var _context2 = require("./context");
37
+
22
38
  var _utils2 = require("./utils");
39
+
23
40
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
41
+
24
42
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
43
+
25
44
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
26
- 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 exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
45
+
46
+ 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 exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
47
+
27
48
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
49
+
28
50
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
51
+
29
52
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
53
+
30
54
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
55
+
31
56
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
57
+
32
58
  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."); }
59
+
33
60
  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); }
34
- 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; }
35
- function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
61
+
62
+ 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; }
63
+
64
+ 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; }
65
+
36
66
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
67
+
37
68
  var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
38
69
  function adopt(value) {
39
70
  return value instanceof P ? value : new P(function (resolve) {
40
71
  resolve(value);
41
72
  });
42
73
  }
74
+
43
75
  return new (P || (P = Promise))(function (resolve, reject) {
44
76
  function fulfilled(value) {
45
77
  try {
@@ -48,6 +80,7 @@ var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P
48
80
  reject(e);
49
81
  }
50
82
  }
83
+
51
84
  function rejected(value) {
52
85
  try {
53
86
  step(generator["throw"](value));
@@ -55,66 +88,79 @@ var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P
55
88
  reject(e);
56
89
  }
57
90
  }
91
+
58
92
  function step(result) {
59
93
  result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
60
94
  }
95
+
61
96
  step((generator = generator.apply(thisArg, _arguments || [])).next());
62
97
  });
63
98
  };
99
+
64
100
  /**
65
101
  * 历史视频控制器
66
102
  */
67
103
  var HistoryControlV2 = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
68
104
  var _props$width = props.width,
69
- width = _props$width === void 0 ? '100%' : _props$width,
70
- _props$height = props.height,
71
- height = _props$height === void 0 ? '100%' : _props$height,
72
- defaultGrid = props.defaultGrid,
73
- onExpandChange = props.onExpandChange,
74
- _onVideoClose = props.onVideoClose,
75
- onVideoCloseAll = props.onVideoCloseAll,
76
- _onScreenshot = props.onScreenshot,
77
- onPlayingChannelChange = props.onPlayingChannelChange,
78
- onTimeChange = props.onTimeChange;
105
+ width = _props$width === void 0 ? '100%' : _props$width,
106
+ _props$height = props.height,
107
+ height = _props$height === void 0 ? '100%' : _props$height,
108
+ defaultGrid = props.defaultGrid,
109
+ onExpandChange = props.onExpandChange,
110
+ _onVideoClose = props.onVideoClose,
111
+ onVideoCloseAll = props.onVideoCloseAll,
112
+ _onScreenshot = props.onScreenshot,
113
+ onPlayingChannelChange = props.onPlayingChannelChange,
114
+ onTimeChange = props.onTimeChange;
115
+
79
116
  var _useSetState = (0, _ahooks.useSetState)({
80
- expand: true,
81
- grid: defaultGrid || _utils2.DEFAULT_GRID,
82
- scale: '100%'
83
- }),
84
- _useSetState2 = _slicedToArray(_useSetState, 2),
85
- state = _useSetState2[0],
86
- setState = _useSetState2[1];
117
+ expand: true,
118
+ grid: defaultGrid || _utils2.DEFAULT_GRID,
119
+ scale: '100%'
120
+ }),
121
+ _useSetState2 = _slicedToArray(_useSetState, 2),
122
+ state = _useSetState2[0],
123
+ setState = _useSetState2[1];
124
+
87
125
  var _useState = (0, _react.useState)(_utils2.DEFAULT_CHANNELS),
88
- _useState2 = _slicedToArray(_useState, 2),
89
- channels = _useState2[0],
90
- setChannels = _useState2[1];
126
+ _useState2 = _slicedToArray(_useState, 2),
127
+ channels = _useState2[0],
128
+ setChannels = _useState2[1];
129
+
91
130
  var _useState3 = (0, _react.useState)(false),
92
- _useState4 = _slicedToArray(_useState3, 2),
93
- loading = _useState4[0],
94
- setLoading = _useState4[1];
131
+ _useState4 = _slicedToArray(_useState3, 2),
132
+ loading = _useState4[0],
133
+ setLoading = _useState4[1];
134
+
95
135
  var _useState5 = (0, _react.useState)(_utils2.DEFAULT_ACTIVE),
96
- _useState6 = _slicedToArray(_useState5, 2),
97
- activeIndex = _useState6[0],
98
- setActiveIndex = _useState6[1];
136
+ _useState6 = _slicedToArray(_useState5, 2),
137
+ activeIndex = _useState6[0],
138
+ setActiveIndex = _useState6[1];
139
+
99
140
  var _useState7 = (0, _react.useState)(-1),
100
- _useState8 = _slicedToArray(_useState7, 2),
101
- timeLinePosition = _useState8[0],
102
- setTimeLinePosition = _useState8[1];
103
- var panelRef = (0, _react.useRef)();
104
- // 全屏方法
141
+ _useState8 = _slicedToArray(_useState7, 2),
142
+ timeLinePosition = _useState8[0],
143
+ setTimeLinePosition = _useState8[1];
144
+
145
+ var panelRef = (0, _react.useRef)(); // 全屏方法
146
+
105
147
  var wrapRef = (0, _react.useRef)(null);
148
+
106
149
  var _useFullscreen = (0, _ahooks.useFullscreen)(wrapRef),
107
- _useFullscreen2 = _slicedToArray(_useFullscreen, 2),
108
- isFullscreen = _useFullscreen2[0],
109
- toggleFullscreen = _useFullscreen2[1].toggleFullscreen;
150
+ _useFullscreen2 = _slicedToArray(_useFullscreen, 2),
151
+ isFullscreen = _useFullscreen2[0],
152
+ toggleFullscreen = _useFullscreen2[1].toggleFullscreen;
153
+
110
154
  var _useRequest = (0, _ahooks.useRequest)(_api.getHistoryUrl, {
111
- manual: true
112
- }),
113
- runAsync = _useRequest.runAsync;
155
+ manual: true
156
+ }),
157
+ runAsync = _useRequest.runAsync;
158
+
114
159
  var _useRequest2 = (0, _ahooks.useRequest)(_api.getVideoLabelById, {
115
- manual: true
116
- }),
117
- getVideoLabelByIdAsync = _useRequest2.runAsync;
160
+ manual: true
161
+ }),
162
+ getVideoLabelByIdAsync = _useRequest2.runAsync;
163
+
118
164
  (0, _react.useImperativeHandle)(ref, function () {
119
165
  return {
120
166
  load: function load(channel) {
@@ -123,63 +169,75 @@ var HistoryControlV2 = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
123
169
  start: function start(playInfo) {
124
170
  return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
125
171
  var _a, _b, _c, result, labelRes, res, newChannels, resultChannel, channelIndex;
172
+
126
173
  return _regeneratorRuntime().wrap(function _callee$(_context) {
127
- while (1) switch (_context.prev = _context.next) {
128
- case 0:
129
- setLoading(true);
130
- result = playInfo;
131
- if (!playInfo.tagId) {
132
- _context.next = 10;
133
- break;
134
- }
135
- _context.next = 5;
136
- return getVideoLabelByIdAsync({
137
- id: playInfo.tagId
138
- });
139
- case 5:
140
- labelRes = _context.sent;
141
- result.deviceId = labelRes.videoDeviceId || playInfo.deviceId;
142
- result.channelNum = labelRes.videoChannelNum || playInfo.channelNum;
143
- result.beginTime = labelRes.startTime || playInfo.beginTime;
144
- result.endTime = labelRes.endTime || playInfo.endTime;
145
- case 10:
146
- _context.next = 12;
147
- return runAsync({
148
- deviceId: result.deviceId,
149
- channelNum: result.channelNum,
150
- beginTime: result.beginTime,
151
- endTime: result.endTime,
152
- protocol: result.protocol,
153
- token: (0, _utils.getUrlParam)('token')
154
- });
155
- case 12:
156
- res = _context.sent;
157
- newChannels = _toConsumableArray(channels);
158
- resultChannel = (_a = newChannels.filter(function (citem) {
159
- return citem.deviceId === res.deviceId && citem.channelNum === res.channelNum;
160
- })) === null || _a === void 0 ? void 0 : _a[0]; // 如果当前通道已经再里面了,则直接替换当前通道
161
- if (resultChannel) {
162
- newChannels[resultChannel.channelIndex] = Object.assign(Object.assign({}, newChannels[resultChannel.channelIndex]), {
163
- // 有tagId 则为-1 不然维持原有的
164
- index: playInfo.tagId ? -1 : newChannels[resultChannel.channelIndex].index,
165
- tagId: playInfo.tagId || '',
166
- startTime: result.beginTime,
167
- endTime: result.endTime
174
+ while (1) {
175
+ switch (_context.prev = _context.next) {
176
+ case 0:
177
+ setLoading(true);
178
+ result = playInfo;
179
+
180
+ if (!playInfo.tagId) {
181
+ _context.next = 10;
182
+ break;
183
+ }
184
+
185
+ _context.next = 5;
186
+ return getVideoLabelByIdAsync({
187
+ id: playInfo.tagId
168
188
  });
169
- } else {
170
- // 如果当前通道不在里面 则找到第一个channelNum为''的替换
171
- channelIndex = (_c = (_b = newChannels.filter(function (item) {
172
- return item.channelNum === '';
173
- })) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.channelIndex;
174
- if (typeof channelIndex == 'number') {
175
- newChannels[channelIndex] = Object.assign(Object.assign({}, newChannels[channelIndex]), (0, _utils2.getChannelData)(res, result));
189
+
190
+ case 5:
191
+ labelRes = _context.sent;
192
+ result.deviceId = labelRes.videoDeviceId || playInfo.deviceId;
193
+ result.channelNum = labelRes.videoChannelNum || playInfo.channelNum;
194
+ result.beginTime = labelRes.startTime || playInfo.beginTime;
195
+ result.endTime = labelRes.endTime || playInfo.endTime;
196
+
197
+ case 10:
198
+ _context.next = 12;
199
+ return runAsync({
200
+ deviceId: result.deviceId,
201
+ channelNum: result.channelNum,
202
+ beginTime: result.beginTime,
203
+ endTime: result.endTime,
204
+ protocol: result.protocol,
205
+ token: (0, _utils.getUrlParam)('token')
206
+ });
207
+
208
+ case 12:
209
+ res = _context.sent;
210
+ newChannels = _toConsumableArray(channels);
211
+ resultChannel = (_a = newChannels.filter(function (citem) {
212
+ return citem.deviceId === res.deviceId && citem.channelNum === res.channelNum;
213
+ })) === null || _a === void 0 ? void 0 : _a[0]; // 如果当前通道已经再里面了,则直接替换当前通道
214
+
215
+ if (resultChannel) {
216
+ newChannels[resultChannel.channelIndex] = Object.assign(Object.assign({}, newChannels[resultChannel.channelIndex]), {
217
+ // 有tagId 则为-1 不然维持原有的
218
+ index: playInfo.tagId ? -1 : newChannels[resultChannel.channelIndex].index,
219
+ tagId: playInfo.tagId || '',
220
+ startTime: result.beginTime,
221
+ endTime: result.endTime
222
+ });
223
+ } else {
224
+ // 如果当前通道不在里面 则找到第一个channelNum为''的替换
225
+ channelIndex = (_c = (_b = newChannels.filter(function (item) {
226
+ return item.channelNum === '';
227
+ })) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.channelIndex;
228
+
229
+ if (typeof channelIndex == 'number') {
230
+ newChannels[channelIndex] = Object.assign(Object.assign({}, newChannels[channelIndex]), (0, _utils2.getChannelData)(res, result));
231
+ }
176
232
  }
177
- }
178
- setChannels(newChannels);
179
- setLoading(false);
180
- case 18:
181
- case "end":
182
- return _context.stop();
233
+
234
+ setChannels(newChannels);
235
+ setLoading(false);
236
+
237
+ case 18:
238
+ case "end":
239
+ return _context.stop();
240
+ }
183
241
  }
184
242
  }, _callee);
185
243
  }));
@@ -187,12 +245,14 @@ var HistoryControlV2 = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
187
245
  unLoadAll: handleCloseAll
188
246
  };
189
247
  });
248
+
190
249
  var handleExpand = function handleExpand() {
191
250
  onExpandChange && onExpandChange(!state.expand);
192
251
  setState({
193
252
  expand: !state.expand
194
253
  });
195
254
  };
255
+
196
256
  var handleCloseAll = function handleCloseAll() {
197
257
  // const realChannels = channels.filter((item) => item.channelNum !== '');
198
258
  // realChannels.map((item) => {
@@ -201,8 +261,10 @@ var HistoryControlV2 = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
201
261
  onVideoCloseAll();
202
262
  setChannels(_utils2.DEFAULT_CHANNELS);
203
263
  };
264
+
204
265
  var getGridItems = function getGridItems() {
205
266
  var items = [];
267
+
206
268
  var _loop = function _loop(i) {
207
269
  var element = (0, _jsxRuntime.jsx)(_gridItem["default"], {
208
270
  active: activeIndex === i,
@@ -214,7 +276,9 @@ var HistoryControlV2 = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
214
276
  channel: channels[i],
215
277
  onClose: function onClose() {
216
278
  var _a;
279
+
217
280
  var newChannels = _toConsumableArray(channels);
281
+
218
282
  newChannels[i].index = -1;
219
283
  newChannels[i].deviceName = '';
220
284
  newChannels[i].deviceId = '';
@@ -240,11 +304,14 @@ var HistoryControlV2 = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
240
304
  }, i);
241
305
  items.push(element);
242
306
  };
307
+
243
308
  for (var i = 0; i < Number(state.grid); i++) {
244
309
  _loop(i);
245
310
  }
311
+
246
312
  return items;
247
313
  };
314
+
248
315
  var store = {
249
316
  channels: channels,
250
317
  setChannels: setChannels,
@@ -265,9 +332,11 @@ var HistoryControlV2 = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
265
332
  }).length) || 1
266
333
  });
267
334
  }
335
+
268
336
  var realChannels = channels.filter(function (item) {
269
337
  return item.channelNum !== '';
270
338
  });
339
+
271
340
  if (typeof onPlayingChannelChange === 'function') {
272
341
  onPlayingChannelChange(realChannels);
273
342
  }