@cloud-app-dev/vidc 4.0.2 → 4.0.4
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/.dumirc.ts +17 -4
- package/es/LabelPlayer/111.png +0 -0
- package/es/LabelPlayer/demo.d.ts +2 -0
- package/es/LabelPlayer/demo.js +123 -0
- package/es/LabelPlayer/index.d.ts +21 -0
- package/es/LabelPlayer/index.js +169 -0
- package/es/LabelPlayer/index.less +24 -0
- package/es/LoaderScript/utils.js +3 -3
- package/es/Map/BasicMap/index.js +17 -41
- package/es/Map/ClusterLayer/demo.d.ts +3 -0
- package/es/Map/ClusterLayer/demo.js +22 -0
- package/es/Map/Config/index.d.ts +3 -1
- package/es/Map/Config/index.js +17 -32
- package/es/Map/Config/utils.d.ts +2 -2
- package/es/Map/Config/utils.js +40 -51
- package/es/Map/InfoWindow/index.d.ts +2 -1
- package/es/Map/InfoWindow/index.js +19 -32
- package/es/Map/SinglePoint/demo.d.ts +3 -0
- package/es/Map/SinglePoint/demo.js +16 -0
- package/es/Map/index.d.ts +1 -1
- package/es/Map/index.js +1 -1
- package/es/Map/interface.d.ts +14 -0
- package/es/Map3D/demo.d.ts +3 -0
- package/es/Map3D/demo.js +13 -0
- package/es/Map3D/index.d.ts +4 -0
- package/es/Map3D/index.js +84 -0
- package/es/Map3D/index.less +4 -0
- package/es/Player/api/index.js +53 -18
- package/es/Player/util.js +42 -15
- package/es/ScreenPlayer/Live.js +18 -14
- package/es/ScreenPlayer/PlayerWithExt.d.ts +1 -1
- package/es/ScreenPlayer/Record.js +127 -186
- package/es/ScreenPlayer/ScreenSelect.js +63 -35
- package/es/ScreenPlayer/index.less +163 -1
- package/es/ScreenPlayer/interface.d.ts +1 -0
- package/es/ScreenPlayer/utils.js +21 -11
- package/es/index.d.ts +2 -0
- package/es/index.js +2 -0
- package/es/utils.d.ts +5 -5
- package/es/utils.js +32 -35
- package/package.json +2 -2
|
@@ -1,37 +1,23 @@
|
|
|
1
1
|
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); }
|
|
2
|
-
|
|
3
2
|
import _useUpdateEffect from "ahooks/es/useUpdateEffect";
|
|
4
3
|
import _useMemoizedFn from "ahooks/es/useMemoizedFn";
|
|
5
4
|
var _excluded = ["list", "children", "oneWinExtTools", "allWinExtTools", "fpsDelay", "fps", "seekLoading"];
|
|
6
|
-
|
|
7
|
-
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; }
|
|
8
|
-
|
|
5
|
+
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; }
|
|
9
6
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
10
|
-
|
|
11
7
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
12
|
-
|
|
13
8
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
14
|
-
|
|
15
9
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
16
|
-
|
|
17
|
-
function
|
|
18
|
-
|
|
10
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
12
|
+
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); }
|
|
19
13
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
20
|
-
|
|
21
14
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
22
|
-
|
|
23
15
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
24
|
-
|
|
25
|
-
function
|
|
26
|
-
|
|
27
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
28
|
-
|
|
16
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
17
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
29
18
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
30
|
-
|
|
31
19
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
32
|
-
|
|
33
20
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
34
|
-
|
|
35
21
|
import { cloneDeep } from 'lodash-es';
|
|
36
22
|
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
37
23
|
import DisableMark from "../DisableMark";
|
|
@@ -54,39 +40,32 @@ var defaultState = {
|
|
|
54
40
|
begins: {}
|
|
55
41
|
};
|
|
56
42
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
};
|
|
43
|
+
// const getKey = (item: RecordItem) => `${item.cid}-${item.date}`;
|
|
44
|
+
|
|
60
45
|
/**
|
|
61
46
|
* @desc 录像设计的时间全部需要到毫秒
|
|
62
47
|
* @param param0
|
|
63
48
|
* @returns
|
|
64
49
|
*/
|
|
65
|
-
|
|
66
|
-
|
|
67
50
|
function RecordPlayer(_ref) {
|
|
68
51
|
var _props$defaultScreen;
|
|
69
|
-
|
|
70
52
|
var list = _ref.list,
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
53
|
+
children = _ref.children,
|
|
54
|
+
oneWinExtTools = _ref.oneWinExtTools,
|
|
55
|
+
allWinExtTools = _ref.allWinExtTools,
|
|
56
|
+
fpsDelay = _ref.fpsDelay,
|
|
57
|
+
fps = _ref.fps,
|
|
58
|
+
seekLoading = _ref.seekLoading,
|
|
59
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
79
60
|
var _useState = useState(_objectSpread(_objectSpread({}, cloneDeep(defaultState)), {}, {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
61
|
+
screenNum: (_props$defaultScreen = props.defaultScreen) !== null && _props$defaultScreen !== void 0 ? _props$defaultScreen : defaultState.screenNum
|
|
62
|
+
})),
|
|
63
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
64
|
+
state = _useState2[0],
|
|
65
|
+
setState = _useState2[1];
|
|
66
|
+
// 若外部来控制screenNum 则由外部完全控制
|
|
87
67
|
var screenNum = useMemo(function () {
|
|
88
68
|
var _props$screenNum;
|
|
89
|
-
|
|
90
69
|
return (_props$screenNum = props.screenNum) !== null && _props$screenNum !== void 0 ? _props$screenNum : state.screenNum;
|
|
91
70
|
}, [props.screenNum, state.screenNum]);
|
|
92
71
|
var domRef = useRef(null);
|
|
@@ -94,71 +73,66 @@ function RecordPlayer(_ref) {
|
|
|
94
73
|
return ScreenType.find(function (v) {
|
|
95
74
|
return v.name === screenNum;
|
|
96
75
|
});
|
|
97
|
-
}, [screenNum]);
|
|
76
|
+
}, [screenNum]);
|
|
77
|
+
var getKey = function getKey(item) {
|
|
78
|
+
return "".concat(item.cid, "-").concat(item.date, "-").concat(item.endDate, "-").concat(item.recordType);
|
|
79
|
+
};
|
|
98
80
|
|
|
81
|
+
// 填充数据扩充list.length
|
|
99
82
|
var screenList = useMemo(function () {
|
|
100
83
|
return mergeFill(screenNum, list, {
|
|
101
84
|
recordType: 1
|
|
102
85
|
});
|
|
103
86
|
}, [screenNum, list]);
|
|
104
|
-
|
|
105
87
|
var _useVideoFit = useVideoFit(domRef, []),
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
88
|
+
fit = _useVideoFit.fit,
|
|
89
|
+
toggleFit = _useVideoFit.toggleFit;
|
|
109
90
|
|
|
110
|
-
|
|
91
|
+
// 缓存所有player对象
|
|
92
|
+
var playerRef = useRef({});
|
|
111
93
|
|
|
94
|
+
// 获取选中player对象
|
|
112
95
|
var getPlayerItem = function getPlayerItem() {
|
|
113
96
|
var _playerRef$current, _playerRef$current2;
|
|
114
|
-
|
|
115
97
|
var item = screenList[state.selectIndex];
|
|
116
98
|
return item ? (_playerRef$current = playerRef.current) === null || _playerRef$current === void 0 ? void 0 : (_playerRef$current2 = _playerRef$current["".concat(getKey(item))]) === null || _playerRef$current2 === void 0 ? void 0 : _playerRef$current2.current : undefined;
|
|
117
|
-
};
|
|
118
|
-
|
|
99
|
+
};
|
|
119
100
|
|
|
101
|
+
// 当前窗口信息
|
|
120
102
|
var segmentItem = useMemo(function () {
|
|
121
103
|
return screenList[state.selectIndex] || {};
|
|
122
104
|
}, [state.selectIndex, screenList]);
|
|
123
105
|
var timeBegin = useMemo(function () {
|
|
124
106
|
var _state$begins, _segmentItem$date;
|
|
125
|
-
|
|
126
107
|
return (_state$begins = state.begins["".concat(getKey(segmentItem))]) !== null && _state$begins !== void 0 ? _state$begins : ((_segmentItem$date = segmentItem === null || segmentItem === void 0 ? void 0 : segmentItem.date) !== null && _segmentItem$date !== void 0 ? _segmentItem$date : 0) - state.timeMode / 2 * 3600 * 1000;
|
|
127
108
|
}, [segmentItem, state.begins, state.timeMode]);
|
|
128
109
|
var currentTime = useMemo(function () {
|
|
129
110
|
var _state$currentTimes;
|
|
130
|
-
|
|
131
111
|
var item = screenList[state.selectIndex];
|
|
132
|
-
|
|
133
112
|
if (!item) {
|
|
134
113
|
return undefined;
|
|
135
114
|
}
|
|
136
|
-
|
|
137
115
|
return (_state$currentTimes = state.currentTimes["".concat(getKey(item))]) !== null && _state$currentTimes !== void 0 ? _state$currentTimes : item.date;
|
|
138
116
|
}, [state.currentTimes, screenList, state.selectIndex]);
|
|
117
|
+
|
|
139
118
|
/**
|
|
140
119
|
* @desc seek hook
|
|
141
120
|
* 处理seek相关的包括索引和video current time
|
|
142
121
|
*/
|
|
143
|
-
|
|
144
122
|
useEffect(function () {
|
|
145
123
|
var _state$seekTo, _item$segments$findIn, _item$segments;
|
|
146
|
-
|
|
147
124
|
if (!state.seekTo) {
|
|
148
125
|
return;
|
|
149
|
-
}
|
|
150
|
-
|
|
126
|
+
}
|
|
151
127
|
|
|
128
|
+
// 寻找需要seek的item
|
|
152
129
|
var key = Object.keys((_state$seekTo = state.seekTo) !== null && _state$seekTo !== void 0 ? _state$seekTo : {}).find(function (k) {
|
|
153
130
|
var _state$seekTo2;
|
|
154
|
-
|
|
155
131
|
return ((_state$seekTo2 = state.seekTo) === null || _state$seekTo2 === void 0 ? void 0 : _state$seekTo2[k]) !== 0;
|
|
156
132
|
});
|
|
157
|
-
|
|
158
133
|
if (!key) {
|
|
159
134
|
return;
|
|
160
135
|
}
|
|
161
|
-
|
|
162
136
|
var seekTime = state.seekTo[key];
|
|
163
137
|
var item = list === null || list === void 0 ? void 0 : list.find(function (v) {
|
|
164
138
|
return !!v && "".concat(v.cid, "-").concat(v.date) === key;
|
|
@@ -166,113 +140,95 @@ function RecordPlayer(_ref) {
|
|
|
166
140
|
var index = (_item$segments$findIn = item === null || item === void 0 ? void 0 : (_item$segments = item.segments) === null || _item$segments === void 0 ? void 0 : _item$segments.findIndex(function (v) {
|
|
167
141
|
return seekTime >= v.beginTime && seekTime < v.endTime;
|
|
168
142
|
})) !== null && _item$segments$findIn !== void 0 ? _item$segments$findIn : -1;
|
|
169
|
-
|
|
170
143
|
if (index === -1) {
|
|
171
144
|
return;
|
|
172
|
-
}
|
|
173
|
-
|
|
145
|
+
}
|
|
174
146
|
|
|
147
|
+
// list变化导致ref被销毁,这里设计了一个处理机制,1s内重试5次,尝试获取新的ref,播放器初始化很快正常情况下都会获取到,还未获取到那么丢弃
|
|
175
148
|
var timer = 0;
|
|
176
|
-
|
|
177
|
-
function getPlay(_x) {
|
|
149
|
+
function getPlay(_x2) {
|
|
178
150
|
return _getPlay.apply(this, arguments);
|
|
179
151
|
}
|
|
180
|
-
|
|
181
152
|
function _getPlay() {
|
|
182
153
|
_getPlay = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(mapkey) {
|
|
183
154
|
var _playerRef$current3;
|
|
184
|
-
|
|
185
155
|
var playRef;
|
|
186
156
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
187
|
-
while (1) {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
}));
|
|
213
|
-
|
|
214
|
-
case 10:
|
|
215
|
-
return _context.abrupt("return", Promise.reject('seek执行失败!'));
|
|
216
|
-
|
|
217
|
-
case 11:
|
|
218
|
-
case "end":
|
|
219
|
-
return _context.stop();
|
|
220
|
-
}
|
|
157
|
+
while (1) switch (_context.prev = _context.next) {
|
|
158
|
+
case 0:
|
|
159
|
+
playRef = (_playerRef$current3 = playerRef.current) === null || _playerRef$current3 === void 0 ? void 0 : _playerRef$current3[mapkey];
|
|
160
|
+
if (!(playRef && playRef.current && playRef.current.api)) {
|
|
161
|
+
_context.next = 5;
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
164
|
+
return _context.abrupt("return", playRef.current);
|
|
165
|
+
case 5:
|
|
166
|
+
if (!(timer < 5)) {
|
|
167
|
+
_context.next = 10;
|
|
168
|
+
break;
|
|
169
|
+
}
|
|
170
|
+
timer++;
|
|
171
|
+
_context.next = 9;
|
|
172
|
+
return sleep(200);
|
|
173
|
+
case 9:
|
|
174
|
+
return _context.abrupt("return", sleep(200).then(function () {
|
|
175
|
+
return getPlay(mapkey);
|
|
176
|
+
}));
|
|
177
|
+
case 10:
|
|
178
|
+
return _context.abrupt("return", Promise.reject('seek执行失败!'));
|
|
179
|
+
case 11:
|
|
180
|
+
case "end":
|
|
181
|
+
return _context.stop();
|
|
221
182
|
}
|
|
222
183
|
}, _callee);
|
|
223
184
|
}));
|
|
224
185
|
return _getPlay.apply(this, arguments);
|
|
225
186
|
}
|
|
226
|
-
|
|
227
187
|
getPlay(key).then(function (play) {
|
|
228
188
|
if (play) {
|
|
229
189
|
play.api.seekTo(seekTime);
|
|
230
190
|
}
|
|
231
|
-
|
|
232
191
|
setState(function (old) {
|
|
233
192
|
return _objectSpread(_objectSpread({}, old), {}, {
|
|
234
193
|
seekTo: _objectSpread(_objectSpread({}, old.seekTo), {}, _defineProperty({}, key, 0))
|
|
235
194
|
});
|
|
236
195
|
});
|
|
237
|
-
});
|
|
238
|
-
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
199
|
+
}, [state.seekTo, list]);
|
|
239
200
|
|
|
201
|
+
// 更新状态
|
|
240
202
|
var updateState = function updateState(newState) {
|
|
241
203
|
var obj = {};
|
|
242
|
-
|
|
243
204
|
if (newState.hasOwnProperty('screenNum')) {
|
|
244
205
|
if (props.screenNum) {
|
|
245
206
|
var _props$screenChange;
|
|
246
|
-
|
|
247
207
|
// 若外部控制,不需要update state
|
|
248
208
|
(_props$screenChange = props.screenChange) === null || _props$screenChange === void 0 ? void 0 : _props$screenChange.call(props, newState.screenNum);
|
|
249
209
|
} else {
|
|
250
210
|
obj.screenNum = newState.screenNum;
|
|
251
|
-
}
|
|
252
|
-
|
|
211
|
+
}
|
|
253
212
|
|
|
213
|
+
// 修正选中索引
|
|
254
214
|
if (newState.screenNum && newState.screenNum < state.selectIndex) {
|
|
255
215
|
obj.selectIndex = 0;
|
|
256
216
|
}
|
|
257
217
|
}
|
|
258
|
-
|
|
259
218
|
if (newState.hasOwnProperty('mode')) {
|
|
260
219
|
var item = screenList[state.selectIndex];
|
|
261
|
-
|
|
262
220
|
var newModes = _objectSpread({}, state.modes);
|
|
263
|
-
|
|
264
221
|
newModes["".concat(getKey(item))] = newState.mode;
|
|
265
222
|
obj.modes = newModes;
|
|
266
223
|
}
|
|
267
|
-
|
|
268
224
|
if (newState.hasOwnProperty('timeMode')) {
|
|
269
225
|
obj.timeMode = newState.timeMode;
|
|
270
226
|
}
|
|
271
|
-
|
|
272
227
|
setState(function (old) {
|
|
273
228
|
return _objectSpread(_objectSpread({}, old), obj);
|
|
274
229
|
});
|
|
275
230
|
};
|
|
231
|
+
|
|
276
232
|
/**
|
|
277
233
|
* @desc currentTime两种情况:
|
|
278
234
|
* 1:time在片断内,修改cuurentTime,更新seekTo交给seek hook去处理;
|
|
@@ -281,42 +237,33 @@ function RecordPlayer(_ref) {
|
|
|
281
237
|
* @desc begin 处理时间轴开始绘制的刻度
|
|
282
238
|
*
|
|
283
239
|
*/
|
|
284
|
-
|
|
285
|
-
|
|
286
240
|
var onTimeChange = _useMemoizedFn(function (options, outTimeline) {
|
|
287
241
|
if (options.currentTime) {
|
|
288
242
|
var time = options.currentTime;
|
|
289
|
-
|
|
290
243
|
if (!Array.isArray(segmentItem.segments) || seekLoading) {
|
|
291
244
|
return;
|
|
292
245
|
}
|
|
293
|
-
|
|
294
246
|
if (outTimeline && segmentItem.recordType === 1) {
|
|
295
247
|
// 云录像 若点击了缺失的片段,直接忽略
|
|
296
248
|
console.warn('当前录像片段缺失!');
|
|
297
249
|
return;
|
|
298
250
|
}
|
|
299
|
-
|
|
300
251
|
if (time > Date.now()) {
|
|
301
252
|
console.warn('查询时间超出正常范围!');
|
|
302
253
|
return;
|
|
303
254
|
}
|
|
304
|
-
|
|
305
255
|
var index = segmentItem.segments.findIndex(function (v) {
|
|
306
256
|
return time >= v.beginTime && time < v.endTime;
|
|
307
257
|
});
|
|
308
|
-
|
|
309
258
|
if (index === -1) {
|
|
310
259
|
var _props$onTimeLineChan;
|
|
311
|
-
|
|
312
260
|
// 触发回调
|
|
313
261
|
(_props$onTimeLineChan = props.onTimeLineChange) === null || _props$onTimeLineChan === void 0 ? void 0 : _props$onTimeLineChan.call(props, time);
|
|
314
|
-
}
|
|
315
|
-
|
|
262
|
+
}
|
|
316
263
|
|
|
264
|
+
//更新time
|
|
317
265
|
setState(function (old) {
|
|
318
266
|
var currentTimes = _objectSpread({}, old.currentTimes);
|
|
319
|
-
|
|
320
267
|
var item = screenList[old.selectIndex];
|
|
321
268
|
currentTimes["".concat(getKey(item))] = time;
|
|
322
269
|
return _objectSpread(_objectSpread({}, old), {}, {
|
|
@@ -325,12 +272,10 @@ function RecordPlayer(_ref) {
|
|
|
325
272
|
});
|
|
326
273
|
});
|
|
327
274
|
}
|
|
328
|
-
|
|
329
275
|
if (options.begin) {
|
|
330
276
|
//更新begin
|
|
331
277
|
setState(function (old) {
|
|
332
278
|
var begins = _objectSpread({}, old.begins);
|
|
333
|
-
|
|
334
279
|
var item = screenList[old.selectIndex];
|
|
335
280
|
begins["".concat(getKey(item))] = options.begin;
|
|
336
281
|
return _objectSpread(_objectSpread({}, old), {}, {
|
|
@@ -339,7 +284,6 @@ function RecordPlayer(_ref) {
|
|
|
339
284
|
});
|
|
340
285
|
}
|
|
341
286
|
});
|
|
342
|
-
|
|
343
287
|
var _updatePlayer = function updatePlayer(player, index) {
|
|
344
288
|
var item = screenList[index];
|
|
345
289
|
playerRef.current["".concat(getKey(item))] = player;
|
|
@@ -347,58 +291,47 @@ function RecordPlayer(_ref) {
|
|
|
347
291
|
return _objectSpread({}, old);
|
|
348
292
|
});
|
|
349
293
|
};
|
|
294
|
+
|
|
350
295
|
/**
|
|
351
296
|
* 同步外部的selectIndex变化
|
|
352
297
|
*/
|
|
353
|
-
|
|
354
|
-
|
|
355
298
|
useEffect(function () {
|
|
356
299
|
if (typeof props.defaultSelectIndex !== 'number') {
|
|
357
300
|
return;
|
|
358
301
|
}
|
|
359
|
-
|
|
360
302
|
setState(function (old) {
|
|
361
303
|
if (old.selectIndex !== props.defaultSelectIndex) {
|
|
362
304
|
return _objectSpread(_objectSpread({}, old), {}, {
|
|
363
305
|
selectIndex: props.defaultSelectIndex
|
|
364
306
|
});
|
|
365
307
|
}
|
|
366
|
-
|
|
367
308
|
return old;
|
|
368
309
|
});
|
|
369
|
-
}, [props.defaultSelectIndex]);
|
|
370
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
310
|
+
}, [props.defaultSelectIndex]);
|
|
371
311
|
|
|
312
|
+
// index变化同步到父组件
|
|
313
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
372
314
|
_useUpdateEffect(function () {
|
|
373
315
|
var _props$onIndexChange;
|
|
374
|
-
|
|
375
316
|
(_props$onIndexChange = props.onIndexChange) === null || _props$onIndexChange === void 0 ? void 0 : _props$onIndexChange.call(props, state.selectIndex);
|
|
376
317
|
}, [state.selectIndex]);
|
|
377
318
|
/**
|
|
378
319
|
* 通知screenNum变化
|
|
379
320
|
*/
|
|
380
|
-
|
|
381
|
-
|
|
382
321
|
_useUpdateEffect(function () {
|
|
383
322
|
var _props$screenChange2;
|
|
384
|
-
|
|
385
323
|
(_props$screenChange2 = props.screenChange) === null || _props$screenChange2 === void 0 ? void 0 : _props$screenChange2.call(props, state.screenNum);
|
|
386
|
-
}, [state.screenNum]);
|
|
387
|
-
|
|
324
|
+
}, [state.screenNum]);
|
|
388
325
|
|
|
326
|
+
// 单窗口关闭,清楚缓存key
|
|
389
327
|
var onClose = _useMemoizedFn(function () {
|
|
390
328
|
var _props$onClose;
|
|
391
|
-
|
|
392
329
|
setState(function (old) {
|
|
393
330
|
var item = screenList[old.selectIndex];
|
|
394
|
-
|
|
395
331
|
if (item && item.cid && item.date) {
|
|
396
332
|
var key = "".concat(getKey(item));
|
|
397
|
-
|
|
398
333
|
var currentTimes = _objectSpread({}, old.currentTimes);
|
|
399
|
-
|
|
400
334
|
var modes = _objectSpread({}, old.modes);
|
|
401
|
-
|
|
402
335
|
delete currentTimes[key];
|
|
403
336
|
delete modes[key];
|
|
404
337
|
return _objectSpread(_objectSpread({}, old), {}, {
|
|
@@ -410,12 +343,11 @@ function RecordPlayer(_ref) {
|
|
|
410
343
|
}
|
|
411
344
|
});
|
|
412
345
|
(_props$onClose = props.onClose) === null || _props$onClose === void 0 ? void 0 : _props$onClose.call(props);
|
|
413
|
-
});
|
|
414
|
-
|
|
346
|
+
});
|
|
415
347
|
|
|
348
|
+
// 关闭所以,清楚缓存key
|
|
416
349
|
var onCloseAll = _useMemoizedFn(function () {
|
|
417
350
|
var _props$onCloseAll;
|
|
418
|
-
|
|
419
351
|
setState(function (old) {
|
|
420
352
|
return _objectSpread(_objectSpread({}, old), {}, {
|
|
421
353
|
modes: {},
|
|
@@ -424,57 +356,66 @@ function RecordPlayer(_ref) {
|
|
|
424
356
|
});
|
|
425
357
|
(_props$onCloseAll = props.onCloseAll) === null || _props$onCloseAll === void 0 ? void 0 : _props$onCloseAll.call(props);
|
|
426
358
|
});
|
|
427
|
-
|
|
359
|
+
useEffect(function () {
|
|
360
|
+
console.log(screenType, screenList, 'screenType');
|
|
361
|
+
}, [screenType, screenList]);
|
|
428
362
|
return /*#__PURE__*/_jsxs("div", {
|
|
429
363
|
className: "split-screen-player-wrapper split-screen-player-wrapper-record",
|
|
430
364
|
children: [/*#__PURE__*/_jsx("div", {
|
|
431
|
-
className: "player-layout",
|
|
365
|
+
className: "player-layout container".concat(screenType === null || screenType === void 0 ? void 0 : screenType.name),
|
|
432
366
|
ref: domRef,
|
|
433
367
|
children: screenList.map(function (item, index) {
|
|
434
|
-
var _state$modes
|
|
435
|
-
|
|
368
|
+
var _state$modes$getKey;
|
|
369
|
+
var className = state.selectIndex === index ? "item".concat(screenType === null || screenType === void 0 ? void 0 : screenType.name, "-").concat(index + 1, " player-current-index") : "item".concat(screenType === null || screenType === void 0 ? void 0 : screenType.name, "-").concat(index + 1);
|
|
370
|
+
var key = item.date && item.cid && item.endDate ? getKey(item) : "".concat(index);
|
|
371
|
+
var mode = (_state$modes$getKey = state.modes[getKey(item)]) !== null && _state$modes$getKey !== void 0 ? _state$modes$getKey : item.mode;
|
|
372
|
+
var itemClick = function itemClick() {
|
|
373
|
+
return setState(function (old) {
|
|
374
|
+
return _objectSpread(_objectSpread({}, old), {}, {
|
|
375
|
+
selectIndex: index
|
|
376
|
+
});
|
|
377
|
+
});
|
|
378
|
+
};
|
|
436
379
|
return item.recordType === 1 ? /*#__PURE__*/_createElement(SegmentPlayerWithExt, _objectSpread(_objectSpread({}, item), {}, {
|
|
437
380
|
segments: (item === null || item === void 0 ? void 0 : item.segments) || [],
|
|
438
|
-
key:
|
|
439
|
-
|
|
381
|
+
key: key
|
|
382
|
+
// key={item.date && item.cid ? `${item?.date}-${item.cid}` : `${index}`}
|
|
383
|
+
,
|
|
384
|
+
className: className
|
|
385
|
+
// className={state.selectIndex === index ? 'player-current-index' : ''}
|
|
386
|
+
,
|
|
440
387
|
updatePlayer: function updatePlayer(player) {
|
|
441
388
|
return _updatePlayer(player, index);
|
|
442
389
|
},
|
|
443
|
-
onClick:
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
style: {
|
|
451
|
-
width: screenType === null || screenType === void 0 ? void 0 : screenType.width,
|
|
452
|
-
height: screenType === null || screenType === void 0 ? void 0 : screenType.height
|
|
453
|
-
},
|
|
454
|
-
mode: (_state$modes = state.modes["".concat(item === null || item === void 0 ? void 0 : item.date, "-").concat(item.cid)]) !== null && _state$modes !== void 0 ? _state$modes : item.mode,
|
|
390
|
+
onClick: itemClick
|
|
391
|
+
// onClick={() => setState((old) => ({ ...old, selectIndex: index }))}
|
|
392
|
+
// style={{ width: screenType?.width, height: screenType?.height }}
|
|
393
|
+
,
|
|
394
|
+
mode: mode
|
|
395
|
+
// mode={state.modes[`${item?.date}-${item.cid}`] ?? item.mode}
|
|
396
|
+
,
|
|
455
397
|
fps: fps,
|
|
456
398
|
fpsDelay: fpsDelay,
|
|
457
399
|
httpLoading: item.loading,
|
|
458
400
|
screenIndex: index
|
|
459
401
|
})) : /*#__PURE__*/_createElement(FrontendPlayerWithExt, _objectSpread(_objectSpread({}, item), {}, {
|
|
460
|
-
className:
|
|
402
|
+
className: className
|
|
403
|
+
// className={state.selectIndex === index ? 'player-current-index' : ''}
|
|
404
|
+
,
|
|
461
405
|
segments: (item === null || item === void 0 ? void 0 : item.segments) || [],
|
|
462
406
|
updatePlayer: function updatePlayer(player) {
|
|
463
407
|
return _updatePlayer(player, index);
|
|
464
408
|
},
|
|
465
|
-
onClick:
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
width: screenType === null || screenType === void 0 ? void 0 : screenType.width,
|
|
476
|
-
height: screenType === null || screenType === void 0 ? void 0 : screenType.height
|
|
477
|
-
},
|
|
409
|
+
onClick: itemClick
|
|
410
|
+
// onClick={() => setState((old) => ({ ...old, selectIndex: index }))}
|
|
411
|
+
,
|
|
412
|
+
mode: mode
|
|
413
|
+
// mode={state.modes[`${item?.date}-${item.cid}`] ?? item.mode}
|
|
414
|
+
,
|
|
415
|
+
key: key
|
|
416
|
+
// key={item.date && item.cid ? `${item?.date}-${item.cid}` : `${index}`}
|
|
417
|
+
// style={{ width: screenType?.width, height: screenType?.height }}
|
|
418
|
+
,
|
|
478
419
|
httpLoading: item.loading,
|
|
479
420
|
getLocalRecordUrl: props.getLocalRecordUrl,
|
|
480
421
|
pluginDownloadUrl: props.pluginDownloadUrl,
|
|
@@ -491,8 +432,10 @@ function RecordPlayer(_ref) {
|
|
|
491
432
|
fit: fit,
|
|
492
433
|
toggleFit: toggleFit,
|
|
493
434
|
getPlayerItem: getPlayerItem,
|
|
494
|
-
screenNum: screenNum
|
|
495
|
-
mode
|
|
435
|
+
screenNum: screenNum
|
|
436
|
+
// mode={segmentItem?.cid ? state.modes[`${segmentItem.cid}-${segmentItem.date}`] : (segmentItem?.mode as PlayModeType)}
|
|
437
|
+
,
|
|
438
|
+
mode: state.modes[getKey(segmentItem)] || segmentItem.mode,
|
|
496
439
|
containerRef: domRef,
|
|
497
440
|
updateState: updateState,
|
|
498
441
|
onTimeChange: onTimeChange,
|
|
@@ -501,7 +444,6 @@ function RecordPlayer(_ref) {
|
|
|
501
444
|
timeMode: state.timeMode,
|
|
502
445
|
download: props.download ? function () {
|
|
503
446
|
var _props$download, _segmentItem$segments;
|
|
504
|
-
|
|
505
447
|
return (_props$download = props.download) === null || _props$download === void 0 ? void 0 : _props$download.call(props, (_segmentItem$segments = segmentItem.segments) !== null && _segmentItem$segments !== void 0 ? _segmentItem$segments : []);
|
|
506
448
|
} : undefined,
|
|
507
449
|
snapshot: props.snapshot,
|
|
@@ -525,5 +467,4 @@ function RecordPlayer(_ref) {
|
|
|
525
467
|
})]
|
|
526
468
|
});
|
|
527
469
|
}
|
|
528
|
-
|
|
529
470
|
export default RecordPlayer;
|