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