@vtx/player 1.7.19 → 1.7.21

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