@vtx/player 1.0.12 → 1.0.13
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.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 +169 -96
- 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 +119 -42
- package/lib/player/index.js.map +1 -1
- package/lib/utils/index.d.ts +1 -1
- package/lib/utils/index.js +81 -9
- 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
|
-
|
|
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)(url, enableAgent, live, startTime, endTime);
|
|
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,6 +125,8 @@ 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() {
|
|
@@ -109,20 +134,26 @@ var Player = /*#__PURE__*/function () {
|
|
|
109
134
|
var player = this.player;
|
|
110
135
|
return player.play();
|
|
111
136
|
}
|
|
137
|
+
|
|
112
138
|
if (this.type === 'hls') {
|
|
113
139
|
return this.video.play();
|
|
114
140
|
}
|
|
141
|
+
|
|
115
142
|
if (this.type === 'hk_ws') {
|
|
116
143
|
var _player = this.player;
|
|
144
|
+
|
|
117
145
|
var result = _player.JS_Play(this.url, {
|
|
118
146
|
playURL: this.url,
|
|
119
147
|
mode: 0
|
|
120
148
|
}, 0);
|
|
149
|
+
|
|
121
150
|
return result;
|
|
122
151
|
}
|
|
152
|
+
|
|
123
153
|
return Promise.resolve();
|
|
124
154
|
}
|
|
125
155
|
/** 回放 */
|
|
156
|
+
|
|
126
157
|
}, {
|
|
127
158
|
key: "playBack",
|
|
128
159
|
value: function playBack() {
|
|
@@ -138,6 +169,7 @@ var Player = /*#__PURE__*/function () {
|
|
|
138
169
|
}
|
|
139
170
|
}
|
|
140
171
|
/** 销毁 */
|
|
172
|
+
|
|
141
173
|
}, {
|
|
142
174
|
key: "destroy",
|
|
143
175
|
value: function destroy() {
|
|
@@ -147,18 +179,24 @@ var Player = /*#__PURE__*/function () {
|
|
|
147
179
|
this.player = null;
|
|
148
180
|
this.video.remove();
|
|
149
181
|
}
|
|
182
|
+
|
|
150
183
|
if (this.type === 'hls') {
|
|
151
184
|
var _player2 = this.player;
|
|
185
|
+
|
|
152
186
|
_player2.destroy();
|
|
187
|
+
|
|
153
188
|
this.player = null;
|
|
154
189
|
this.video.remove();
|
|
155
190
|
}
|
|
191
|
+
|
|
156
192
|
if (this.type === 'hk_ws') {
|
|
157
193
|
var _player3 = this.player;
|
|
194
|
+
|
|
158
195
|
_player3.JS_Stop(1);
|
|
159
196
|
}
|
|
160
197
|
}
|
|
161
198
|
/** 截图 */
|
|
199
|
+
|
|
162
200
|
}, {
|
|
163
201
|
key: "capture",
|
|
164
202
|
value: function capture() {
|
|
@@ -167,6 +205,7 @@ var Player = /*#__PURE__*/function () {
|
|
|
167
205
|
var time = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
168
206
|
var name = captureName;
|
|
169
207
|
if (time) name += "-".concat((0, _moment["default"])().format('YYYYMMDDHHmmss'));
|
|
208
|
+
|
|
170
209
|
if (this.type === 'hk_ws') {
|
|
171
210
|
var player = this.player;
|
|
172
211
|
if (player) player.JS_CapturePicture(1, name, 'JPEG', function (res) {
|
|
@@ -177,6 +216,7 @@ var Player = /*#__PURE__*/function () {
|
|
|
177
216
|
}
|
|
178
217
|
}
|
|
179
218
|
/** 尺寸重置 */
|
|
219
|
+
|
|
180
220
|
}, {
|
|
181
221
|
key: "resize",
|
|
182
222
|
value: function resize() {
|
|
@@ -189,6 +229,7 @@ var Player = /*#__PURE__*/function () {
|
|
|
189
229
|
* 设置音量
|
|
190
230
|
* @param value
|
|
191
231
|
*/
|
|
232
|
+
|
|
192
233
|
}, {
|
|
193
234
|
key: "setVolume",
|
|
194
235
|
value: function setVolume(value) {
|
|
@@ -196,11 +237,14 @@ var Player = /*#__PURE__*/function () {
|
|
|
196
237
|
var player = this.player;
|
|
197
238
|
player.volume = value / 100;
|
|
198
239
|
}
|
|
240
|
+
|
|
199
241
|
if (this.type === 'hls') {
|
|
200
242
|
this.video.volume = value / 100;
|
|
201
243
|
}
|
|
244
|
+
|
|
202
245
|
if (this.type === 'hk_ws') {
|
|
203
246
|
var _player4 = this.player;
|
|
247
|
+
|
|
204
248
|
_player4.JS_SetVolume(1, value);
|
|
205
249
|
}
|
|
206
250
|
}
|
|
@@ -208,19 +252,23 @@ var Player = /*#__PURE__*/function () {
|
|
|
208
252
|
* 设置播放速度
|
|
209
253
|
* @param speed
|
|
210
254
|
*/
|
|
255
|
+
|
|
211
256
|
}, {
|
|
212
257
|
key: "setSpeed",
|
|
213
258
|
value: function setSpeed(speed) {
|
|
214
259
|
if (this.type === 'hk_ws') {
|
|
215
260
|
var player = this.player;
|
|
261
|
+
|
|
216
262
|
if (this.preSpeed / speed === 2) {
|
|
217
263
|
player.JS_Slow(1);
|
|
218
264
|
}
|
|
265
|
+
|
|
219
266
|
if (this.preSpeed / speed === 4) {
|
|
220
267
|
player.JS_Slow(1).then(function () {
|
|
221
268
|
return player.JS_Slow(1);
|
|
222
269
|
});
|
|
223
270
|
}
|
|
271
|
+
|
|
224
272
|
if (this.preSpeed / speed === 8) {
|
|
225
273
|
player.JS_Slow(1).then(function () {
|
|
226
274
|
return player.JS_Slow(1);
|
|
@@ -228,6 +276,7 @@ var Player = /*#__PURE__*/function () {
|
|
|
228
276
|
return player.JS_Slow(1);
|
|
229
277
|
});
|
|
230
278
|
}
|
|
279
|
+
|
|
231
280
|
if (this.preSpeed / speed === 16) {
|
|
232
281
|
player.JS_Slow(1).then(function () {
|
|
233
282
|
return player.JS_Slow(1);
|
|
@@ -237,14 +286,17 @@ var Player = /*#__PURE__*/function () {
|
|
|
237
286
|
return player.JS_Slow(1);
|
|
238
287
|
});
|
|
239
288
|
}
|
|
289
|
+
|
|
240
290
|
if (speed / this.preSpeed === 2) {
|
|
241
291
|
player.JS_Fast(1);
|
|
242
292
|
}
|
|
293
|
+
|
|
243
294
|
if (speed / this.preSpeed === 4) {
|
|
244
295
|
player.JS_Fast(1).then(function () {
|
|
245
296
|
return player.JS_Fast(1);
|
|
246
297
|
});
|
|
247
298
|
}
|
|
299
|
+
|
|
248
300
|
if (speed / this.preSpeed === 8) {
|
|
249
301
|
player.JS_Fast(1).then(function () {
|
|
250
302
|
return player.JS_Fast(1);
|
|
@@ -252,6 +304,7 @@ var Player = /*#__PURE__*/function () {
|
|
|
252
304
|
return player.JS_Fast(1);
|
|
253
305
|
});
|
|
254
306
|
}
|
|
307
|
+
|
|
255
308
|
if (speed / this.preSpeed === 16) {
|
|
256
309
|
player.JS_Fast(1).then(function () {
|
|
257
310
|
return player.JS_Fast(1);
|
|
@@ -261,6 +314,7 @@ var Player = /*#__PURE__*/function () {
|
|
|
261
314
|
return player.JS_Fast(1);
|
|
262
315
|
});
|
|
263
316
|
}
|
|
317
|
+
|
|
264
318
|
this.preSpeed = speed;
|
|
265
319
|
} else {
|
|
266
320
|
this.video.playbackRate = speed;
|
|
@@ -270,19 +324,24 @@ var Player = /*#__PURE__*/function () {
|
|
|
270
324
|
* 时间更新事件
|
|
271
325
|
* @param callback 回调函数
|
|
272
326
|
*/
|
|
327
|
+
|
|
273
328
|
}, {
|
|
274
329
|
key: "onTimeUpdate",
|
|
275
330
|
value: function onTimeUpdate(callback) {
|
|
276
331
|
var _this = this;
|
|
332
|
+
|
|
277
333
|
var _a;
|
|
334
|
+
|
|
278
335
|
this.video.addEventListener('timeupdate', function () {
|
|
279
336
|
var currentTime = _this.video.currentTime;
|
|
337
|
+
|
|
280
338
|
if (_this.type === 'hk_ws' && _this.seekTime) {
|
|
281
339
|
currentTime = currentTime + _this.seekTime.diff(_this.startTime, 'seconds');
|
|
282
340
|
}
|
|
341
|
+
|
|
283
342
|
callback(currentTime, _this.type === 'hk_ws' ? _this.preSpeed : _this.video.playbackRate);
|
|
284
|
-
});
|
|
285
|
-
|
|
343
|
+
}); // 增加hw_ws 流播放结束回调
|
|
344
|
+
|
|
286
345
|
var player = this.player;
|
|
287
346
|
(_a = player === null || player === void 0 ? void 0 : player.JS_SetWindowControlCallback) === null || _a === void 0 ? void 0 : _a.call(player, {
|
|
288
347
|
StreamEnd: function StreamEnd() {
|
|
@@ -291,33 +350,41 @@ var Player = /*#__PURE__*/function () {
|
|
|
291
350
|
});
|
|
292
351
|
}
|
|
293
352
|
/** 跳转到 */
|
|
353
|
+
|
|
294
354
|
}, {
|
|
295
355
|
key: "seekTo",
|
|
296
356
|
value: function seekTo(time) {
|
|
297
357
|
var _a;
|
|
358
|
+
|
|
298
359
|
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
299
360
|
var player, seekTime;
|
|
300
361
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
301
|
-
while (1)
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
362
|
+
while (1) {
|
|
363
|
+
switch (_context.prev = _context.next) {
|
|
364
|
+
case 0:
|
|
365
|
+
if (!(this.type === 'hk_ws')) {
|
|
366
|
+
_context.next = 8;
|
|
367
|
+
break;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
player = this.player;
|
|
371
|
+
seekTime = (_a = (0, _moment["default"])(this.startTime)) === null || _a === void 0 ? void 0 : _a.add(time, 'seconds');
|
|
372
|
+
_context.next = 5;
|
|
373
|
+
return player.JS_Seek(1, (0, _utils.getHKTimeString)(seekTime), (0, _utils.getHKTimeString)(this.endTime));
|
|
374
|
+
|
|
375
|
+
case 5:
|
|
376
|
+
this.seekTime = seekTime;
|
|
377
|
+
_context.next = 10;
|
|
305
378
|
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();
|
|
379
|
+
|
|
380
|
+
case 8:
|
|
381
|
+
this.video.currentTime = time;
|
|
382
|
+
return _context.abrupt("return", Promise.resolve());
|
|
383
|
+
|
|
384
|
+
case 10:
|
|
385
|
+
case "end":
|
|
386
|
+
return _context.stop();
|
|
387
|
+
}
|
|
321
388
|
}
|
|
322
389
|
}, _callee, this);
|
|
323
390
|
}));
|
|
@@ -326,6 +393,7 @@ var Player = /*#__PURE__*/function () {
|
|
|
326
393
|
* 暂停播放
|
|
327
394
|
* @param callback 回调函数
|
|
328
395
|
*/
|
|
396
|
+
|
|
329
397
|
}, {
|
|
330
398
|
key: "pause",
|
|
331
399
|
value: function pause(callback) {
|
|
@@ -343,6 +411,7 @@ var Player = /*#__PURE__*/function () {
|
|
|
343
411
|
* 恢复播放
|
|
344
412
|
* @param callback 回调函数
|
|
345
413
|
*/
|
|
414
|
+
|
|
346
415
|
}, {
|
|
347
416
|
key: "resume",
|
|
348
417
|
value: function resume(callback) {
|
|
@@ -360,6 +429,7 @@ var Player = /*#__PURE__*/function () {
|
|
|
360
429
|
* 开始对讲
|
|
361
430
|
* @param url 对讲地址
|
|
362
431
|
*/
|
|
432
|
+
|
|
363
433
|
}, {
|
|
364
434
|
key: "startTalk",
|
|
365
435
|
value: function startTalk(url) {
|
|
@@ -367,12 +437,14 @@ var Player = /*#__PURE__*/function () {
|
|
|
367
437
|
var player = this.player;
|
|
368
438
|
return player.JS_StartTalk(url);
|
|
369
439
|
}
|
|
440
|
+
|
|
370
441
|
return Promise.reject();
|
|
371
442
|
}
|
|
372
443
|
/**
|
|
373
444
|
* 开始对讲
|
|
374
445
|
* @param state 状态
|
|
375
446
|
*/
|
|
447
|
+
|
|
376
448
|
}, {
|
|
377
449
|
key: "stopTalk",
|
|
378
450
|
value: function stopTalk() {
|
|
@@ -380,29 +452,33 @@ var Player = /*#__PURE__*/function () {
|
|
|
380
452
|
var player = this.player;
|
|
381
453
|
return player.JS_StopTalk();
|
|
382
454
|
}
|
|
455
|
+
|
|
383
456
|
return Promise.reject();
|
|
384
457
|
}
|
|
385
458
|
}]);
|
|
459
|
+
|
|
386
460
|
return Player;
|
|
387
461
|
}();
|
|
388
462
|
/**
|
|
389
463
|
* 截图
|
|
390
464
|
* @param video
|
|
391
465
|
*/
|
|
466
|
+
|
|
467
|
+
|
|
392
468
|
var Capture = function Capture(video, name, callback) {
|
|
393
469
|
var canvas = document.createElement('canvas');
|
|
394
470
|
canvas.width = video.videoWidth;
|
|
395
471
|
canvas.height = video.videoHeight;
|
|
396
472
|
var context = canvas.getContext('2d');
|
|
473
|
+
|
|
397
474
|
if (context) {
|
|
398
475
|
context.drawImage(video, 0, 0, canvas.width, canvas.height);
|
|
399
476
|
var dataURL;
|
|
400
477
|
canvas.toBlob(function (blob) {
|
|
401
478
|
if (blob) {
|
|
402
|
-
dataURL = URL.createObjectURL(blob);
|
|
403
|
-
|
|
404
|
-
callback && callback(dataURL);
|
|
405
|
-
// link.href = dataURL;
|
|
479
|
+
dataURL = URL.createObjectURL(blob); // const link = document.createElement('a');
|
|
480
|
+
|
|
481
|
+
callback && callback(dataURL); // link.href = dataURL;
|
|
406
482
|
// link.download = `${name}.png`;
|
|
407
483
|
// link.style.display = 'none';
|
|
408
484
|
// document.body.appendChild(link);
|
|
@@ -413,6 +489,7 @@ var Capture = function Capture(video, name, callback) {
|
|
|
413
489
|
});
|
|
414
490
|
}
|
|
415
491
|
};
|
|
492
|
+
|
|
416
493
|
var _default = Player;
|
|
417
494
|
exports["default"] = _default;
|
|
418
495
|
//# sourceMappingURL=index.js.map
|