@vtx/player 1.0.7 → 1.0.9

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 (108) hide show
  1. package/lib/api/fetch.js +51 -75
  2. package/lib/api/fetch.js.map +1 -1
  3. package/lib/api/index.js +18 -62
  4. package/lib/api/index.js.map +1 -1
  5. package/lib/api/types.d.ts +6 -6
  6. package/lib/bill-player/index.js +59 -111
  7. package/lib/bill-player/index.js.map +1 -1
  8. package/lib/bill-player/style/css.js +0 -9
  9. package/lib/bill-player/style/css.js.map +1 -1
  10. package/lib/bill-player/style/index.js +0 -9
  11. package/lib/bill-player/style/index.js.map +1 -1
  12. package/lib/components/set-tag-video/index.js +6 -34
  13. package/lib/components/set-tag-video/index.js.map +1 -1
  14. package/lib/components/set-tag-video/style/css.js.map +1 -1
  15. package/lib/components/set-tag-video/style/index.js.map +1 -1
  16. package/lib/components/split-screen/index.d.ts +1 -1
  17. package/lib/components/split-screen/index.js +3 -14
  18. package/lib/components/split-screen/index.js.map +1 -1
  19. package/lib/components/split-screen/style/css.js.map +1 -1
  20. package/lib/components/split-screen/style/index.js.map +1 -1
  21. package/lib/components/tag-video/index.js +10 -38
  22. package/lib/components/tag-video/index.js.map +1 -1
  23. package/lib/components/tag-video/style/css.js.map +1 -1
  24. package/lib/components/tag-video/style/index.js.map +1 -1
  25. package/lib/components/video-scale/index.d.ts +1 -1
  26. package/lib/components/video-scale/index.js +2 -9
  27. package/lib/components/video-scale/index.js.map +1 -1
  28. package/lib/components/video-scale/style/css.js.map +1 -1
  29. package/lib/components/video-scale/style/index.js.map +1 -1
  30. package/lib/context/index.js +0 -4
  31. package/lib/context/index.js.map +1 -1
  32. package/lib/controls/index.d.ts +3 -3
  33. package/lib/controls/index.js +38 -102
  34. package/lib/controls/index.js.map +1 -1
  35. package/lib/controls/style/css.js +0 -5
  36. package/lib/controls/style/css.js.map +1 -1
  37. package/lib/controls/style/index.css +3 -3
  38. package/lib/controls/style/index.js +0 -5
  39. package/lib/controls/style/index.js.map +1 -1
  40. package/lib/controls/style/index.less +1 -1
  41. package/lib/history-control/index.d.ts +2 -2
  42. package/lib/history-control/index.js +57 -114
  43. package/lib/history-control/index.js.map +1 -1
  44. package/lib/history-control/style/css.js +0 -6
  45. package/lib/history-control/style/css.js.map +1 -1
  46. package/lib/history-control/style/index.js +0 -6
  47. package/lib/history-control/style/index.js.map +1 -1
  48. package/lib/history-control-v2/components/grid-item/index.js +31 -69
  49. package/lib/history-control-v2/components/grid-item/index.js.map +1 -1
  50. package/lib/history-control-v2/components/panel/index.js +35 -104
  51. package/lib/history-control-v2/components/panel/index.js.map +1 -1
  52. package/lib/history-control-v2/context.js +0 -2
  53. package/lib/history-control-v2/context.js.map +1 -1
  54. package/lib/history-control-v2/index.d.ts +4 -4
  55. package/lib/history-control-v2/index.js +94 -161
  56. package/lib/history-control-v2/index.js.map +1 -1
  57. package/lib/history-control-v2/style/css.js +0 -10
  58. package/lib/history-control-v2/style/css.js.map +1 -1
  59. package/lib/history-control-v2/style/index.js +0 -10
  60. package/lib/history-control-v2/style/index.js.map +1 -1
  61. package/lib/history-control-v2/utils.js +1 -21
  62. package/lib/history-control-v2/utils.js.map +1 -1
  63. package/lib/history-player/index.d.ts +1 -1
  64. package/lib/history-player/index.js +73 -118
  65. package/lib/history-player/index.js.map +1 -1
  66. package/lib/history-player/style/css.js +0 -3
  67. package/lib/history-player/style/css.js.map +1 -1
  68. package/lib/history-player/style/index.js +0 -3
  69. package/lib/history-player/style/index.js.map +1 -1
  70. package/lib/hooks/useSettings.js +1 -6
  71. package/lib/hooks/useSettings.js.map +1 -1
  72. package/lib/icons/index.js +23 -171
  73. package/lib/icons/index.js.map +1 -1
  74. package/lib/index.js +0 -10
  75. package/lib/index.js.map +1 -1
  76. package/lib/live-channel-player/index.js +31 -66
  77. package/lib/live-channel-player/index.js.map +1 -1
  78. package/lib/live-channel-player/style/css.js +0 -1
  79. package/lib/live-channel-player/style/css.js.map +1 -1
  80. package/lib/live-channel-player/style/index.js +0 -1
  81. package/lib/live-channel-player/style/index.js.map +1 -1
  82. package/lib/live-control/index.d.ts +2 -2
  83. package/lib/live-control/index.js +32 -83
  84. package/lib/live-control/index.js.map +1 -1
  85. package/lib/live-control/style/css.js +0 -4
  86. package/lib/live-control/style/css.js.map +1 -1
  87. package/lib/live-control/style/index.js +0 -4
  88. package/lib/live-control/style/index.js.map +1 -1
  89. package/lib/live-control-v2/index.d.ts +3 -2
  90. package/lib/live-control-v2/index.js +71 -124
  91. package/lib/live-control-v2/index.js.map +1 -1
  92. package/lib/live-control-v2/style/css.js +0 -7
  93. package/lib/live-control-v2/style/css.js.map +1 -1
  94. package/lib/live-control-v2/style/index.js +0 -7
  95. package/lib/live-control-v2/style/index.js.map +1 -1
  96. package/lib/live-player/index.js +41 -59
  97. package/lib/live-player/index.js.map +1 -1
  98. package/lib/live-player/style/css.js +0 -2
  99. package/lib/live-player/style/css.js.map +1 -1
  100. package/lib/live-player/style/index.js +0 -2
  101. package/lib/live-player/style/index.js.map +1 -1
  102. package/lib/player/index.d.ts +1 -1
  103. package/lib/player/index.js +42 -119
  104. package/lib/player/index.js.map +1 -1
  105. package/lib/utils/index.d.ts +1 -1
  106. package/lib/utils/index.js +9 -81
  107. package/lib/utils/index.js.map +1 -1
  108. package/package.json +1 -1
@@ -1,37 +1,27 @@
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 _utils = require("../utils");
11
-
12
8
  var _flv = _interopRequireDefault(require("flv.js"));
13
-
14
9
  var _hls = _interopRequireDefault(require("hls.js"));
15
-
16
10
  var _moment = _interopRequireDefault(require("moment"));
17
-
18
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
19
-
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, $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; }
21
-
12
+ 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); }
13
+ 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; }
22
14
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
23
-
24
- 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); } }
25
-
15
+ 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); } }
26
16
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
27
-
17
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
18
+ 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); }
28
19
  var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
29
20
  function adopt(value) {
30
21
  return value instanceof P ? value : new P(function (resolve) {
31
22
  resolve(value);
32
23
  });
33
24
  }
34
-
35
25
  return new (P || (P = Promise))(function (resolve, reject) {
36
26
  function fulfilled(value) {
37
27
  try {
@@ -40,7 +30,6 @@ var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P
40
30
  reject(e);
41
31
  }
42
32
  }
43
-
44
33
  function rejected(value) {
45
34
  try {
46
35
  step(generator["throw"](value));
@@ -48,51 +37,41 @@ var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P
48
37
  reject(e);
49
38
  }
50
39
  }
51
-
52
40
  function step(result) {
53
41
  result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
54
42
  }
55
-
56
43
  step((generator = generator.apply(thisArg, _arguments || [])).next());
57
44
  });
58
45
  };
59
-
60
46
  /**
61
47
  * 视频播放核心类
62
48
  */
63
49
  var Player = /*#__PURE__*/function () {
64
50
  function Player(params) {
65
51
  _classCallCheck(this, Player);
66
-
67
52
  this.player = null;
68
53
  /** 之前的视频播放速度,用于处理海康音量控制 */
69
-
70
54
  this.preSpeed = 1;
71
55
  /** 视频播放流是否走代理 - 是强制走代理,否通过判断 http协议,走代理配置 */
72
-
73
56
  var url = params.url,
74
- _params$enableAgent = params.enableAgent,
75
- enableAgent = _params$enableAgent === void 0 ? false : _params$enableAgent,
76
- container = params.container,
77
- _params$live = params.live,
78
- live = _params$live === void 0 ? true : _params$live,
79
- type = params.type,
80
- startTime = params.startTime,
81
- endTime = params.endTime;
57
+ _params$enableAgent = params.enableAgent,
58
+ enableAgent = _params$enableAgent === void 0 ? false : _params$enableAgent,
59
+ container = params.container,
60
+ _params$live = params.live,
61
+ live = _params$live === void 0 ? true : _params$live,
62
+ type = params.type,
63
+ startTime = params.startTime,
64
+ endTime = params.endTime;
82
65
  var playerParams = (0, _utils.getPlayerParams)(url, enableAgent, live, startTime, endTime);
83
66
  this.type = type || playerParams.type; // 如果不传递type,则通过url解析type值
84
-
85
67
  this.url = playerParams.url;
86
68
  this.enableAgent = enableAgent;
87
69
  this.startTime = startTime;
88
70
  this.endTime = endTime;
89
71
  var video = document.createElement('video'); // 生成video元素
90
-
91
72
  video.className = 'vtx-player-video';
92
73
  video.muted = true; //设置静音
93
-
94
74
  this.video = video;
95
-
96
75
  if (this.type === 'flv' && _flv["default"].isSupported() && video) {
97
76
  container.appendChild(video);
98
77
  this.player = _flv["default"].createPlayer({
@@ -102,17 +81,15 @@ var Player = /*#__PURE__*/function () {
102
81
  });
103
82
  this.player.attachMediaElement(this.video);
104
83
  this.player.load();
105
- } // 处理hls格式视频
106
-
107
-
84
+ }
85
+ // 处理hls格式视频
108
86
  if (this.type === 'hls' && _hls["default"].isSupported() && video) {
109
87
  container.appendChild(video);
110
88
  this.player = new _hls["default"]();
111
89
  this.player.loadSource(this.url);
112
90
  this.player.attachMedia(this.video);
113
- } // 处理海康视频
114
-
115
-
91
+ }
92
+ // 处理海康视频
116
93
  if (this.type === 'hk_ws') {
117
94
  this.player = new window.JSPlugin({
118
95
  szId: container.id,
@@ -125,8 +102,6 @@ var Player = /*#__PURE__*/function () {
125
102
  }
126
103
  }
127
104
  /** 播放 */
128
-
129
-
130
105
  _createClass(Player, [{
131
106
  key: "play",
132
107
  value: function play() {
@@ -134,26 +109,20 @@ var Player = /*#__PURE__*/function () {
134
109
  var player = this.player;
135
110
  return player.play();
136
111
  }
137
-
138
112
  if (this.type === 'hls') {
139
113
  return this.video.play();
140
114
  }
141
-
142
115
  if (this.type === 'hk_ws') {
143
116
  var _player = this.player;
144
-
145
117
  var result = _player.JS_Play(this.url, {
146
118
  playURL: this.url,
147
119
  mode: 0
148
120
  }, 0);
149
-
150
121
  return result;
151
122
  }
152
-
153
123
  return Promise.resolve();
154
124
  }
155
125
  /** 回放 */
156
-
157
126
  }, {
158
127
  key: "playBack",
159
128
  value: function playBack() {
@@ -169,7 +138,6 @@ var Player = /*#__PURE__*/function () {
169
138
  }
170
139
  }
171
140
  /** 销毁 */
172
-
173
141
  }, {
174
142
  key: "destroy",
175
143
  value: function destroy() {
@@ -179,24 +147,18 @@ var Player = /*#__PURE__*/function () {
179
147
  this.player = null;
180
148
  this.video.remove();
181
149
  }
182
-
183
150
  if (this.type === 'hls') {
184
151
  var _player2 = this.player;
185
-
186
152
  _player2.destroy();
187
-
188
153
  this.player = null;
189
154
  this.video.remove();
190
155
  }
191
-
192
156
  if (this.type === 'hk_ws') {
193
157
  var _player3 = this.player;
194
-
195
158
  _player3.JS_Stop(1);
196
159
  }
197
160
  }
198
161
  /** 截图 */
199
-
200
162
  }, {
201
163
  key: "capture",
202
164
  value: function capture() {
@@ -205,7 +167,6 @@ var Player = /*#__PURE__*/function () {
205
167
  var time = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
206
168
  var name = captureName;
207
169
  if (time) name += "-".concat((0, _moment["default"])().format('YYYYMMDDHHmmss'));
208
-
209
170
  if (this.type === 'hk_ws') {
210
171
  var player = this.player;
211
172
  if (player) player.JS_CapturePicture(1, name, 'JPEG', function (res) {
@@ -216,7 +177,6 @@ var Player = /*#__PURE__*/function () {
216
177
  }
217
178
  }
218
179
  /** 尺寸重置 */
219
-
220
180
  }, {
221
181
  key: "resize",
222
182
  value: function resize() {
@@ -229,7 +189,6 @@ var Player = /*#__PURE__*/function () {
229
189
  * 设置音量
230
190
  * @param value
231
191
  */
232
-
233
192
  }, {
234
193
  key: "setVolume",
235
194
  value: function setVolume(value) {
@@ -237,14 +196,11 @@ var Player = /*#__PURE__*/function () {
237
196
  var player = this.player;
238
197
  player.volume = value / 100;
239
198
  }
240
-
241
199
  if (this.type === 'hls') {
242
200
  this.video.volume = value / 100;
243
201
  }
244
-
245
202
  if (this.type === 'hk_ws') {
246
203
  var _player4 = this.player;
247
-
248
204
  _player4.JS_SetVolume(1, value);
249
205
  }
250
206
  }
@@ -252,23 +208,19 @@ var Player = /*#__PURE__*/function () {
252
208
  * 设置播放速度
253
209
  * @param speed
254
210
  */
255
-
256
211
  }, {
257
212
  key: "setSpeed",
258
213
  value: function setSpeed(speed) {
259
214
  if (this.type === 'hk_ws') {
260
215
  var player = this.player;
261
-
262
216
  if (this.preSpeed / speed === 2) {
263
217
  player.JS_Slow(1);
264
218
  }
265
-
266
219
  if (this.preSpeed / speed === 4) {
267
220
  player.JS_Slow(1).then(function () {
268
221
  return player.JS_Slow(1);
269
222
  });
270
223
  }
271
-
272
224
  if (this.preSpeed / speed === 8) {
273
225
  player.JS_Slow(1).then(function () {
274
226
  return player.JS_Slow(1);
@@ -276,7 +228,6 @@ var Player = /*#__PURE__*/function () {
276
228
  return player.JS_Slow(1);
277
229
  });
278
230
  }
279
-
280
231
  if (this.preSpeed / speed === 16) {
281
232
  player.JS_Slow(1).then(function () {
282
233
  return player.JS_Slow(1);
@@ -286,17 +237,14 @@ var Player = /*#__PURE__*/function () {
286
237
  return player.JS_Slow(1);
287
238
  });
288
239
  }
289
-
290
240
  if (speed / this.preSpeed === 2) {
291
241
  player.JS_Fast(1);
292
242
  }
293
-
294
243
  if (speed / this.preSpeed === 4) {
295
244
  player.JS_Fast(1).then(function () {
296
245
  return player.JS_Fast(1);
297
246
  });
298
247
  }
299
-
300
248
  if (speed / this.preSpeed === 8) {
301
249
  player.JS_Fast(1).then(function () {
302
250
  return player.JS_Fast(1);
@@ -304,7 +252,6 @@ var Player = /*#__PURE__*/function () {
304
252
  return player.JS_Fast(1);
305
253
  });
306
254
  }
307
-
308
255
  if (speed / this.preSpeed === 16) {
309
256
  player.JS_Fast(1).then(function () {
310
257
  return player.JS_Fast(1);
@@ -314,7 +261,6 @@ var Player = /*#__PURE__*/function () {
314
261
  return player.JS_Fast(1);
315
262
  });
316
263
  }
317
-
318
264
  this.preSpeed = speed;
319
265
  } else {
320
266
  this.video.playbackRate = speed;
@@ -324,24 +270,19 @@ var Player = /*#__PURE__*/function () {
324
270
  * 时间更新事件
325
271
  * @param callback 回调函数
326
272
  */
327
-
328
273
  }, {
329
274
  key: "onTimeUpdate",
330
275
  value: function onTimeUpdate(callback) {
331
276
  var _this = this;
332
-
333
277
  var _a;
334
-
335
278
  this.video.addEventListener('timeupdate', function () {
336
279
  var currentTime = _this.video.currentTime;
337
-
338
280
  if (_this.type === 'hk_ws' && _this.seekTime) {
339
281
  currentTime = currentTime + _this.seekTime.diff(_this.startTime, 'seconds');
340
282
  }
341
-
342
283
  callback(currentTime, _this.type === 'hk_ws' ? _this.preSpeed : _this.video.playbackRate);
343
- }); // 增加hw_ws 流播放结束回调
344
-
284
+ });
285
+ // 增加hw_ws 流播放结束回调
345
286
  var player = this.player;
346
287
  (_a = player === null || player === void 0 ? void 0 : player.JS_SetWindowControlCallback) === null || _a === void 0 ? void 0 : _a.call(player, {
347
288
  StreamEnd: function StreamEnd() {
@@ -350,41 +291,33 @@ var Player = /*#__PURE__*/function () {
350
291
  });
351
292
  }
352
293
  /** 跳转到 */
353
-
354
294
  }, {
355
295
  key: "seekTo",
356
296
  value: function seekTo(time) {
357
297
  var _a;
358
-
359
298
  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
360
299
  var player, seekTime;
361
300
  return _regeneratorRuntime().wrap(function _callee$(_context) {
362
- while (1) {
363
- switch (_context.prev = _context.next) {
364
- case 0:
365
- if (!(this.type === 'hk_ws')) {
366
- _context.next = 8;
367
- break;
368
- }
369
-
370
- player = this.player;
371
- seekTime = (_a = (0, _moment["default"])(this.startTime)) === null || _a === void 0 ? void 0 : _a.add(time, 'seconds');
372
- _context.next = 5;
373
- return player.JS_Seek(1, (0, _utils.getHKTimeString)(seekTime), (0, _utils.getHKTimeString)(this.endTime));
374
-
375
- case 5:
376
- this.seekTime = seekTime;
377
- _context.next = 10;
301
+ while (1) switch (_context.prev = _context.next) {
302
+ case 0:
303
+ if (!(this.type === 'hk_ws')) {
304
+ _context.next = 8;
378
305
  break;
379
-
380
- case 8:
381
- this.video.currentTime = time;
382
- return _context.abrupt("return", Promise.resolve());
383
-
384
- case 10:
385
- case "end":
386
- return _context.stop();
387
- }
306
+ }
307
+ player = this.player;
308
+ seekTime = (_a = (0, _moment["default"])(this.startTime)) === null || _a === void 0 ? void 0 : _a.add(time, 'seconds');
309
+ _context.next = 5;
310
+ return player.JS_Seek(1, (0, _utils.getHKTimeString)(seekTime), (0, _utils.getHKTimeString)(this.endTime));
311
+ case 5:
312
+ this.seekTime = seekTime;
313
+ _context.next = 10;
314
+ break;
315
+ case 8:
316
+ this.video.currentTime = time;
317
+ return _context.abrupt("return", Promise.resolve());
318
+ case 10:
319
+ case "end":
320
+ return _context.stop();
388
321
  }
389
322
  }, _callee, this);
390
323
  }));
@@ -393,7 +326,6 @@ var Player = /*#__PURE__*/function () {
393
326
  * 暂停播放
394
327
  * @param callback 回调函数
395
328
  */
396
-
397
329
  }, {
398
330
  key: "pause",
399
331
  value: function pause(callback) {
@@ -411,7 +343,6 @@ var Player = /*#__PURE__*/function () {
411
343
  * 恢复播放
412
344
  * @param callback 回调函数
413
345
  */
414
-
415
346
  }, {
416
347
  key: "resume",
417
348
  value: function resume(callback) {
@@ -429,7 +360,6 @@ var Player = /*#__PURE__*/function () {
429
360
  * 开始对讲
430
361
  * @param url 对讲地址
431
362
  */
432
-
433
363
  }, {
434
364
  key: "startTalk",
435
365
  value: function startTalk(url) {
@@ -437,14 +367,12 @@ var Player = /*#__PURE__*/function () {
437
367
  var player = this.player;
438
368
  return player.JS_StartTalk(url);
439
369
  }
440
-
441
370
  return Promise.reject();
442
371
  }
443
372
  /**
444
373
  * 开始对讲
445
374
  * @param state 状态
446
375
  */
447
-
448
376
  }, {
449
377
  key: "stopTalk",
450
378
  value: function stopTalk() {
@@ -452,33 +380,29 @@ var Player = /*#__PURE__*/function () {
452
380
  var player = this.player;
453
381
  return player.JS_StopTalk();
454
382
  }
455
-
456
383
  return Promise.reject();
457
384
  }
458
385
  }]);
459
-
460
386
  return Player;
461
387
  }();
462
388
  /**
463
389
  * 截图
464
390
  * @param video
465
391
  */
466
-
467
-
468
392
  var Capture = function Capture(video, name, callback) {
469
393
  var canvas = document.createElement('canvas');
470
394
  canvas.width = video.videoWidth;
471
395
  canvas.height = video.videoHeight;
472
396
  var context = canvas.getContext('2d');
473
-
474
397
  if (context) {
475
398
  context.drawImage(video, 0, 0, canvas.width, canvas.height);
476
399
  var dataURL;
477
400
  canvas.toBlob(function (blob) {
478
401
  if (blob) {
479
- dataURL = URL.createObjectURL(blob); // const link = document.createElement('a');
480
-
481
- callback && callback(dataURL); // link.href = dataURL;
402
+ dataURL = URL.createObjectURL(blob);
403
+ // const link = document.createElement('a');
404
+ callback && callback(dataURL);
405
+ // link.href = dataURL;
482
406
  // link.download = `${name}.png`;
483
407
  // link.style.display = 'none';
484
408
  // document.body.appendChild(link);
@@ -489,7 +413,6 @@ var Capture = function Capture(video, name, callback) {
489
413
  });
490
414
  }
491
415
  };
492
-
493
416
  var _default = Player;
494
417
  exports["default"] = _default;
495
418
  //# sourceMappingURL=index.js.map