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