@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,35 +1,57 @@
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.HistoryPlayer = void 0;
9
+
8
10
  var _jsxRuntime = require("react/jsx-runtime");
11
+
9
12
  var _react = require("react");
13
+
10
14
  var _controls = require("../controls");
15
+
11
16
  var _api = _interopRequireDefault(require("../icc/api"));
17
+
12
18
  var _icons = require("../icons");
19
+
13
20
  var _player = _interopRequireDefault(require("../player"));
21
+
14
22
  var _utils = require("../utils");
23
+
15
24
  var _ahooks = require("ahooks");
25
+
16
26
  var _slider = _interopRequireDefault(require("antd/lib/slider"));
27
+
17
28
  var _space = _interopRequireDefault(require("antd/lib/space"));
29
+
18
30
  var _moment = _interopRequireDefault(require("moment"));
31
+
19
32
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
20
- 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; }
33
+
34
+ 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; }
35
+
21
36
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
37
+
22
38
  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."); }
39
+
23
40
  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); }
24
- 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; }
25
- 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; } }
41
+
42
+ 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; }
43
+
44
+ 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; }
45
+
26
46
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
47
+
27
48
  var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
28
49
  function adopt(value) {
29
50
  return value instanceof P ? value : new P(function (resolve) {
30
51
  resolve(value);
31
52
  });
32
53
  }
54
+
33
55
  return new (P || (P = Promise))(function (resolve, reject) {
34
56
  function fulfilled(value) {
35
57
  try {
@@ -38,6 +60,7 @@ var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P
38
60
  reject(e);
39
61
  }
40
62
  }
63
+
41
64
  function rejected(value) {
42
65
  try {
43
66
  step(generator["throw"](value));
@@ -45,75 +68,79 @@ var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P
45
68
  reject(e);
46
69
  }
47
70
  }
71
+
48
72
  function step(result) {
49
73
  result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
50
74
  }
75
+
51
76
  step((generator = generator.apply(thisArg, _arguments || [])).next());
52
77
  });
53
78
  };
54
79
 
55
- // import { Slider, Space } from 'antd';
56
-
57
80
  var HistoryPlayer = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
58
81
  var url = props.url,
59
- deviceId = props.deviceId,
60
- deviceIp = props.deviceIp,
61
- devicePort = props.devicePort,
62
- channelNum = props.channelNum,
63
- deviceCode = props.deviceCode,
64
- streamType = props.streamType,
65
- type = props.type,
66
- enableAgent = props.enableAgent,
67
- _props$width = props.width,
68
- width = _props$width === void 0 ? '100%' : _props$width,
69
- _props$height = props.height,
70
- height = _props$height === void 0 ? '100%' : _props$height,
71
- captureName = props.captureName,
72
- _props$controlBottom = props.controlBottom,
73
- controlBottom = _props$controlBottom === void 0 ? 0 : _props$controlBottom,
74
- startTime = props.startTime,
75
- endTime = props.endTime,
76
- onTimeChange = props.onTimeChange,
77
- screenshot = props.screenshot,
78
- _props$showInfo = props.showInfo,
79
- showInfo = _props$showInfo === void 0 ? false : _props$showInfo,
80
- _props$info = props.info,
81
- info = _props$info === void 0 ? [] : _props$info,
82
- extraButton = props.extraButton,
83
- _props$controlVisible = props.controlVisible,
84
- controlVisible = _props$controlVisible === void 0 ? undefined : _props$controlVisible;
82
+ deviceId = props.deviceId,
83
+ deviceIp = props.deviceIp,
84
+ devicePort = props.devicePort,
85
+ channelNum = props.channelNum,
86
+ deviceCode = props.deviceCode,
87
+ streamType = props.streamType,
88
+ type = props.type,
89
+ enableAgent = props.enableAgent,
90
+ _props$width = props.width,
91
+ width = _props$width === void 0 ? '100%' : _props$width,
92
+ _props$height = props.height,
93
+ height = _props$height === void 0 ? '100%' : _props$height,
94
+ captureName = props.captureName,
95
+ _props$controlBottom = props.controlBottom,
96
+ controlBottom = _props$controlBottom === void 0 ? 0 : _props$controlBottom,
97
+ startTime = props.startTime,
98
+ endTime = props.endTime,
99
+ onTimeChange = props.onTimeChange,
100
+ screenshot = props.screenshot,
101
+ _props$showInfo = props.showInfo,
102
+ showInfo = _props$showInfo === void 0 ? false : _props$showInfo,
103
+ _props$info = props.info,
104
+ info = _props$info === void 0 ? [] : _props$info,
105
+ extraButton = props.extraButton,
106
+ _props$controlVisible = props.controlVisible,
107
+ controlVisible = _props$controlVisible === void 0 ? undefined : _props$controlVisible;
85
108
  var vRef = (0, _react.useRef)(null);
86
109
  var totalTime = (0, _moment["default"])(endTime).diff((0, _moment["default"])(startTime), 'seconds');
87
110
  var containerRef = (0, _react.useRef)(null);
88
111
  var wrapRef = (0, _react.useRef)(null);
89
112
  var controlsRef = (0, _react.useRef)(null);
90
113
  var playerRef = (0, _react.useRef)();
114
+
91
115
  var _useFullscreen = (0, _ahooks.useFullscreen)(wrapRef),
92
- _useFullscreen2 = _slicedToArray(_useFullscreen, 2),
93
- isFullscreen = _useFullscreen2[0],
94
- toggleFullscreen = _useFullscreen2[1].toggleFullscreen;
116
+ _useFullscreen2 = _slicedToArray(_useFullscreen, 2),
117
+ isFullscreen = _useFullscreen2[0],
118
+ toggleFullscreen = _useFullscreen2[1].toggleFullscreen;
119
+
95
120
  var _useSetState = (0, _ahooks.useSetState)({
96
- play: false,
97
- error: false,
98
- loading: false,
99
- id: 'vtx_hk_player_' + (0, _utils.guidGenerator)(),
100
- volume: 0,
101
- currentTime: '',
102
- progress: 0,
103
- progress2: 0,
104
- controls: {
105
- progress: true
106
- },
107
- progressVisible: true,
108
- speedVisible: true
109
- }),
110
- _useSetState2 = _slicedToArray(_useSetState, 2),
111
- state = _useSetState2[0],
112
- setState = _useSetState2[1];
121
+ play: false,
122
+ error: false,
123
+ loading: false,
124
+ id: 'vtx_hk_player_' + (0, _utils.guidGenerator)(),
125
+ volume: 0,
126
+ currentTime: '',
127
+ progress: 0,
128
+ progress2: 0,
129
+ controls: {
130
+ progress: true
131
+ },
132
+ progressVisible: true,
133
+ speedVisible: true
134
+ }),
135
+ _useSetState2 = _slicedToArray(_useSetState, 2),
136
+ state = _useSetState2[0],
137
+ setState = _useSetState2[1];
138
+
113
139
  (0, _react.useImperativeHandle)(ref, function () {
114
140
  return {
115
141
  seekTo: function seekTo(time) {
116
142
  var player = playerRef.current;
143
+
117
144
  if (player) {
118
145
  var currentTime = (0, _moment["default"])(time).diff((0, _moment["default"])(startTime), 'seconds');
119
146
  return player.seekTo(currentTime);
@@ -125,122 +152,137 @@ var HistoryPlayer = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
125
152
  });
126
153
  (0, _react.useEffect)(function () {
127
154
  var container = containerRef.current;
155
+
128
156
  if (vRef.current) {
129
157
  clearInterval(vRef.current);
130
158
  vRef.current = null;
131
159
  }
160
+
132
161
  if (!url || !container) return;
133
162
  var player = null;
163
+
134
164
  (function () {
135
165
  return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
136
166
  var token;
137
167
  return _regeneratorRuntime().wrap(function _callee$(_context) {
138
- while (1) switch (_context.prev = _context.next) {
139
- case 0:
140
- if (!(type === 'bd')) {
168
+ while (1) {
169
+ switch (_context.prev = _context.next) {
170
+ case 0:
171
+ if (!(type === 'bd')) {
172
+ _context.next = 3;
173
+ break;
174
+ }
175
+
141
176
  _context.next = 3;
142
- break;
143
- }
144
- _context.next = 3;
145
- return new Promise(function (resolve) {
146
- setTimeout(function () {
147
- return resolve('');
148
- }, 2000);
149
- });
150
- case 3:
151
- if (!(type === 'icc_ws')) {
152
- _context.next = 8;
153
- break;
154
- }
155
- _context.next = 6;
156
- return _api["default"].getToken({
157
- deviceId: deviceId
158
- });
159
- case 6:
160
- token = _context.sent;
161
- localStorage.setItem('accessToken', token);
162
- case 8:
163
- _context.next = 10;
164
- return new _player["default"]({
165
- url: url,
166
- devicePort: devicePort,
167
- deviceIp: deviceIp,
168
- channelNum: channelNum,
169
- deviceCode: deviceCode,
170
- deviceId: deviceId,
171
- streamType: streamType,
172
- enableAgent: enableAgent,
173
- container: container,
174
- live: false,
175
- startTime: startTime,
176
- endTime: endTime,
177
- type: type
178
- });
179
- case 10:
180
- player = _context.sent;
181
- playerRef.current = player;
182
- _context.next = 14;
183
- return setState({
184
- loading: true,
185
- error: false,
186
- progress: 0,
187
- controls: {
188
- progress: player.type === 'hk_ws' || player.type === 'hkcar_ws'
189
- },
190
- progressVisible: player.type !== 'bd',
191
- speedVisible: player.type !== 'bd'
192
- });
193
- case 14:
194
- player.playBack().then(function () {
195
- setState({
196
- play: true,
197
- currentTime: (0, _moment["default"])(startTime).format(_utils.TimeFormat.params)
177
+ return new Promise(function (resolve) {
178
+ setTimeout(function () {
179
+ return resolve('');
180
+ }, 2000);
198
181
  });
199
- var i = 1;
200
- vRef.current = setInterval(function () {
201
- // 当时间大于等于结束时间时重置
202
- if ((0, _moment["default"])(startTime).add(i, 's').unix() >= (0, _moment["default"])(endTime).unix()) {
203
- clearInterval(vRef.current);
204
- vRef.current = null;
205
- setState({
206
- currentTime: '',
207
- progress: 0
208
- });
209
- } else {
210
- i++;
211
- if (!state.loading) {
212
- setState({
213
- currentTime: (0, _moment["default"])(startTime).add(i, 's').format(_utils.TimeFormat.params),
214
- progress: Math.floor(i * 100 / totalTime)
215
- });
216
- }
217
- }
218
- }, 1000);
219
- })["catch"](function () {
220
- return setState({
221
- error: true
182
+
183
+ case 3:
184
+ if (!(type === 'icc_ws')) {
185
+ _context.next = 8;
186
+ break;
187
+ }
188
+
189
+ _context.next = 6;
190
+ return _api["default"].getToken({
191
+ deviceId: deviceId
192
+ });
193
+
194
+ case 6:
195
+ token = _context.sent;
196
+ localStorage.setItem('accessToken', token);
197
+
198
+ case 8:
199
+ _context.next = 10;
200
+ return new _player["default"]({
201
+ url: url,
202
+ devicePort: devicePort,
203
+ deviceIp: deviceIp,
204
+ channelNum: channelNum,
205
+ deviceCode: deviceCode,
206
+ deviceId: deviceId,
207
+ streamType: streamType,
208
+ enableAgent: enableAgent,
209
+ container: container,
210
+ live: false,
211
+ startTime: startTime,
212
+ endTime: endTime,
213
+ type: type
222
214
  });
223
- })["finally"](function () {
215
+
216
+ case 10:
217
+ player = _context.sent;
218
+ playerRef.current = player;
219
+ _context.next = 14;
224
220
  return setState({
225
- loading: false
221
+ loading: true,
222
+ error: false,
223
+ progress: 0,
224
+ controls: {
225
+ progress: player.type === 'hk_ws' || player.type === 'hkcar_ws'
226
+ },
227
+ progressVisible: player.type !== 'bd',
228
+ speedVisible: player.type !== 'bd'
226
229
  });
227
- });
228
- player.onTimeUpdate(function (_currentTime, speed) {
229
- if (!state.loading) {
230
+
231
+ case 14:
232
+ player.playBack().then(function () {
230
233
  setState({
231
- // currentTime: Math.floor(_currentTime),
232
- // progress: Math.floor((_currentTime / totalTime) * 100),
233
- speed: speed
234
+ play: true,
235
+ currentTime: (0, _moment["default"])(startTime).format(_utils.TimeFormat.params)
234
236
  });
235
- }
236
- });
237
- case 16:
238
- case "end":
239
- return _context.stop();
237
+ var i = 1;
238
+ vRef.current = setInterval(function () {
239
+ // 当时间大于等于结束时间时重置
240
+ if ((0, _moment["default"])(startTime).add(i, 's').unix() >= (0, _moment["default"])(endTime).unix()) {
241
+ clearInterval(vRef.current);
242
+ vRef.current = null;
243
+ setState({
244
+ currentTime: '',
245
+ progress: 0
246
+ });
247
+ } else {
248
+ i++;
249
+
250
+ if (!state.loading) {
251
+ setState({
252
+ currentTime: (0, _moment["default"])(startTime).add(i, 's').format(_utils.TimeFormat.params),
253
+ progress: Math.floor(i * 100 / totalTime)
254
+ });
255
+ }
256
+ }
257
+ }, 1000);
258
+ })["catch"](function () {
259
+ return setState({
260
+ error: true
261
+ });
262
+ })["finally"](function () {
263
+ return setState({
264
+ loading: false
265
+ });
266
+ });
267
+ player.onTimeUpdate(function (_currentTime, speed) {
268
+ if (!state.loading) {
269
+ setState({
270
+ // currentTime: Math.floor(_currentTime),
271
+ // progress: Math.floor((_currentTime / totalTime) * 100),
272
+ speed: speed
273
+ });
274
+ }
275
+ });
276
+
277
+ case 16:
278
+ case "end":
279
+ return _context.stop();
280
+ }
240
281
  }
241
282
  }, _callee);
242
283
  }));
243
284
  })();
285
+
244
286
  return function () {
245
287
  player.destroy();
246
288
  setState({
@@ -248,6 +290,7 @@ var HistoryPlayer = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
248
290
  loading: false,
249
291
  play: false
250
292
  });
293
+
251
294
  if (vRef.current) {
252
295
  clearInterval(vRef.current);
253
296
  vRef.current = null;
@@ -271,24 +314,35 @@ var HistoryPlayer = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
271
314
  });
272
315
  }, [endProgress]);
273
316
  /** 截图方法 */
317
+
274
318
  var handleCapture = function handleCapture(e) {
275
319
  var player = playerRef.current;
276
320
  player && player.capture(captureName, screenshot);
277
321
  e.stopPropagation();
278
322
  };
279
323
  /** 全屏方法 */
324
+
325
+
280
326
  var handleFullScreen = function handleFullScreen(e) {
281
327
  toggleFullscreen();
282
328
  var player = playerRef.current;
283
329
  player && player.resize();
284
330
  e.stopPropagation();
285
331
  };
332
+
333
+ (0, _react.useEffect)(function () {
334
+ console.log(width, height);
335
+ var player = playerRef.current;
336
+ player && player.resize();
337
+ }, [width, height]);
286
338
  /** 进度条控制器 */
339
+
287
340
  var handleSlider = function handleSlider(value) {
288
341
  if (vRef.current) {
289
342
  clearInterval(vRef.current);
290
343
  vRef.current = null;
291
344
  }
345
+
292
346
  var currentTime = Math.floor(totalTime * value / 100);
293
347
  setState({
294
348
  progress2: value,
@@ -313,6 +367,8 @@ var HistoryPlayer = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
313
367
  }, 1000);
314
368
  };
315
369
  /** 暂停方法 */
370
+
371
+
316
372
  var handlePause = function handlePause() {
317
373
  var player = playerRef.current;
318
374
  player === null || player === void 0 ? void 0 : player.pause(function () {
@@ -320,12 +376,15 @@ var HistoryPlayer = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
320
376
  play: false
321
377
  });
322
378
  });
379
+
323
380
  if (vRef.current) {
324
381
  clearInterval(vRef.current);
325
382
  vRef.current = null;
326
383
  }
327
384
  };
328
385
  /** 恢复播放方法 */
386
+
387
+
329
388
  var handleResume = function handleResume() {
330
389
  var player = playerRef.current;
331
390
  player === null || player === void 0 ? void 0 : player.resume(function () {
@@ -333,13 +392,16 @@ var HistoryPlayer = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
333
392
  play: true
334
393
  });
335
394
  });
395
+
336
396
  if (vRef.current) {
337
397
  clearInterval(vRef.current);
338
398
  vRef.current = null;
339
399
  }
400
+
340
401
  if (type === 'bd') {
341
402
  return;
342
403
  }
404
+
343
405
  var i = 2;
344
406
  vRef.current = setInterval(function () {
345
407
  if ((0, _moment["default"])(state.currentTime).unix() + i >= (0, _moment["default"])(endTime).unix()) {
@@ -350,6 +412,7 @@ var HistoryPlayer = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
350
412
  progress: 0
351
413
  });
352
414
  }
415
+
353
416
  if (!state.loading) {
354
417
  setState({
355
418
  currentTime: (0, _moment["default"])(state.currentTime).add(i, 's').format(_utils.TimeFormat.params),
@@ -359,6 +422,7 @@ var HistoryPlayer = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
359
422
  }
360
423
  }, 1000);
361
424
  };
425
+
362
426
  return (0, _jsxRuntime.jsxs)("div", Object.assign({
363
427
  className: "vtx-history-player",
364
428
  ref: wrapRef,