@vtx/player 1.0.14 → 1.1.1
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 +51 -75
- package/lib/api/fetch.js.map +1 -1
- package/lib/api/index.js +18 -62
- package/lib/api/index.js.map +1 -1
- package/lib/api/types.d.ts +5 -5
- package/lib/bill-player/index.js +59 -111
- package/lib/bill-player/index.js.map +1 -1
- package/lib/bill-player/style/css.js +0 -9
- package/lib/bill-player/style/css.js.map +1 -1
- package/lib/bill-player/style/index.js +0 -9
- package/lib/bill-player/style/index.js.map +1 -1
- package/lib/components/set-tag-video/index.js +6 -34
- 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 +3 -14
- 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 +10 -38
- 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 +2 -9
- 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 +0 -4
- package/lib/context/index.js.map +1 -1
- package/lib/controls/index.d.ts +3 -3
- package/lib/controls/index.js +33 -97
- package/lib/controls/index.js.map +1 -1
- package/lib/controls/style/css.js +0 -5
- package/lib/controls/style/css.js.map +1 -1
- package/lib/controls/style/index.js +0 -5
- package/lib/controls/style/index.js.map +1 -1
- package/lib/history-control/index.d.ts +2 -2
- package/lib/history-control/index.js +57 -114
- package/lib/history-control/index.js.map +1 -1
- package/lib/history-control/style/css.js +0 -6
- package/lib/history-control/style/css.js.map +1 -1
- package/lib/history-control/style/index.js +0 -6
- package/lib/history-control/style/index.js.map +1 -1
- package/lib/history-control-v2/components/grid-item/index.js +32 -70
- package/lib/history-control-v2/components/grid-item/index.js.map +1 -1
- package/lib/history-control-v2/components/panel/index.js +36 -105
- package/lib/history-control-v2/components/panel/index.js.map +1 -1
- package/lib/history-control-v2/context.js +0 -2
- 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 +95 -163
- package/lib/history-control-v2/index.js.map +1 -1
- package/lib/history-control-v2/style/css.js +0 -10
- package/lib/history-control-v2/style/css.js.map +1 -1
- package/lib/history-control-v2/style/index.js +0 -10
- package/lib/history-control-v2/style/index.js.map +1 -1
- package/lib/history-control-v2/utils.js +1 -21
- 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 +73 -118
- package/lib/history-player/index.js.map +1 -1
- package/lib/history-player/style/css.js +0 -3
- package/lib/history-player/style/css.js.map +1 -1
- package/lib/history-player/style/index.js +0 -3
- package/lib/history-player/style/index.js.map +1 -1
- package/lib/hooks/useSettings.js +1 -6
- package/lib/hooks/useSettings.js.map +1 -1
- package/lib/icons/index.js +23 -171
- package/lib/icons/index.js.map +1 -1
- package/lib/index.js +0 -10
- package/lib/index.js.map +1 -1
- package/lib/live-channel-player/index.js +31 -67
- package/lib/live-channel-player/index.js.map +1 -1
- package/lib/live-channel-player/style/css.js +0 -1
- package/lib/live-channel-player/style/css.js.map +1 -1
- package/lib/live-channel-player/style/index.js +0 -1
- 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 +32 -83
- package/lib/live-control/index.js.map +1 -1
- package/lib/live-control/style/css.js +0 -4
- package/lib/live-control/style/css.js.map +1 -1
- package/lib/live-control/style/index.js +0 -4
- 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 +53 -125
- package/lib/live-control-v2/index.js.map +1 -1
- package/lib/live-control-v2/style/css.js +0 -7
- package/lib/live-control-v2/style/css.js.map +1 -1
- package/lib/live-control-v2/style/index.js +0 -7
- package/lib/live-control-v2/style/index.js.map +1 -1
- package/lib/live-player/index.js +31 -62
- package/lib/live-player/index.js.map +1 -1
- package/lib/live-player/style/css.js +0 -2
- package/lib/live-player/style/css.js.map +1 -1
- package/lib/live-player/style/index.js +0 -2
- package/lib/live-player/style/index.js.map +1 -1
- package/lib/player/index.d.ts +1 -1
- package/lib/player/index.js +78 -136
- package/lib/player/index.js.map +1 -1
- package/lib/typings/h5player.d.ts +2 -0
- package/lib/utils/index.d.ts +1 -1
- package/lib/utils/index.js +8 -74
- package/lib/utils/index.js.map +1 -1
- package/package.json +1 -1
package/lib/player/index.js
CHANGED
|
@@ -1,37 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
6
|
exports["default"] = void 0;
|
|
9
|
-
|
|
10
7
|
var _utils = require("../utils");
|
|
11
|
-
|
|
12
8
|
var _flv = _interopRequireDefault(require("flv.js"));
|
|
13
|
-
|
|
14
9
|
var _hls = _interopRequireDefault(require("hls.js"));
|
|
15
|
-
|
|
16
10
|
var _moment = _interopRequireDefault(require("moment"));
|
|
17
|
-
|
|
18
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
|
-
|
|
20
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
21
|
-
|
|
12
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
13
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
22
14
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
23
|
-
|
|
24
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
25
|
-
|
|
15
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
26
16
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
27
|
-
|
|
17
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
18
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
28
19
|
var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
|
|
29
20
|
function adopt(value) {
|
|
30
21
|
return value instanceof P ? value : new P(function (resolve) {
|
|
31
22
|
resolve(value);
|
|
32
23
|
});
|
|
33
24
|
}
|
|
34
|
-
|
|
35
25
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
36
26
|
function fulfilled(value) {
|
|
37
27
|
try {
|
|
@@ -40,7 +30,6 @@ var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P
|
|
|
40
30
|
reject(e);
|
|
41
31
|
}
|
|
42
32
|
}
|
|
43
|
-
|
|
44
33
|
function rejected(value) {
|
|
45
34
|
try {
|
|
46
35
|
step(generator["throw"](value));
|
|
@@ -48,51 +37,41 @@ var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P
|
|
|
48
37
|
reject(e);
|
|
49
38
|
}
|
|
50
39
|
}
|
|
51
|
-
|
|
52
40
|
function step(result) {
|
|
53
41
|
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
54
42
|
}
|
|
55
|
-
|
|
56
43
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
57
44
|
});
|
|
58
45
|
};
|
|
59
|
-
|
|
60
46
|
/**
|
|
61
47
|
* 视频播放核心类
|
|
62
48
|
*/
|
|
63
49
|
var Player = /*#__PURE__*/function () {
|
|
64
50
|
function Player(params) {
|
|
65
51
|
_classCallCheck(this, Player);
|
|
66
|
-
|
|
67
52
|
this.player = null;
|
|
68
53
|
/** 之前的视频播放速度,用于处理海康音量控制 */
|
|
69
|
-
|
|
70
54
|
this.preSpeed = 1;
|
|
71
55
|
/** 视频播放流是否走代理 - 是强制走代理,否通过判断 http协议,走代理配置 */
|
|
72
|
-
|
|
73
56
|
var url = params.url,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
57
|
+
_params$enableAgent = params.enableAgent,
|
|
58
|
+
enableAgent = _params$enableAgent === void 0 ? false : _params$enableAgent,
|
|
59
|
+
container = params.container,
|
|
60
|
+
_params$live = params.live,
|
|
61
|
+
live = _params$live === void 0 ? true : _params$live,
|
|
62
|
+
type = params.type,
|
|
63
|
+
startTime = params.startTime,
|
|
64
|
+
endTime = params.endTime;
|
|
82
65
|
var playerParams = (0, _utils.getPlayerParams)(url, enableAgent, live);
|
|
83
66
|
this.type = type || playerParams.type; // 如果不传递type,则通过url解析type值
|
|
84
|
-
|
|
85
67
|
this.url = playerParams.url;
|
|
86
68
|
this.enableAgent = enableAgent;
|
|
87
69
|
this.startTime = startTime;
|
|
88
70
|
this.endTime = endTime;
|
|
89
71
|
var video = document.createElement('video'); // 生成video元素
|
|
90
|
-
|
|
91
72
|
video.className = 'vtx-player-video';
|
|
92
73
|
video.muted = true; //设置静音
|
|
93
|
-
|
|
94
74
|
this.video = video;
|
|
95
|
-
|
|
96
75
|
if (this.type === 'flv' && _flv["default"].isSupported() && video) {
|
|
97
76
|
container.appendChild(video);
|
|
98
77
|
this.player = _flv["default"].createPlayer({
|
|
@@ -102,64 +81,69 @@ var Player = /*#__PURE__*/function () {
|
|
|
102
81
|
});
|
|
103
82
|
this.player.attachMediaElement(this.video);
|
|
104
83
|
this.player.load();
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
84
|
+
}
|
|
85
|
+
// 处理hls格式视频
|
|
108
86
|
if (this.type === 'hls' && _hls["default"].isSupported() && video) {
|
|
109
87
|
container.appendChild(video);
|
|
110
88
|
this.player = new _hls["default"]();
|
|
111
89
|
this.player.loadSource(this.url);
|
|
112
90
|
this.player.attachMedia(this.video);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
|
|
91
|
+
}
|
|
92
|
+
// 处理海康视频
|
|
116
93
|
if (this.type === 'hk_ws') {
|
|
117
94
|
this.player = new window.JSPlugin({
|
|
118
95
|
szId: container.id,
|
|
119
|
-
szBasePath: './
|
|
96
|
+
szBasePath: './',
|
|
120
97
|
iMaxSplit: 1,
|
|
121
98
|
iCurrentSplit: 1
|
|
122
99
|
});
|
|
123
100
|
var wrapDiv = document.getElementById(container.id);
|
|
124
101
|
this.video = wrapDiv.getElementsByTagName('video')[0];
|
|
125
102
|
}
|
|
103
|
+
// 处理海康视频
|
|
104
|
+
if (this.type === 'hkcar_ws') {
|
|
105
|
+
var _wrapDiv = document.getElementById(container.id);
|
|
106
|
+
this.player = new window.JSPlugin({
|
|
107
|
+
szId: container.id,
|
|
108
|
+
iWidth: _wrapDiv.clientWidth,
|
|
109
|
+
iHeight: _wrapDiv.clientHeight,
|
|
110
|
+
iMaxSplit: 1,
|
|
111
|
+
iCurrentSplit: 1,
|
|
112
|
+
szBasePath: './resources/hkcar/',
|
|
113
|
+
oStyle: {
|
|
114
|
+
border: 'transparent',
|
|
115
|
+
borderSelect: 'transparent',
|
|
116
|
+
background: '#2b3d51'
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
126
120
|
}
|
|
127
121
|
/** 播放 */
|
|
128
|
-
|
|
129
|
-
|
|
130
122
|
_createClass(Player, [{
|
|
131
123
|
key: "play",
|
|
132
124
|
value: function play() {
|
|
133
|
-
console.log(this.url, this.type);
|
|
134
|
-
|
|
135
125
|
if (this.type === 'flv') {
|
|
136
126
|
var player = this.player;
|
|
137
127
|
return player.play();
|
|
138
128
|
}
|
|
139
|
-
|
|
140
129
|
if (this.type === 'hls') {
|
|
141
130
|
return this.video.play();
|
|
142
131
|
}
|
|
143
|
-
|
|
144
|
-
if (this.type === 'hk_ws') {
|
|
132
|
+
if (this.type === 'hk_ws' || this.type === 'hkcar_ws') {
|
|
145
133
|
var _player = this.player;
|
|
146
|
-
|
|
147
134
|
var result = _player.JS_Play(this.url, {
|
|
148
135
|
playURL: this.url,
|
|
149
136
|
mode: 0
|
|
150
137
|
}, 0);
|
|
151
|
-
|
|
152
138
|
return result;
|
|
153
139
|
}
|
|
154
|
-
|
|
155
140
|
return Promise.resolve();
|
|
156
141
|
}
|
|
157
142
|
/** 回放 */
|
|
158
|
-
|
|
159
143
|
}, {
|
|
160
144
|
key: "playBack",
|
|
161
145
|
value: function playBack() {
|
|
162
|
-
if (this.type === 'hk_ws') {
|
|
146
|
+
if (this.type === 'hk_ws' || this.type === 'hkcar_ws') {
|
|
163
147
|
var player = this.player;
|
|
164
148
|
var result = player.JS_Play(this.url, {
|
|
165
149
|
playURL: this.url,
|
|
@@ -171,7 +155,6 @@ var Player = /*#__PURE__*/function () {
|
|
|
171
155
|
}
|
|
172
156
|
}
|
|
173
157
|
/** 销毁 */
|
|
174
|
-
|
|
175
158
|
}, {
|
|
176
159
|
key: "destroy",
|
|
177
160
|
value: function destroy() {
|
|
@@ -181,24 +164,22 @@ var Player = /*#__PURE__*/function () {
|
|
|
181
164
|
this.player = null;
|
|
182
165
|
this.video.remove();
|
|
183
166
|
}
|
|
184
|
-
|
|
185
167
|
if (this.type === 'hls') {
|
|
186
168
|
var _player2 = this.player;
|
|
187
|
-
|
|
188
169
|
_player2.destroy();
|
|
189
|
-
|
|
190
170
|
this.player = null;
|
|
191
171
|
this.video.remove();
|
|
192
172
|
}
|
|
193
|
-
|
|
194
173
|
if (this.type === 'hk_ws') {
|
|
195
174
|
var _player3 = this.player;
|
|
196
|
-
|
|
197
175
|
_player3.JS_Stop(1);
|
|
198
176
|
}
|
|
177
|
+
if (this.type === 'hkcar_ws') {
|
|
178
|
+
var _player4 = this.player;
|
|
179
|
+
_player4.JS_DestroyWorker();
|
|
180
|
+
}
|
|
199
181
|
}
|
|
200
182
|
/** 截图 */
|
|
201
|
-
|
|
202
183
|
}, {
|
|
203
184
|
key: "capture",
|
|
204
185
|
value: function capture() {
|
|
@@ -207,8 +188,7 @@ var Player = /*#__PURE__*/function () {
|
|
|
207
188
|
var time = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
208
189
|
var name = captureName;
|
|
209
190
|
if (time) name += "-".concat((0, _moment["default"])().format('YYYYMMDDHHmmss'));
|
|
210
|
-
|
|
211
|
-
if (this.type === 'hk_ws') {
|
|
191
|
+
if (this.type === 'hk_ws' || this.type === 'hkcar_ws') {
|
|
212
192
|
var player = this.player;
|
|
213
193
|
if (player) player.JS_CapturePicture(1, name, 'JPEG', function (res) {
|
|
214
194
|
callback && callback(res);
|
|
@@ -218,11 +198,10 @@ var Player = /*#__PURE__*/function () {
|
|
|
218
198
|
}
|
|
219
199
|
}
|
|
220
200
|
/** 尺寸重置 */
|
|
221
|
-
|
|
222
201
|
}, {
|
|
223
202
|
key: "resize",
|
|
224
203
|
value: function resize() {
|
|
225
|
-
if (this.type === 'hk_ws') {
|
|
204
|
+
if (this.type === 'hk_ws' || this.type === 'hkcar_ws') {
|
|
226
205
|
var player = this.player;
|
|
227
206
|
player.JS_Resize();
|
|
228
207
|
}
|
|
@@ -231,7 +210,6 @@ var Player = /*#__PURE__*/function () {
|
|
|
231
210
|
* 设置音量
|
|
232
211
|
* @param value
|
|
233
212
|
*/
|
|
234
|
-
|
|
235
213
|
}, {
|
|
236
214
|
key: "setVolume",
|
|
237
215
|
value: function setVolume(value) {
|
|
@@ -239,38 +217,31 @@ var Player = /*#__PURE__*/function () {
|
|
|
239
217
|
var player = this.player;
|
|
240
218
|
player.volume = value / 100;
|
|
241
219
|
}
|
|
242
|
-
|
|
243
220
|
if (this.type === 'hls') {
|
|
244
221
|
this.video.volume = value / 100;
|
|
245
222
|
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
_player4.JS_SetVolume(1, value);
|
|
223
|
+
if (this.type === 'hk_ws' || this.type === 'hkcar_ws') {
|
|
224
|
+
var _player5 = this.player;
|
|
225
|
+
_player5.JS_SetVolume(1, value);
|
|
251
226
|
}
|
|
252
227
|
}
|
|
253
228
|
/**
|
|
254
229
|
* 设置播放速度
|
|
255
230
|
* @param speed
|
|
256
231
|
*/
|
|
257
|
-
|
|
258
232
|
}, {
|
|
259
233
|
key: "setSpeed",
|
|
260
234
|
value: function setSpeed(speed) {
|
|
261
|
-
if (this.type === 'hk_ws') {
|
|
235
|
+
if (this.type === 'hk_ws' || this.type === 'hkcar_ws') {
|
|
262
236
|
var player = this.player;
|
|
263
|
-
|
|
264
237
|
if (this.preSpeed / speed === 2) {
|
|
265
238
|
player.JS_Slow(1);
|
|
266
239
|
}
|
|
267
|
-
|
|
268
240
|
if (this.preSpeed / speed === 4) {
|
|
269
241
|
player.JS_Slow(1).then(function () {
|
|
270
242
|
return player.JS_Slow(1);
|
|
271
243
|
});
|
|
272
244
|
}
|
|
273
|
-
|
|
274
245
|
if (this.preSpeed / speed === 8) {
|
|
275
246
|
player.JS_Slow(1).then(function () {
|
|
276
247
|
return player.JS_Slow(1);
|
|
@@ -278,7 +249,6 @@ var Player = /*#__PURE__*/function () {
|
|
|
278
249
|
return player.JS_Slow(1);
|
|
279
250
|
});
|
|
280
251
|
}
|
|
281
|
-
|
|
282
252
|
if (this.preSpeed / speed === 16) {
|
|
283
253
|
player.JS_Slow(1).then(function () {
|
|
284
254
|
return player.JS_Slow(1);
|
|
@@ -288,17 +258,14 @@ var Player = /*#__PURE__*/function () {
|
|
|
288
258
|
return player.JS_Slow(1);
|
|
289
259
|
});
|
|
290
260
|
}
|
|
291
|
-
|
|
292
261
|
if (speed / this.preSpeed === 2) {
|
|
293
262
|
player.JS_Fast(1);
|
|
294
263
|
}
|
|
295
|
-
|
|
296
264
|
if (speed / this.preSpeed === 4) {
|
|
297
265
|
player.JS_Fast(1).then(function () {
|
|
298
266
|
return player.JS_Fast(1);
|
|
299
267
|
});
|
|
300
268
|
}
|
|
301
|
-
|
|
302
269
|
if (speed / this.preSpeed === 8) {
|
|
303
270
|
player.JS_Fast(1).then(function () {
|
|
304
271
|
return player.JS_Fast(1);
|
|
@@ -306,7 +273,6 @@ var Player = /*#__PURE__*/function () {
|
|
|
306
273
|
return player.JS_Fast(1);
|
|
307
274
|
});
|
|
308
275
|
}
|
|
309
|
-
|
|
310
276
|
if (speed / this.preSpeed === 16) {
|
|
311
277
|
player.JS_Fast(1).then(function () {
|
|
312
278
|
return player.JS_Fast(1);
|
|
@@ -316,7 +282,6 @@ var Player = /*#__PURE__*/function () {
|
|
|
316
282
|
return player.JS_Fast(1);
|
|
317
283
|
});
|
|
318
284
|
}
|
|
319
|
-
|
|
320
285
|
this.preSpeed = speed;
|
|
321
286
|
} else {
|
|
322
287
|
this.video.playbackRate = speed;
|
|
@@ -326,24 +291,19 @@ var Player = /*#__PURE__*/function () {
|
|
|
326
291
|
* 时间更新事件
|
|
327
292
|
* @param callback 回调函数
|
|
328
293
|
*/
|
|
329
|
-
|
|
330
294
|
}, {
|
|
331
295
|
key: "onTimeUpdate",
|
|
332
296
|
value: function onTimeUpdate(callback) {
|
|
333
297
|
var _this = this;
|
|
334
|
-
|
|
335
298
|
var _a;
|
|
336
|
-
|
|
337
299
|
this.video.addEventListener('timeupdate', function () {
|
|
338
300
|
var currentTime = _this.video.currentTime;
|
|
339
|
-
|
|
340
|
-
if (_this.type === 'hk_ws' && _this.seekTime) {
|
|
301
|
+
if (_this.type === 'hk_ws' || _this.type === 'hkcar_ws' && _this.seekTime) {
|
|
341
302
|
currentTime = currentTime + _this.seekTime.diff(_this.startTime, 'seconds');
|
|
342
303
|
}
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
304
|
+
callback(currentTime, _this.type === 'hk_ws' || _this.type === 'hkcar_ws' ? _this.preSpeed : _this.video.playbackRate);
|
|
305
|
+
});
|
|
306
|
+
// 增加hw_ws 流播放结束回调
|
|
347
307
|
var player = this.player;
|
|
348
308
|
(_a = player === null || player === void 0 ? void 0 : player.JS_SetWindowControlCallback) === null || _a === void 0 ? void 0 : _a.call(player, {
|
|
349
309
|
StreamEnd: function StreamEnd() {
|
|
@@ -352,41 +312,33 @@ var Player = /*#__PURE__*/function () {
|
|
|
352
312
|
});
|
|
353
313
|
}
|
|
354
314
|
/** 跳转到 */
|
|
355
|
-
|
|
356
315
|
}, {
|
|
357
316
|
key: "seekTo",
|
|
358
317
|
value: function seekTo(time) {
|
|
359
318
|
var _a;
|
|
360
|
-
|
|
361
319
|
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
362
320
|
var player, seekTime;
|
|
363
321
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
364
|
-
while (1) {
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
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;
|
|
322
|
+
while (1) switch (_context.prev = _context.next) {
|
|
323
|
+
case 0:
|
|
324
|
+
if (!(this.type === 'hk_ws' || this.type === 'hkcar_ws')) {
|
|
325
|
+
_context.next = 8;
|
|
380
326
|
break;
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
327
|
+
}
|
|
328
|
+
player = this.player;
|
|
329
|
+
seekTime = (_a = (0, _moment["default"])(this.startTime)) === null || _a === void 0 ? void 0 : _a.add(time, 'seconds');
|
|
330
|
+
_context.next = 5;
|
|
331
|
+
return player.JS_Seek(1, (0, _utils.getHKTimeString)(seekTime), (0, _utils.getHKTimeString)(this.endTime));
|
|
332
|
+
case 5:
|
|
333
|
+
this.seekTime = seekTime;
|
|
334
|
+
_context.next = 10;
|
|
335
|
+
break;
|
|
336
|
+
case 8:
|
|
337
|
+
this.video.currentTime = time;
|
|
338
|
+
return _context.abrupt("return", Promise.resolve());
|
|
339
|
+
case 10:
|
|
340
|
+
case "end":
|
|
341
|
+
return _context.stop();
|
|
390
342
|
}
|
|
391
343
|
}, _callee, this);
|
|
392
344
|
}));
|
|
@@ -395,11 +347,10 @@ var Player = /*#__PURE__*/function () {
|
|
|
395
347
|
* 暂停播放
|
|
396
348
|
* @param callback 回调函数
|
|
397
349
|
*/
|
|
398
|
-
|
|
399
350
|
}, {
|
|
400
351
|
key: "pause",
|
|
401
352
|
value: function pause(callback) {
|
|
402
|
-
if (this.type === 'hk_ws') {
|
|
353
|
+
if (this.type === 'hk_ws' || this.type === 'hkcar_ws') {
|
|
403
354
|
var player = this.player;
|
|
404
355
|
player.JS_Pause(1).then(function () {
|
|
405
356
|
return callback && callback();
|
|
@@ -413,11 +364,10 @@ var Player = /*#__PURE__*/function () {
|
|
|
413
364
|
* 恢复播放
|
|
414
365
|
* @param callback 回调函数
|
|
415
366
|
*/
|
|
416
|
-
|
|
417
367
|
}, {
|
|
418
368
|
key: "resume",
|
|
419
369
|
value: function resume(callback) {
|
|
420
|
-
if (this.type === 'hk_ws') {
|
|
370
|
+
if (this.type === 'hk_ws' || this.type === 'hkcar_ws') {
|
|
421
371
|
var player = this.player;
|
|
422
372
|
player.JS_Resume(1).then(function () {
|
|
423
373
|
return callback && callback();
|
|
@@ -431,56 +381,49 @@ var Player = /*#__PURE__*/function () {
|
|
|
431
381
|
* 开始对讲
|
|
432
382
|
* @param url 对讲地址
|
|
433
383
|
*/
|
|
434
|
-
|
|
435
384
|
}, {
|
|
436
385
|
key: "startTalk",
|
|
437
386
|
value: function startTalk(url) {
|
|
438
|
-
if (this.type === 'hk_ws') {
|
|
387
|
+
if (this.type === 'hk_ws' || this.type === 'hkcar_ws') {
|
|
439
388
|
var player = this.player;
|
|
440
389
|
return player.JS_StartTalk(url);
|
|
441
390
|
}
|
|
442
|
-
|
|
443
391
|
return Promise.reject();
|
|
444
392
|
}
|
|
445
393
|
/**
|
|
446
394
|
* 开始对讲
|
|
447
395
|
* @param state 状态
|
|
448
396
|
*/
|
|
449
|
-
|
|
450
397
|
}, {
|
|
451
398
|
key: "stopTalk",
|
|
452
399
|
value: function stopTalk() {
|
|
453
|
-
if (this.type === 'hk_ws') {
|
|
400
|
+
if (this.type === 'hk_ws' || this.type === 'hkcar_ws') {
|
|
454
401
|
var player = this.player;
|
|
455
402
|
return player.JS_StopTalk();
|
|
456
403
|
}
|
|
457
|
-
|
|
458
404
|
return Promise.reject();
|
|
459
405
|
}
|
|
460
406
|
}]);
|
|
461
|
-
|
|
462
407
|
return Player;
|
|
463
408
|
}();
|
|
464
409
|
/**
|
|
465
410
|
* 截图
|
|
466
411
|
* @param video
|
|
467
412
|
*/
|
|
468
|
-
|
|
469
|
-
|
|
470
413
|
var Capture = function Capture(video, name, callback) {
|
|
471
414
|
var canvas = document.createElement('canvas');
|
|
472
415
|
canvas.width = video.videoWidth;
|
|
473
416
|
canvas.height = video.videoHeight;
|
|
474
417
|
var context = canvas.getContext('2d');
|
|
475
|
-
|
|
476
418
|
if (context) {
|
|
477
419
|
context.drawImage(video, 0, 0, canvas.width, canvas.height);
|
|
478
420
|
var dataURL;
|
|
479
421
|
canvas.toBlob(function (blob) {
|
|
480
422
|
if (blob) {
|
|
481
|
-
dataURL = URL.createObjectURL(blob);
|
|
482
|
-
|
|
483
|
-
callback && callback(dataURL);
|
|
423
|
+
dataURL = URL.createObjectURL(blob);
|
|
424
|
+
// const link = document.createElement('a');
|
|
425
|
+
callback && callback(dataURL);
|
|
426
|
+
// link.href = dataURL;
|
|
484
427
|
// link.download = `${name}.png`;
|
|
485
428
|
// link.style.display = 'none';
|
|
486
429
|
// document.body.appendChild(link);
|
|
@@ -491,7 +434,6 @@ var Capture = function Capture(video, name, callback) {
|
|
|
491
434
|
});
|
|
492
435
|
}
|
|
493
436
|
};
|
|
494
|
-
|
|
495
437
|
var _default = Player;
|
|
496
438
|
exports["default"] = _default;
|
|
497
439
|
//# sourceMappingURL=index.js.map
|