@vtx/player 1.0.12 → 1.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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.css +0 -3
- package/lib/bill-player/style/index.js +9 -0
- package/lib/bill-player/style/index.js.map +1 -1
- package/lib/bill-player/style/index.less +0 -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.d.ts +2 -0
- package/lib/history-control-v2/components/grid-item/index.js +72 -32
- package/lib/history-control-v2/components/grid-item/index.js.map +1 -1
- package/lib/history-control-v2/components/panel/index.js +111 -38
- 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 +170 -97
- package/lib/history-control-v2/index.js.map +1 -1
- package/lib/history-control-v2/interface.d.ts +2 -0
- 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 +125 -53
- 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.js +56 -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 +122 -43
- package/lib/player/index.js.map +1 -1
- package/lib/utils/index.d.ts +2 -3
- package/lib/utils/index.js +98 -26
- 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,41 +48,51 @@ 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
|
-
|
|
65
|
-
var playerParams = (0, _utils.getPlayerParams)(url, enableAgent, live
|
|
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;
|
|
82
|
+
var playerParams = (0, _utils.getPlayerParams)(url, enableAgent, live);
|
|
66
83
|
this.type = type || playerParams.type; // 如果不传递type,则通过url解析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
|
var video = document.createElement('video'); // 生成video元素
|
|
90
|
+
|
|
72
91
|
video.className = 'vtx-player-video';
|
|
73
92
|
video.muted = true; //设置静音
|
|
93
|
+
|
|
74
94
|
this.video = video;
|
|
95
|
+
|
|
75
96
|
if (this.type === 'flv' && _flv["default"].isSupported() && video) {
|
|
76
97
|
container.appendChild(video);
|
|
77
98
|
this.player = _flv["default"].createPlayer({
|
|
@@ -81,15 +102,17 @@ var Player = /*#__PURE__*/function () {
|
|
|
81
102
|
});
|
|
82
103
|
this.player.attachMediaElement(this.video);
|
|
83
104
|
this.player.load();
|
|
84
|
-
}
|
|
85
|
-
|
|
105
|
+
} // 处理hls格式视频
|
|
106
|
+
|
|
107
|
+
|
|
86
108
|
if (this.type === 'hls' && _hls["default"].isSupported() && video) {
|
|
87
109
|
container.appendChild(video);
|
|
88
110
|
this.player = new _hls["default"]();
|
|
89
111
|
this.player.loadSource(this.url);
|
|
90
112
|
this.player.attachMedia(this.video);
|
|
91
|
-
}
|
|
92
|
-
|
|
113
|
+
} // 处理海康视频
|
|
114
|
+
|
|
115
|
+
|
|
93
116
|
if (this.type === 'hk_ws') {
|
|
94
117
|
this.player = new window.JSPlugin({
|
|
95
118
|
szId: container.id,
|
|
@@ -102,27 +125,37 @@ var Player = /*#__PURE__*/function () {
|
|
|
102
125
|
}
|
|
103
126
|
}
|
|
104
127
|
/** 播放 */
|
|
128
|
+
|
|
129
|
+
|
|
105
130
|
_createClass(Player, [{
|
|
106
131
|
key: "play",
|
|
107
132
|
value: function play() {
|
|
133
|
+
console.log(this.url, this.type);
|
|
134
|
+
|
|
108
135
|
if (this.type === 'flv') {
|
|
109
136
|
var player = this.player;
|
|
110
137
|
return player.play();
|
|
111
138
|
}
|
|
139
|
+
|
|
112
140
|
if (this.type === 'hls') {
|
|
113
141
|
return this.video.play();
|
|
114
142
|
}
|
|
143
|
+
|
|
115
144
|
if (this.type === 'hk_ws') {
|
|
116
145
|
var _player = this.player;
|
|
146
|
+
|
|
117
147
|
var result = _player.JS_Play(this.url, {
|
|
118
148
|
playURL: this.url,
|
|
119
149
|
mode: 0
|
|
120
150
|
}, 0);
|
|
151
|
+
|
|
121
152
|
return result;
|
|
122
153
|
}
|
|
154
|
+
|
|
123
155
|
return Promise.resolve();
|
|
124
156
|
}
|
|
125
157
|
/** 回放 */
|
|
158
|
+
|
|
126
159
|
}, {
|
|
127
160
|
key: "playBack",
|
|
128
161
|
value: function playBack() {
|
|
@@ -138,6 +171,7 @@ var Player = /*#__PURE__*/function () {
|
|
|
138
171
|
}
|
|
139
172
|
}
|
|
140
173
|
/** 销毁 */
|
|
174
|
+
|
|
141
175
|
}, {
|
|
142
176
|
key: "destroy",
|
|
143
177
|
value: function destroy() {
|
|
@@ -147,18 +181,24 @@ var Player = /*#__PURE__*/function () {
|
|
|
147
181
|
this.player = null;
|
|
148
182
|
this.video.remove();
|
|
149
183
|
}
|
|
184
|
+
|
|
150
185
|
if (this.type === 'hls') {
|
|
151
186
|
var _player2 = this.player;
|
|
187
|
+
|
|
152
188
|
_player2.destroy();
|
|
189
|
+
|
|
153
190
|
this.player = null;
|
|
154
191
|
this.video.remove();
|
|
155
192
|
}
|
|
193
|
+
|
|
156
194
|
if (this.type === 'hk_ws') {
|
|
157
195
|
var _player3 = this.player;
|
|
196
|
+
|
|
158
197
|
_player3.JS_Stop(1);
|
|
159
198
|
}
|
|
160
199
|
}
|
|
161
200
|
/** 截图 */
|
|
201
|
+
|
|
162
202
|
}, {
|
|
163
203
|
key: "capture",
|
|
164
204
|
value: function capture() {
|
|
@@ -167,6 +207,7 @@ var Player = /*#__PURE__*/function () {
|
|
|
167
207
|
var time = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
168
208
|
var name = captureName;
|
|
169
209
|
if (time) name += "-".concat((0, _moment["default"])().format('YYYYMMDDHHmmss'));
|
|
210
|
+
|
|
170
211
|
if (this.type === 'hk_ws') {
|
|
171
212
|
var player = this.player;
|
|
172
213
|
if (player) player.JS_CapturePicture(1, name, 'JPEG', function (res) {
|
|
@@ -177,6 +218,7 @@ var Player = /*#__PURE__*/function () {
|
|
|
177
218
|
}
|
|
178
219
|
}
|
|
179
220
|
/** 尺寸重置 */
|
|
221
|
+
|
|
180
222
|
}, {
|
|
181
223
|
key: "resize",
|
|
182
224
|
value: function resize() {
|
|
@@ -189,6 +231,7 @@ var Player = /*#__PURE__*/function () {
|
|
|
189
231
|
* 设置音量
|
|
190
232
|
* @param value
|
|
191
233
|
*/
|
|
234
|
+
|
|
192
235
|
}, {
|
|
193
236
|
key: "setVolume",
|
|
194
237
|
value: function setVolume(value) {
|
|
@@ -196,11 +239,14 @@ var Player = /*#__PURE__*/function () {
|
|
|
196
239
|
var player = this.player;
|
|
197
240
|
player.volume = value / 100;
|
|
198
241
|
}
|
|
242
|
+
|
|
199
243
|
if (this.type === 'hls') {
|
|
200
244
|
this.video.volume = value / 100;
|
|
201
245
|
}
|
|
246
|
+
|
|
202
247
|
if (this.type === 'hk_ws') {
|
|
203
248
|
var _player4 = this.player;
|
|
249
|
+
|
|
204
250
|
_player4.JS_SetVolume(1, value);
|
|
205
251
|
}
|
|
206
252
|
}
|
|
@@ -208,19 +254,23 @@ var Player = /*#__PURE__*/function () {
|
|
|
208
254
|
* 设置播放速度
|
|
209
255
|
* @param speed
|
|
210
256
|
*/
|
|
257
|
+
|
|
211
258
|
}, {
|
|
212
259
|
key: "setSpeed",
|
|
213
260
|
value: function setSpeed(speed) {
|
|
214
261
|
if (this.type === 'hk_ws') {
|
|
215
262
|
var player = this.player;
|
|
263
|
+
|
|
216
264
|
if (this.preSpeed / speed === 2) {
|
|
217
265
|
player.JS_Slow(1);
|
|
218
266
|
}
|
|
267
|
+
|
|
219
268
|
if (this.preSpeed / speed === 4) {
|
|
220
269
|
player.JS_Slow(1).then(function () {
|
|
221
270
|
return player.JS_Slow(1);
|
|
222
271
|
});
|
|
223
272
|
}
|
|
273
|
+
|
|
224
274
|
if (this.preSpeed / speed === 8) {
|
|
225
275
|
player.JS_Slow(1).then(function () {
|
|
226
276
|
return player.JS_Slow(1);
|
|
@@ -228,6 +278,7 @@ var Player = /*#__PURE__*/function () {
|
|
|
228
278
|
return player.JS_Slow(1);
|
|
229
279
|
});
|
|
230
280
|
}
|
|
281
|
+
|
|
231
282
|
if (this.preSpeed / speed === 16) {
|
|
232
283
|
player.JS_Slow(1).then(function () {
|
|
233
284
|
return player.JS_Slow(1);
|
|
@@ -237,14 +288,17 @@ var Player = /*#__PURE__*/function () {
|
|
|
237
288
|
return player.JS_Slow(1);
|
|
238
289
|
});
|
|
239
290
|
}
|
|
291
|
+
|
|
240
292
|
if (speed / this.preSpeed === 2) {
|
|
241
293
|
player.JS_Fast(1);
|
|
242
294
|
}
|
|
295
|
+
|
|
243
296
|
if (speed / this.preSpeed === 4) {
|
|
244
297
|
player.JS_Fast(1).then(function () {
|
|
245
298
|
return player.JS_Fast(1);
|
|
246
299
|
});
|
|
247
300
|
}
|
|
301
|
+
|
|
248
302
|
if (speed / this.preSpeed === 8) {
|
|
249
303
|
player.JS_Fast(1).then(function () {
|
|
250
304
|
return player.JS_Fast(1);
|
|
@@ -252,6 +306,7 @@ var Player = /*#__PURE__*/function () {
|
|
|
252
306
|
return player.JS_Fast(1);
|
|
253
307
|
});
|
|
254
308
|
}
|
|
309
|
+
|
|
255
310
|
if (speed / this.preSpeed === 16) {
|
|
256
311
|
player.JS_Fast(1).then(function () {
|
|
257
312
|
return player.JS_Fast(1);
|
|
@@ -261,6 +316,7 @@ var Player = /*#__PURE__*/function () {
|
|
|
261
316
|
return player.JS_Fast(1);
|
|
262
317
|
});
|
|
263
318
|
}
|
|
319
|
+
|
|
264
320
|
this.preSpeed = speed;
|
|
265
321
|
} else {
|
|
266
322
|
this.video.playbackRate = speed;
|
|
@@ -270,19 +326,24 @@ var Player = /*#__PURE__*/function () {
|
|
|
270
326
|
* 时间更新事件
|
|
271
327
|
* @param callback 回调函数
|
|
272
328
|
*/
|
|
329
|
+
|
|
273
330
|
}, {
|
|
274
331
|
key: "onTimeUpdate",
|
|
275
332
|
value: function onTimeUpdate(callback) {
|
|
276
333
|
var _this = this;
|
|
334
|
+
|
|
277
335
|
var _a;
|
|
336
|
+
|
|
278
337
|
this.video.addEventListener('timeupdate', function () {
|
|
279
338
|
var currentTime = _this.video.currentTime;
|
|
339
|
+
|
|
280
340
|
if (_this.type === 'hk_ws' && _this.seekTime) {
|
|
281
341
|
currentTime = currentTime + _this.seekTime.diff(_this.startTime, 'seconds');
|
|
282
342
|
}
|
|
343
|
+
|
|
283
344
|
callback(currentTime, _this.type === 'hk_ws' ? _this.preSpeed : _this.video.playbackRate);
|
|
284
|
-
});
|
|
285
|
-
|
|
345
|
+
}); // 增加hw_ws 流播放结束回调
|
|
346
|
+
|
|
286
347
|
var player = this.player;
|
|
287
348
|
(_a = player === null || player === void 0 ? void 0 : player.JS_SetWindowControlCallback) === null || _a === void 0 ? void 0 : _a.call(player, {
|
|
288
349
|
StreamEnd: function StreamEnd() {
|
|
@@ -291,33 +352,41 @@ var Player = /*#__PURE__*/function () {
|
|
|
291
352
|
});
|
|
292
353
|
}
|
|
293
354
|
/** 跳转到 */
|
|
355
|
+
|
|
294
356
|
}, {
|
|
295
357
|
key: "seekTo",
|
|
296
358
|
value: function seekTo(time) {
|
|
297
359
|
var _a;
|
|
360
|
+
|
|
298
361
|
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
299
362
|
var player, seekTime;
|
|
300
363
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
301
|
-
while (1)
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
364
|
+
while (1) {
|
|
365
|
+
switch (_context.prev = _context.next) {
|
|
366
|
+
case 0:
|
|
367
|
+
if (!(this.type === 'hk_ws')) {
|
|
368
|
+
_context.next = 8;
|
|
369
|
+
break;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
player = this.player;
|
|
373
|
+
seekTime = (_a = (0, _moment["default"])(this.startTime)) === null || _a === void 0 ? void 0 : _a.add(time, 'seconds');
|
|
374
|
+
_context.next = 5;
|
|
375
|
+
return player.JS_Seek(1, (0, _utils.getHKTimeString)(seekTime), (0, _utils.getHKTimeString)(this.endTime));
|
|
376
|
+
|
|
377
|
+
case 5:
|
|
378
|
+
this.seekTime = seekTime;
|
|
379
|
+
_context.next = 10;
|
|
305
380
|
break;
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
case 8:
|
|
316
|
-
this.video.currentTime = time;
|
|
317
|
-
return _context.abrupt("return", Promise.resolve());
|
|
318
|
-
case 10:
|
|
319
|
-
case "end":
|
|
320
|
-
return _context.stop();
|
|
381
|
+
|
|
382
|
+
case 8:
|
|
383
|
+
this.video.currentTime = time;
|
|
384
|
+
return _context.abrupt("return", Promise.resolve());
|
|
385
|
+
|
|
386
|
+
case 10:
|
|
387
|
+
case "end":
|
|
388
|
+
return _context.stop();
|
|
389
|
+
}
|
|
321
390
|
}
|
|
322
391
|
}, _callee, this);
|
|
323
392
|
}));
|
|
@@ -326,6 +395,7 @@ var Player = /*#__PURE__*/function () {
|
|
|
326
395
|
* 暂停播放
|
|
327
396
|
* @param callback 回调函数
|
|
328
397
|
*/
|
|
398
|
+
|
|
329
399
|
}, {
|
|
330
400
|
key: "pause",
|
|
331
401
|
value: function pause(callback) {
|
|
@@ -343,6 +413,7 @@ var Player = /*#__PURE__*/function () {
|
|
|
343
413
|
* 恢复播放
|
|
344
414
|
* @param callback 回调函数
|
|
345
415
|
*/
|
|
416
|
+
|
|
346
417
|
}, {
|
|
347
418
|
key: "resume",
|
|
348
419
|
value: function resume(callback) {
|
|
@@ -360,6 +431,7 @@ var Player = /*#__PURE__*/function () {
|
|
|
360
431
|
* 开始对讲
|
|
361
432
|
* @param url 对讲地址
|
|
362
433
|
*/
|
|
434
|
+
|
|
363
435
|
}, {
|
|
364
436
|
key: "startTalk",
|
|
365
437
|
value: function startTalk(url) {
|
|
@@ -367,12 +439,14 @@ var Player = /*#__PURE__*/function () {
|
|
|
367
439
|
var player = this.player;
|
|
368
440
|
return player.JS_StartTalk(url);
|
|
369
441
|
}
|
|
442
|
+
|
|
370
443
|
return Promise.reject();
|
|
371
444
|
}
|
|
372
445
|
/**
|
|
373
446
|
* 开始对讲
|
|
374
447
|
* @param state 状态
|
|
375
448
|
*/
|
|
449
|
+
|
|
376
450
|
}, {
|
|
377
451
|
key: "stopTalk",
|
|
378
452
|
value: function stopTalk() {
|
|
@@ -380,29 +454,33 @@ var Player = /*#__PURE__*/function () {
|
|
|
380
454
|
var player = this.player;
|
|
381
455
|
return player.JS_StopTalk();
|
|
382
456
|
}
|
|
457
|
+
|
|
383
458
|
return Promise.reject();
|
|
384
459
|
}
|
|
385
460
|
}]);
|
|
461
|
+
|
|
386
462
|
return Player;
|
|
387
463
|
}();
|
|
388
464
|
/**
|
|
389
465
|
* 截图
|
|
390
466
|
* @param video
|
|
391
467
|
*/
|
|
468
|
+
|
|
469
|
+
|
|
392
470
|
var Capture = function Capture(video, name, callback) {
|
|
393
471
|
var canvas = document.createElement('canvas');
|
|
394
472
|
canvas.width = video.videoWidth;
|
|
395
473
|
canvas.height = video.videoHeight;
|
|
396
474
|
var context = canvas.getContext('2d');
|
|
475
|
+
|
|
397
476
|
if (context) {
|
|
398
477
|
context.drawImage(video, 0, 0, canvas.width, canvas.height);
|
|
399
478
|
var dataURL;
|
|
400
479
|
canvas.toBlob(function (blob) {
|
|
401
480
|
if (blob) {
|
|
402
|
-
dataURL = URL.createObjectURL(blob);
|
|
403
|
-
|
|
404
|
-
callback && callback(dataURL);
|
|
405
|
-
// link.href = dataURL;
|
|
481
|
+
dataURL = URL.createObjectURL(blob); // const link = document.createElement('a');
|
|
482
|
+
|
|
483
|
+
callback && callback(dataURL); // link.href = dataURL;
|
|
406
484
|
// link.download = `${name}.png`;
|
|
407
485
|
// link.style.display = 'none';
|
|
408
486
|
// document.body.appendChild(link);
|
|
@@ -413,6 +491,7 @@ var Capture = function Capture(video, name, callback) {
|
|
|
413
491
|
});
|
|
414
492
|
}
|
|
415
493
|
};
|
|
494
|
+
|
|
416
495
|
var _default = Player;
|
|
417
496
|
exports["default"] = _default;
|
|
418
497
|
//# sourceMappingURL=index.js.map
|