@vtx/player 1.7.13 → 1.7.14

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 +62 -91
  3. package/lib/api/fetch.js.map +1 -1
  4. package/lib/api/index.js +18 -63
  5. package/lib/api/index.js.map +1 -1
  6. package/lib/api/types.d.ts +5 -5
  7. package/lib/bd/PlayerManager.js +38 -68
  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 +66 -121
  11. package/lib/bill-player/index.js.map +1 -1
  12. package/lib/bill-player/style/css.js +0 -9
  13. package/lib/bill-player/style/css.js.map +1 -1
  14. package/lib/bill-player/style/index.js +0 -9
  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 +6 -34
  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 +3 -14
  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 +10 -38
  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 +2 -9
  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 +0 -4
  38. package/lib/context/index.js.map +1 -1
  39. package/lib/controls/index.d.ts +11 -11
  40. package/lib/controls/index.js +34 -99
  41. package/lib/controls/index.js.map +1 -1
  42. package/lib/controls/style/css.js +0 -5
  43. package/lib/controls/style/css.js.map +1 -1
  44. package/lib/controls/style/index.js +0 -5
  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 +18 -27
  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 +61 -121
  51. package/lib/history-control/index.js.map +1 -1
  52. package/lib/history-control/style/css.js +0 -6
  53. package/lib/history-control/style/css.js.map +1 -1
  54. package/lib/history-control/style/index.js +0 -6
  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 +38 -77
  58. package/lib/history-control-v2/components/grid-item/index.js.map +1 -1
  59. package/lib/history-control-v2/components/panel/index.js +44 -114
  60. package/lib/history-control-v2/components/panel/index.js.map +1 -1
  61. package/lib/history-control-v2/context.js +0 -2
  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 +97 -166
  65. package/lib/history-control-v2/index.js.map +1 -1
  66. package/lib/history-control-v2/style/css.js +0 -10
  67. package/lib/history-control-v2/style/css.js.map +1 -1
  68. package/lib/history-control-v2/style/index.js +0 -10
  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 +1 -21
  72. package/lib/history-control-v2/utils.js.map +1 -1
  73. package/lib/history-player/index.d.ts +1 -1
  74. package/lib/history-player/index.js +146 -205
  75. package/lib/history-player/index.js.map +1 -1
  76. package/lib/history-player/style/css.js +0 -3
  77. package/lib/history-player/style/css.js.map +1 -1
  78. package/lib/history-player/style/index.js +0 -3
  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 +1 -6
  82. package/lib/hooks/useSettings.js.map +1 -1
  83. package/lib/icc/PlayerManager.js +26 -57
  84. package/lib/icc/PlayerManager.js.map +1 -1
  85. package/lib/icc/api.d.ts +0 -68
  86. package/lib/icc/api.js +2 -16
  87. package/lib/icc/api.js.map +1 -1
  88. package/lib/icons/index.d.ts +36 -36
  89. package/lib/icons/index.js +23 -171
  90. package/lib/icons/index.js.map +1 -1
  91. package/lib/icons/index.less +32 -32
  92. package/lib/index.js +0 -10
  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 +31 -67
  96. package/lib/live-channel-player/index.js.map +1 -1
  97. package/lib/live-channel-player/style/css.js +0 -1
  98. package/lib/live-channel-player/style/css.js.map +1 -1
  99. package/lib/live-channel-player/style/index.js +0 -1
  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 +35 -86
  103. package/lib/live-control/index.js.map +1 -1
  104. package/lib/live-control/style/css.js +0 -4
  105. package/lib/live-control/style/css.js.map +1 -1
  106. package/lib/live-control/style/index.js +0 -4
  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 +108 -141
  111. package/lib/live-control-v2/index.js.map +1 -1
  112. package/lib/live-control-v2/style/css.js +0 -7
  113. package/lib/live-control-v2/style/css.js.map +1 -1
  114. package/lib/live-control-v2/style/index.js +0 -7
  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 +95 -136
  118. package/lib/live-player/index.js.map +1 -1
  119. package/lib/live-player/style/css.js +0 -2
  120. package/lib/live-player/style/css.js.map +1 -1
  121. package/lib/live-player/style/index.js +0 -2
  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 +79 -244
  126. package/lib/player/index.js.map +1 -1
  127. package/lib/rsl/PlayerManager.js +18 -64
  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 +12 -91
  135. package/lib/utils/index.js.map +1 -1
  136. package/lib/vite-env.d.ts +1 -1
  137. package/lib/vtxHls/PlayerManager.js +6 -20
  138. package/lib/vtxHls/PlayerManager.js.map +1 -1
  139. package/lib/vtxHls/WhepManager.js +9 -72
  140. package/lib/vtxHls/WhepManager.js.map +1 -1
  141. package/lib/webrtc/PlayerManager.js +28 -41
  142. package/lib/webrtc/PlayerManager.js.map +1 -1
  143. package/package.json +125 -125
@@ -1,51 +1,34 @@
1
1
  "use strict";
2
2
 
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
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
6
  exports["default"] = void 0;
9
-
10
7
  var _PlayerManager = _interopRequireDefault(require("../bd/PlayerManager"));
11
-
12
8
  var _PlayerManager2 = _interopRequireDefault(require("../h264/PlayerManager"));
13
-
14
9
  var _PlayerManager3 = _interopRequireDefault(require("../icc/PlayerManager"));
15
-
16
10
  var _PlayerManager4 = _interopRequireDefault(require("../rsl/PlayerManager"));
17
-
18
11
  var _utils = require("../utils");
19
-
20
12
  var _PlayerManager5 = _interopRequireDefault(require("../vtxHls/PlayerManager"));
21
-
22
13
  var _WhepManager = _interopRequireDefault(require("../vtxHls/WhepManager"));
23
-
24
14
  var _PlayerManager6 = _interopRequireDefault(require("../webrtc/PlayerManager"));
25
-
26
15
  var _flv = _interopRequireDefault(require("flv.js"));
27
-
28
16
  var _hls = _interopRequireDefault(require("hls.js"));
29
-
30
17
  var _moment = _interopRequireDefault(require("moment"));
31
-
32
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
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
-
19
+ 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); }
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; }
36
21
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
37
-
38
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
39
-
22
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
40
23
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
41
-
24
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
25
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
42
26
  var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
43
27
  function adopt(value) {
44
28
  return value instanceof P ? value : new P(function (resolve) {
45
29
  resolve(value);
46
30
  });
47
31
  }
48
-
49
32
  return new (P || (P = Promise))(function (resolve, reject) {
50
33
  function fulfilled(value) {
51
34
  try {
@@ -54,7 +37,6 @@ var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P
54
37
  reject(e);
55
38
  }
56
39
  }
57
-
58
40
  function rejected(value) {
59
41
  try {
60
42
  step(generator["throw"](value));
@@ -62,115 +44,95 @@ var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P
62
44
  reject(e);
63
45
  }
64
46
  }
65
-
66
47
  function step(result) {
67
48
  result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
68
49
  }
69
-
70
50
  step((generator = generator.apply(thisArg, _arguments || [])).next());
71
51
  });
72
52
  };
73
-
74
53
  /**
75
54
  * 视频播放核心类
76
55
  */
77
56
  var Player = /*#__PURE__*/function () {
78
57
  function Player(params) {
79
58
  _classCallCheck(this, Player);
80
-
81
59
  var _a, _b, _c, _d, _e;
82
-
83
60
  this.player = null;
84
61
  /** 之前的视频播放速度,用于处理海康音量控制 */
85
-
86
62
  this.preSpeed = 1;
87
- this.containerId = ''; // 海康窗口下标
88
-
63
+ this.containerId = '';
64
+ // 海康窗口下标
89
65
  this.windowIndex = 0;
90
66
  /** 视频播放流是否走代理 - 是强制走代理,否通过判断 http协议,走代理配置 */
91
-
92
67
  var url = params.url,
93
- channelNum = params.channelNum,
94
- deviceCode = params.deviceCode,
95
- _params$enableAgent = params.enableAgent,
96
- enableAgent = _params$enableAgent === void 0 ? false : _params$enableAgent,
97
- container = params.container,
98
- _params$live = params.live,
99
- live = _params$live === void 0 ? true : _params$live,
100
- type = params.type,
101
- startTime = params.startTime,
102
- endTime = params.endTime,
103
- streamType = params.streamType,
104
- deviceIp = params.deviceIp,
105
- devicePort = params.devicePort;
68
+ channelNum = params.channelNum,
69
+ deviceCode = params.deviceCode,
70
+ _params$enableAgent = params.enableAgent,
71
+ enableAgent = _params$enableAgent === void 0 ? false : _params$enableAgent,
72
+ container = params.container,
73
+ _params$live = params.live,
74
+ live = _params$live === void 0 ? true : _params$live,
75
+ type = params.type,
76
+ startTime = params.startTime,
77
+ endTime = params.endTime,
78
+ streamType = params.streamType,
79
+ deviceIp = params.deviceIp,
80
+ devicePort = params.devicePort;
106
81
  this.containerId = container.id;
107
82
  var playerParams = (0, _utils.getPlayerParams)(type, url, enableAgent, live);
108
83
  this.type = type || playerParams.type; // 如果不传递type,则通过url解析type值,1.1.2之后默认都传type
109
-
110
84
  this.url = playerParams.url;
111
85
  this.channelNum = channelNum;
112
86
  this.deviceCode = deviceCode || '';
113
87
  this.streamType = streamType || '0'; // 默认主码流
114
-
115
88
  this.enableAgent = enableAgent;
116
89
  this.startTime = startTime;
117
90
  this.endTime = endTime;
118
91
  var video = document.createElement('video'); // 生成video元素
119
-
120
92
  video.className = 'vtx-player-video';
121
93
  video.muted = true; //设置静音
122
-
123
94
  this.video = video;
124
-
125
95
  if (this.type === 'flv' && _flv["default"].isSupported() && video) {
126
96
  container.appendChild(video);
127
97
  this.player = _flv["default"].createPlayer({
128
98
  type: 'flv',
129
99
  isLive: false,
130
- url: this.url
100
+ url: this.url.replace("SZGJ_HTTPS", "".concat(window.location.host))
131
101
  });
132
102
  this.player.attachMediaElement(this.video);
133
103
  this.player.load();
134
- } // 处理hls格式视频
135
-
136
-
104
+ }
105
+ // 处理hls格式视频
137
106
  if (this.type === 'hls' && _hls["default"].isSupported() && video) {
138
107
  container.appendChild(video);
139
108
  this.player = new _hls["default"]();
140
109
  this.player.loadSource(this.url);
141
110
  this.player.attachMedia(this.video);
142
111
  }
143
-
144
112
  if (this.type === 'vtxhls' && _hls["default"].isSupported() && video) {
145
113
  var dd = document.getElementById(container.id);
146
-
147
114
  while (dd === null || dd === void 0 ? void 0 : dd.hasChildNodes()) {
148
115
  dd.removeChild(dd.firstChild);
149
116
  }
150
-
151
117
  container.appendChild(video);
152
118
  this.player = new _PlayerManager5["default"]({
153
119
  url: this.url,
154
120
  video: video
155
121
  });
156
122
  }
157
-
158
123
  if (this.type === 'vtxwhep' && video) {
159
124
  var _dd = document.getElementById(container.id);
160
-
161
125
  while (_dd === null || _dd === void 0 ? void 0 : _dd.hasChildNodes()) {
162
126
  _dd.removeChild(_dd.firstChild);
163
127
  }
164
-
165
128
  this.video.autoplay = true;
166
129
  container.appendChild(this.video);
167
130
  this.player = new _WhepManager["default"]({
168
131
  url: this.url,
169
132
  video: this.video
170
133
  });
171
- } // 处理海康视频
172
-
173
-
134
+ }
135
+ // 处理海康视频
174
136
  if (this.type === 'hk_ws') {
175
137
  this.player = new window.JSPlugin({
176
138
  szId: container.id,
@@ -181,12 +143,10 @@ var Player = /*#__PURE__*/function () {
181
143
  var wrapDiv = document.getElementById(container.id);
182
144
  this.video = wrapDiv.getElementsByTagName('video')[0];
183
145
  this.video.preload = 'auto';
184
- } // 处理海康视频
185
-
186
-
146
+ }
147
+ // 处理海康视频
187
148
  if (this.type === 'hkcar_ws' && (url.startsWith('ws://') || url.startsWith('wss://'))) {
188
149
  var _wrapDiv = document.getElementById(container.id);
189
-
190
150
  this.player = new window.JSPluginHkCar({
191
151
  szId: container.id,
192
152
  iWidth: _wrapDiv.clientWidth,
@@ -200,9 +160,8 @@ var Player = /*#__PURE__*/function () {
200
160
  background: '#2b3d51'
201
161
  }
202
162
  });
203
- } // 处理ws视频
204
-
205
-
163
+ }
164
+ // 处理ws视频
206
165
  if (this.type === 'vtx_ws') {
207
166
  var $container = document.getElementById(container.id);
208
167
  this.player = new window.Jessibuca({
@@ -217,17 +176,14 @@ var Player = /*#__PURE__*/function () {
217
176
  useWCS: false,
218
177
  autoWasm: true,
219
178
  isNotMute: true //是否开启声音
220
-
221
179
  });
222
180
  }
223
181
 
224
182
  if (this.type === 'icc_ws') {
225
183
  var _dd2 = document.getElementById(container.id);
226
-
227
184
  while (_dd2 === null || _dd2 === void 0 ? void 0 : _dd2.hasChildNodes()) {
228
185
  _dd2.removeChild(_dd2.firstChild);
229
186
  }
230
-
231
187
  this.player = new _PlayerManager3["default"]({
232
188
  ip: window.location.protocol === 'http:' ? deviceIp : "".concat(deviceIp || '', ":").concat(devicePort || ''),
233
189
  el: container.id,
@@ -236,10 +192,8 @@ var Player = /*#__PURE__*/function () {
236
192
  num: 1
237
193
  });
238
194
  }
239
-
240
195
  if (this.type === 'webrtc') {
241
196
  var _dd3 = document.getElementById(container.id);
242
-
243
197
  ((_a = _dd3 === null || _dd3 === void 0 ? void 0 : _dd3.children) === null || _a === void 0 ? void 0 : _a.length) > 0 && _dd3.removeChild(_dd3.firstChild);
244
198
  video.autoplay = true;
245
199
  var id = "".concat(container.id, "_").concat(Date.now());
@@ -251,10 +205,8 @@ var Player = /*#__PURE__*/function () {
251
205
  type: live
252
206
  });
253
207
  }
254
-
255
208
  if (this.type === 'h264') {
256
209
  var _dd4 = document.getElementById(container.id);
257
-
258
210
  ((_b = _dd4 === null || _dd4 === void 0 ? void 0 : _dd4.children) === null || _b === void 0 ? void 0 : _b.length) > 0 && _dd4.removeChild(_dd4.firstChild);
259
211
  video.autoplay = true;
260
212
  var _id = 'playerh264';
@@ -265,7 +217,6 @@ var Player = /*#__PURE__*/function () {
265
217
  url: this.url
266
218
  });
267
219
  }
268
-
269
220
  if (this.type === 'bd') {
270
221
  this.player = new _PlayerManager["default"]({
271
222
  el: container.id,
@@ -273,10 +224,8 @@ var Player = /*#__PURE__*/function () {
273
224
  url: this.url
274
225
  });
275
226
  }
276
-
277
227
  if (this.type === 'mp4') {
278
228
  var _dd5 = document.getElementById(container.id);
279
-
280
229
  ((_c = _dd5 === null || _dd5 === void 0 ? void 0 : _dd5.children) === null || _c === void 0 ? void 0 : _c.length) > 0 && _dd5.removeChild(_dd5.firstChild);
281
230
  this.video.src = this.url;
282
231
  this.video.autoplay = true;
@@ -284,10 +233,8 @@ var Player = /*#__PURE__*/function () {
284
233
  this.video.id = _id2;
285
234
  container.appendChild(this.video);
286
235
  }
287
-
288
236
  if (this.type === 'iframe') {
289
237
  var _dd6 = document.getElementById(container.id);
290
-
291
238
  ((_d = _dd6 === null || _dd6 === void 0 ? void 0 : _dd6.children) === null || _d === void 0 ? void 0 : _d.length) > 0 && _dd6.removeChild(_dd6.firstChild);
292
239
  var iframe = document.createElement('iframe');
293
240
  iframe.width = '100%';
@@ -296,10 +243,8 @@ var Player = /*#__PURE__*/function () {
296
243
  iframe.src = this.url;
297
244
  container.appendChild(iframe);
298
245
  }
299
-
300
246
  if (this.type === 'rsl') {
301
247
  var _dd7 = document.getElementById(container.id);
302
-
303
248
  ((_e = _dd7 === null || _dd7 === void 0 ? void 0 : _dd7.children) === null || _e === void 0 ? void 0 : _e.length) > 0 && _dd7.removeChild(_dd7.firstChild);
304
249
  var canvas = document.createElement('canvas');
305
250
  canvas.id = 'myCanvas';
@@ -316,8 +261,6 @@ var Player = /*#__PURE__*/function () {
316
261
  }
317
262
  }
318
263
  /** 播放 */
319
-
320
-
321
264
  _createClass(Player, [{
322
265
  key: "play",
323
266
  value: function play() {
@@ -325,22 +268,17 @@ var Player = /*#__PURE__*/function () {
325
268
  var player = this.player;
326
269
  return player.play();
327
270
  }
328
-
329
271
  if (this.type === 'hls') {
330
272
  return this.video.play();
331
273
  }
332
-
333
274
  if (this.type === 'hk_ws' || this.type === 'hkcar_ws') {
334
275
  var _player = this.player;
335
-
336
276
  var result = _player.JS_Play(this.url, {
337
277
  playURL: this.url,
338
278
  mode: 1
339
279
  }, 0);
340
-
341
280
  this.windowIndex = 0;
342
281
  var url = this.url;
343
-
344
282
  _player.JS_SetWindowControlCallback({
345
283
  pluginErrorHandler: function pluginErrorHandler(index, iErrorCode) {
346
284
  //插件错误回调
@@ -352,18 +290,16 @@ var Player = /*#__PURE__*/function () {
352
290
  mode: 1
353
291
  }, index);
354
292
  }
355
- } // firstFrameDisplay: (index: number, width: number, height: number) => {
293
+ }
294
+ // firstFrameDisplay: (index: number, width: number, height: number) => {
356
295
  // console.log(index, width, height, 'firstFrameDisplay');
357
296
  // },
358
-
359
297
  });
360
298
 
361
299
  return result;
362
300
  }
363
-
364
301
  if (this.type === 'icc_ws') {
365
302
  var _player2 = this.player;
366
-
367
303
  _player2.playRealVideo({
368
304
  channelList: [{
369
305
  id: this.deviceCode + '$1$0$' + this.channelNum,
@@ -372,43 +308,32 @@ var Player = /*#__PURE__*/function () {
372
308
  streamType: Number(this.streamType) + 1
373
309
  });
374
310
  }
375
-
376
311
  if (this.type === 'webrtc') {
377
312
  var _player3 = this.player;
378
-
379
313
  _player3.play();
380
314
  }
381
-
382
315
  if (this.type === 'bd') {
383
316
  var _player4 = this.player;
384
-
385
317
  _player4.playRealVideo();
386
318
  }
387
-
388
- if (this.type === 'mp4') {//
319
+ if (this.type === 'mp4') {
320
+ //
389
321
  }
390
-
391
322
  if (this.type === 'vtx_ws') {
392
323
  var _player5 = this.player;
393
-
394
324
  _player5.play(this.url);
395
325
  }
396
-
397
326
  if (this.type === 'rsl') {
398
327
  var _player6 = this.player;
399
-
400
328
  _player6.play();
401
329
  }
402
-
403
330
  return Promise.resolve();
404
331
  }
405
332
  /** 回放 */
406
-
407
333
  }, {
408
334
  key: "playBack",
409
335
  value: function playBack() {
410
336
  var _this = this;
411
-
412
337
  if (this.type === 'hk_ws' || this.type === 'hkcar_ws') {
413
338
  var player = this.player;
414
339
  var result = player.JS_Play(this.url, {
@@ -430,7 +355,6 @@ var Player = /*#__PURE__*/function () {
430
355
  recordSource: '2',
431
356
  streamType: _this.streamType
432
357
  });
433
-
434
358
  resolve(true);
435
359
  });
436
360
  } else {
@@ -438,115 +362,82 @@ var Player = /*#__PURE__*/function () {
438
362
  }
439
363
  }
440
364
  /** 销毁 */
441
-
442
365
  }, {
443
366
  key: "destroy",
444
367
  value: function destroy() {
445
368
  var _this2 = this;
446
-
447
369
  var _a, _b, _c;
448
-
449
370
  if (this.type === 'flv') {
450
371
  var player = this.player;
451
372
  player === null || player === void 0 ? void 0 : player.destroy();
452
373
  this.player = null;
453
374
  this.video.remove();
454
375
  }
455
-
456
376
  if (this.type === 'hls') {
457
377
  var _player8 = this.player;
458
378
  _player8 && _player8.destroy();
459
379
  this.player = null;
460
380
  this.video.remove();
461
381
  }
462
-
463
382
  if (this.type === 'vtxhls' || this.type === 'vtxwhep') {
464
383
  this.video.remove();
465
384
  this.player = null;
466
385
  var dd = document.getElementById(this.containerId);
467
-
468
386
  while (dd === null || dd === void 0 ? void 0 : dd.hasChildNodes()) {
469
387
  dd.removeChild(dd.firstChild);
470
388
  }
471
389
  }
472
-
473
390
  if (this.type === 'hk_ws') {
474
391
  var _player9 = this.player;
475
392
  _player9 && _player9.JS_Stop(0).then(function () {
476
393
  _this2.player = null;
477
394
  });
478
-
479
395
  var _dd8 = document.getElementById(this.containerId);
480
-
481
396
  _dd8 && _dd8.childNodes && _dd8.childNodes[0] && _dd8.removeChild(_dd8.childNodes[0]);
482
397
  }
483
-
484
398
  if (this.type === 'hkcar_ws') {
485
399
  var _player10 = this.player;
486
-
487
400
  _player10.JS_DestroyWorker();
488
-
489
401
  var _dd9 = document.getElementById(this.containerId);
490
-
491
402
  (_dd9 === null || _dd9 === void 0 ? void 0 : _dd9.childNodes) && _dd9.childNodes[0] && _dd9.removeChild(_dd9.childNodes[0]);
492
403
  }
493
-
494
404
  if (this.type === 'icc_ws') {
495
405
  var _player11 = this.player;
496
-
497
406
  _player11.close();
498
407
  }
499
-
500
408
  if (this.type === 'webrtc') {
501
409
  var _player12 = this.player;
502
-
503
410
  _player12.close();
504
411
  }
505
-
506
412
  if (this.type === 'h264') {
507
413
  var _player13 = this.player;
508
-
509
414
  _player13.close();
510
415
  }
511
-
512
416
  if (this.type === 'bd') {
513
417
  var _player14 = this.player;
514
-
515
418
  _player14.close(0);
516
419
  }
517
-
518
420
  if (this.type === 'mp4') {
519
421
  this.video = null;
520
-
521
422
  var _dd10 = document.getElementById(this.containerId);
522
-
523
423
  ((_a = _dd10 === null || _dd10 === void 0 ? void 0 : _dd10.children) === null || _a === void 0 ? void 0 : _a.length) > 0 && _dd10.removeChild(_dd10.firstChild);
524
424
  }
525
-
526
425
  if (this.type === 'vtx_ws') {
527
426
  var _player15 = this.player;
528
-
529
427
  _player15.destroy();
530
428
  }
531
-
532
429
  if (this.type === 'iframe') {
533
430
  var _dd11 = document.getElementById(this.containerId);
534
-
535
431
  ((_b = _dd11 === null || _dd11 === void 0 ? void 0 : _dd11.children) === null || _b === void 0 ? void 0 : _b.length) > 0 && _dd11.removeChild(_dd11.firstChild);
536
432
  }
537
-
538
433
  if (this.type === 'rsl') {
539
434
  var _player16 = this.player;
540
-
541
435
  _player16.destroy();
542
-
543
436
  var _dd12 = document.getElementById(this.containerId);
544
-
545
437
  ((_c = _dd12 === null || _dd12 === void 0 ? void 0 : _dd12.children) === null || _c === void 0 ? void 0 : _c.length) > 0 && _dd12.removeChild(_dd12.firstChild);
546
438
  }
547
439
  }
548
440
  /** 截图 */
549
-
550
441
  }, {
551
442
  key: "capture",
552
443
  value: function capture() {
@@ -555,7 +446,6 @@ var Player = /*#__PURE__*/function () {
555
446
  var time = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
556
447
  var name = captureName;
557
448
  if (time) name += "-".concat((0, _moment["default"])().format('YYYYMMDDHHmmss'));
558
-
559
449
  if (this.type === 'hk_ws' || this.type === 'hkcar_ws') {
560
450
  var player = this.player;
561
451
  if (player) player.JS_CapturePicture(1, name, 'JPEG', function (res) {
@@ -564,7 +454,6 @@ var Player = /*#__PURE__*/function () {
564
454
  } else if (this.type === 'bd') {
565
455
  var DPlayer = this.player.dp;
566
456
  var canvas = DPlayer.container.querySelector('canvas');
567
-
568
457
  if (canvas) {
569
458
  canvas.toBlob(function (blob) {
570
459
  if (blob) {
@@ -574,10 +463,8 @@ var Player = /*#__PURE__*/function () {
574
463
  }
575
464
  } else if (this.type === 'vtx_ws') {
576
465
  var _player17 = this.player;
577
-
578
466
  if (_player17) {
579
467
  var fileBlob = _player17.screenshot(captureName, 'blob');
580
-
581
468
  callback && callback(URL.createObjectURL(fileBlob));
582
469
  }
583
470
  } else {
@@ -585,7 +472,6 @@ var Player = /*#__PURE__*/function () {
585
472
  }
586
473
  }
587
474
  /** 尺寸重置 */
588
-
589
475
  }, {
590
476
  key: "resize",
591
477
  value: function resize() {
@@ -596,7 +482,6 @@ var Player = /*#__PURE__*/function () {
596
482
  }, 500);
597
483
  } else if (this.type === 'icc_ws') {
598
484
  var _player18 = this.player;
599
-
600
485
  _player18.setPlayerAdapter('selfAdaption');
601
486
  }
602
487
  }
@@ -604,7 +489,6 @@ var Player = /*#__PURE__*/function () {
604
489
  * 设置音量
605
490
  * @param value
606
491
  */
607
-
608
492
  }, {
609
493
  key: "setVolume",
610
494
  value: function setVolume(value) {
@@ -612,25 +496,19 @@ var Player = /*#__PURE__*/function () {
612
496
  var player = this.player;
613
497
  player.volume = value / 100;
614
498
  }
615
-
616
499
  if (this.type === 'hls') {
617
500
  this.video.volume = value / 100;
618
501
  }
619
-
620
502
  if (this.type === 'hk_ws' || this.type === 'hkcar_ws') {
621
503
  var _player19 = this.player;
622
-
623
504
  if (_player19.iCurrentSoundWnd !== this.windowIndex) {
624
505
  _player19.JS_OpenSound(this.windowIndex);
625
506
  }
626
-
627
507
  _player19.JS_SetVolume(this.windowIndex, value);
628
508
  }
629
-
630
509
  if (this.type === 'bd') {
631
510
  var _player20 = this.player.dp;
632
511
  if (!_player20.ttxplayer.enableAudio) _player20.ttxplayer.openAudio();
633
-
634
512
  _player20.ttxplayer.setVolume(value);
635
513
  }
636
514
  }
@@ -638,23 +516,19 @@ var Player = /*#__PURE__*/function () {
638
516
  * 设置播放速度
639
517
  * @param speed
640
518
  */
641
-
642
519
  }, {
643
520
  key: "setSpeed",
644
521
  value: function setSpeed(speed) {
645
522
  if (this.type === 'hk_ws' || this.type === 'hkcar_ws') {
646
523
  var player = this.player;
647
-
648
524
  if (this.preSpeed / speed === 2) {
649
525
  player.JS_Slow(1);
650
526
  }
651
-
652
527
  if (this.preSpeed / speed === 4) {
653
528
  player.JS_Slow(1).then(function () {
654
529
  return player.JS_Slow(1);
655
530
  });
656
531
  }
657
-
658
532
  if (this.preSpeed / speed === 8) {
659
533
  player.JS_Slow(1).then(function () {
660
534
  return player.JS_Slow(1);
@@ -662,7 +536,6 @@ var Player = /*#__PURE__*/function () {
662
536
  return player.JS_Slow(1);
663
537
  });
664
538
  }
665
-
666
539
  if (this.preSpeed / speed === 16) {
667
540
  player.JS_Slow(1).then(function () {
668
541
  return player.JS_Slow(1);
@@ -672,17 +545,14 @@ var Player = /*#__PURE__*/function () {
672
545
  return player.JS_Slow(1);
673
546
  });
674
547
  }
675
-
676
548
  if (speed / this.preSpeed === 2) {
677
549
  player.JS_Fast(1);
678
550
  }
679
-
680
551
  if (speed / this.preSpeed === 4) {
681
552
  player.JS_Fast(1).then(function () {
682
553
  return player.JS_Fast(1);
683
554
  });
684
555
  }
685
-
686
556
  if (speed / this.preSpeed === 8) {
687
557
  player.JS_Fast(1).then(function () {
688
558
  return player.JS_Fast(1);
@@ -690,7 +560,6 @@ var Player = /*#__PURE__*/function () {
690
560
  return player.JS_Fast(1);
691
561
  });
692
562
  }
693
-
694
563
  if (speed / this.preSpeed === 16) {
695
564
  player.JS_Fast(1).then(function () {
696
565
  return player.JS_Fast(1);
@@ -700,13 +569,12 @@ var Player = /*#__PURE__*/function () {
700
569
  return player.JS_Fast(1);
701
570
  });
702
571
  }
703
-
704
572
  this.preSpeed = speed;
705
573
  } else if (this.type === 'icc_ws') {
706
574
  var _player21 = this.player;
707
-
708
575
  _player21.playSpeed(speed);
709
- } else if (this.type === 'bd') {// todo
576
+ } else if (this.type === 'bd') {
577
+ // todo
710
578
  } else {
711
579
  this.video.playbackRate = speed;
712
580
  }
@@ -715,24 +583,19 @@ var Player = /*#__PURE__*/function () {
715
583
  * 时间更新事件
716
584
  * @param callback 回调函数
717
585
  */
718
-
719
586
  }, {
720
587
  key: "onTimeUpdate",
721
588
  value: function onTimeUpdate(callback) {
722
589
  var _this3 = this;
723
-
724
590
  var _a;
725
-
726
591
  this.video.addEventListener('timeupdate', function () {
727
592
  var currentTime = _this3.video.currentTime;
728
-
729
593
  if ((_this3.type === 'hk_ws' || _this3.type === 'hkcar_ws') && _this3.seekTime) {
730
594
  currentTime = currentTime + _this3.seekTime.diff(_this3.startTime, 'seconds');
731
595
  }
732
-
733
596
  callback(currentTime, _this3.type === 'hk_ws' || _this3.type === 'hkcar_ws' ? _this3.preSpeed : _this3.video.playbackRate);
734
- }); // 增加hw_ws 流播放结束回调
735
-
597
+ });
598
+ // 增加hw_ws 流播放结束回调
736
599
  var player = this.player;
737
600
  (_a = player === null || player === void 0 ? void 0 : player.JS_SetWindowControlCallback) === null || _a === void 0 ? void 0 : _a.call(player, {
738
601
  StreamEnd: function StreamEnd() {
@@ -741,65 +604,52 @@ var Player = /*#__PURE__*/function () {
741
604
  });
742
605
  }
743
606
  /** 跳转到 */
744
-
745
607
  }, {
746
608
  key: "seekTo",
747
609
  value: function seekTo(time) {
748
610
  var _a, _b;
749
-
750
611
  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
751
612
  var player, seekTime, _player22, _seekTime, _player23, url;
752
-
753
613
  return _regeneratorRuntime().wrap(function _callee$(_context) {
754
- while (1) {
755
- switch (_context.prev = _context.next) {
756
- case 0:
757
- if (!(this.type === 'hk_ws' || this.type === 'hkcar_ws')) {
758
- _context.next = 8;
759
- break;
760
- }
761
-
762
- player = this.player;
763
- seekTime = (_a = (0, _moment["default"])(this.startTime)) === null || _a === void 0 ? void 0 : _a.add(time, 'seconds');
764
- this.seekTime = seekTime;
765
- _context.next = 6;
766
- return player.JS_Seek(1, (0, _utils.getHKTimeString)(seekTime), (0, _utils.getHKTimeString)(this.endTime));
767
-
768
- case 6:
769
- _context.next = 9;
614
+ while (1) switch (_context.prev = _context.next) {
615
+ case 0:
616
+ if (!(this.type === 'hk_ws' || this.type === 'hkcar_ws')) {
617
+ _context.next = 8;
770
618
  break;
771
-
772
- case 8:
773
- if (this.type === 'icc_ws') {
774
- _player22 = this.player;
775
- _seekTime = (_b = (0, _moment["default"])(this.startTime)) === null || _b === void 0 ? void 0 : _b.add(time, 'seconds').format('HH:mm:ss');
776
-
777
- _player22.jumpPlayByTime(_seekTime);
778
- } else if (this.type === 'bd') {
779
- // const seekTime = moment(this.startTime)?.add(time, 'seconds').format('HH:mm:ss');
780
- _player23 = this.player;
781
-
782
- _player23.close(0);
783
-
784
- this.player = null;
785
- url = this.url.replace('PLAYBEG=0', "PLAYBEG=".concat(time * 1000));
786
- this.player = new _PlayerManager["default"]({
787
- el: this.containerId,
788
- type: false,
789
- url: url
790
- });
791
- this.player.playRealVideo();
792
- } else {
793
- this.video.currentTime = time;
794
- }
795
-
796
- case 9:
797
- return _context.abrupt("return", Promise.resolve());
798
-
799
- case 10:
800
- case "end":
801
- return _context.stop();
802
- }
619
+ }
620
+ player = this.player;
621
+ seekTime = (_a = (0, _moment["default"])(this.startTime)) === null || _a === void 0 ? void 0 : _a.add(time, 'seconds');
622
+ this.seekTime = seekTime;
623
+ _context.next = 6;
624
+ return player.JS_Seek(1, (0, _utils.getHKTimeString)(seekTime), (0, _utils.getHKTimeString)(this.endTime));
625
+ case 6:
626
+ _context.next = 9;
627
+ break;
628
+ case 8:
629
+ if (this.type === 'icc_ws') {
630
+ _player22 = this.player;
631
+ _seekTime = (_b = (0, _moment["default"])(this.startTime)) === null || _b === void 0 ? void 0 : _b.add(time, 'seconds').format('HH:mm:ss');
632
+ _player22.jumpPlayByTime(_seekTime);
633
+ } else if (this.type === 'bd') {
634
+ // const seekTime = moment(this.startTime)?.add(time, 'seconds').format('HH:mm:ss');
635
+ _player23 = this.player;
636
+ _player23.close(0);
637
+ this.player = null;
638
+ url = this.url.replace('PLAYBEG=0', "PLAYBEG=".concat(time * 1000));
639
+ this.player = new _PlayerManager["default"]({
640
+ el: this.containerId,
641
+ type: false,
642
+ url: url
643
+ });
644
+ this.player.playRealVideo();
645
+ } else {
646
+ this.video.currentTime = time;
647
+ }
648
+ case 9:
649
+ return _context.abrupt("return", Promise.resolve());
650
+ case 10:
651
+ case "end":
652
+ return _context.stop();
803
653
  }
804
654
  }, _callee, this);
805
655
  }));
@@ -808,7 +658,6 @@ var Player = /*#__PURE__*/function () {
808
658
  * 暂停播放
809
659
  * @param callback 回调函数
810
660
  */
811
-
812
661
  }, {
813
662
  key: "pause",
814
663
  value: function pause(callback) {
@@ -819,13 +668,10 @@ var Player = /*#__PURE__*/function () {
819
668
  });
820
669
  } else if (this.type === 'bd') {
821
670
  var _player24 = this.player;
822
-
823
671
  _player24.pause();
824
-
825
672
  callback && callback();
826
673
  } else if (this.type === 'vtx_ws') {
827
674
  var _player25 = this.player;
828
-
829
675
  _player25.pause();
830
676
  } else {
831
677
  this.video.pause();
@@ -836,7 +682,6 @@ var Player = /*#__PURE__*/function () {
836
682
  * 恢复播放
837
683
  * @param callback 回调函数
838
684
  */
839
-
840
685
  }, {
841
686
  key: "resume",
842
687
  value: function resume(callback) {
@@ -847,9 +692,7 @@ var Player = /*#__PURE__*/function () {
847
692
  });
848
693
  } else if (this.type === 'bd') {
849
694
  var _player26 = this.player;
850
-
851
695
  _player26.play();
852
-
853
696
  callback && callback();
854
697
  } else {
855
698
  this.video.play();
@@ -860,7 +703,6 @@ var Player = /*#__PURE__*/function () {
860
703
  * 开始对讲
861
704
  * @param url 对讲地址
862
705
  */
863
-
864
706
  }, {
865
707
  key: "startTalk",
866
708
  value: function startTalk(url) {
@@ -868,14 +710,12 @@ var Player = /*#__PURE__*/function () {
868
710
  var player = this.player;
869
711
  return player.JS_StartTalk(url);
870
712
  }
871
-
872
713
  return Promise.reject();
873
714
  }
874
715
  /**
875
716
  * 开始对讲
876
717
  * @param state 状态
877
718
  */
878
-
879
719
  }, {
880
720
  key: "stopTalk",
881
721
  value: function stopTalk() {
@@ -883,33 +723,29 @@ var Player = /*#__PURE__*/function () {
883
723
  var player = this.player;
884
724
  return player.JS_StopTalk();
885
725
  }
886
-
887
726
  return Promise.reject();
888
727
  }
889
728
  }]);
890
-
891
729
  return Player;
892
730
  }();
893
731
  /**
894
732
  * 截图
895
733
  * @param video
896
734
  */
897
-
898
-
899
735
  var Capture = function Capture(video, name, callback) {
900
736
  var canvas = document.createElement('canvas');
901
737
  canvas.width = video.videoWidth;
902
738
  canvas.height = video.videoHeight;
903
739
  var context = canvas.getContext('2d');
904
-
905
740
  if (context) {
906
741
  context.drawImage(video, 0, 0, canvas.width, canvas.height);
907
742
  var dataURL;
908
743
  canvas.toBlob(function (blob) {
909
744
  if (blob) {
910
- dataURL = URL.createObjectURL(blob); // const link = document.createElement('a');
911
-
912
- callback && callback(dataURL); // link.href = dataURL;
745
+ dataURL = URL.createObjectURL(blob);
746
+ // const link = document.createElement('a');
747
+ callback && callback(dataURL);
748
+ // link.href = dataURL;
913
749
  // link.download = `${name}.png`;
914
750
  // link.style.display = 'none';
915
751
  // document.body.appendChild(link);
@@ -920,7 +756,6 @@ var Capture = function Capture(video, name, callback) {
920
756
  });
921
757
  }
922
758
  };
923
-
924
759
  var _default = Player;
925
760
  exports["default"] = _default;
926
761
  //# sourceMappingURL=index.js.map