@cloud-app-dev/vidc 3.1.20 → 3.1.22
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/es/ScreenPlayer/Live.js +12 -14
- package/es/ScreenPlayer/Record.js +38 -28
- package/es/ScreenPlayer/interface.d.ts +9 -7
- package/package.json +1 -1
package/es/ScreenPlayer/Live.js
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import _useUpdateEffect from "ahooks/es/useUpdateEffect";
|
|
2
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
5
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
6
2
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
7
3
|
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."); }
|
|
8
4
|
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); }
|
|
@@ -34,7 +30,7 @@ function LivePlayer(_a) {
|
|
|
34
30
|
var _useState = useState({
|
|
35
31
|
screenNum: defaultScreen !== null && defaultScreen !== void 0 ? defaultScreen : 4,
|
|
36
32
|
selectIndex: defaultSelectIndex !== null && defaultSelectIndex !== void 0 ? defaultSelectIndex : 0,
|
|
37
|
-
modes:
|
|
33
|
+
modes: {}
|
|
38
34
|
}),
|
|
39
35
|
_useState2 = _slicedToArray(_useState, 2),
|
|
40
36
|
state = _useState2[0],
|
|
@@ -49,7 +45,7 @@ function LivePlayer(_a) {
|
|
|
49
45
|
return (_a = options.screenNum) !== null && _a !== void 0 ? _a : state.screenNum;
|
|
50
46
|
}, [options.screenNum, state.screenNum]);
|
|
51
47
|
// 缓存所有player对象
|
|
52
|
-
var playerRef = useRef(
|
|
48
|
+
var playerRef = useRef({});
|
|
53
49
|
var screenType = useMemo(function () {
|
|
54
50
|
return ScreenType.find(function (v) {
|
|
55
51
|
return v.name === screenNum;
|
|
@@ -60,8 +56,9 @@ function LivePlayer(_a) {
|
|
|
60
56
|
}, [list, screenNum]);
|
|
61
57
|
// 获取选中player对象
|
|
62
58
|
var getPlayerItem = function getPlayerItem() {
|
|
63
|
-
var _a;
|
|
64
|
-
|
|
59
|
+
var _a, _b;
|
|
60
|
+
var item = list[state.selectIndex];
|
|
61
|
+
return (_b = (_a = playerRef.current) === null || _a === void 0 ? void 0 : _a[item === null || item === void 0 ? void 0 : item.cid]) === null || _b === void 0 ? void 0 : _b.current;
|
|
65
62
|
};
|
|
66
63
|
// 更新状态
|
|
67
64
|
var updateState = function updateState(newState) {
|
|
@@ -79,8 +76,9 @@ function LivePlayer(_a) {
|
|
|
79
76
|
}
|
|
80
77
|
}
|
|
81
78
|
if (newState.hasOwnProperty('mode')) {
|
|
82
|
-
var
|
|
83
|
-
newModes
|
|
79
|
+
var item = list[state.selectIndex];
|
|
80
|
+
var newModes = Object.assign({}, state.modes);
|
|
81
|
+
newModes[item.cid] = newState.mode;
|
|
84
82
|
obj.modes = newModes;
|
|
85
83
|
}
|
|
86
84
|
setState(function (old) {
|
|
@@ -124,12 +122,12 @@ function LivePlayer(_a) {
|
|
|
124
122
|
className: "player-layout",
|
|
125
123
|
ref: domRef
|
|
126
124
|
}, screenList.map(function (item, index) {
|
|
127
|
-
var _a;
|
|
125
|
+
var _a, _b;
|
|
128
126
|
return /*#__PURE__*/React.createElement(LivePlayerWithExt, Object.assign({}, item, {
|
|
129
|
-
mode: (_a = state.modes[
|
|
130
|
-
key:
|
|
127
|
+
mode: (_a = state.modes[item.cid]) !== null && _a !== void 0 ? _a : item.mode,
|
|
128
|
+
key: (_b = item.url) !== null && _b !== void 0 ? _b : "".concat(index),
|
|
131
129
|
updatePlayer: function updatePlayer(player) {
|
|
132
|
-
return playerRef.current[
|
|
130
|
+
return playerRef.current[item.cid] = player;
|
|
133
131
|
},
|
|
134
132
|
className: state.selectIndex === index ? 'player-current-index' : '',
|
|
135
133
|
onClick: index !== state.selectIndex ? function () {
|
|
@@ -4,11 +4,11 @@ import "antd/lib/message/style";
|
|
|
4
4
|
import _message from "antd/lib/message";
|
|
5
5
|
import _usePrevious from "ahooks/es/usePrevious";
|
|
6
6
|
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; }
|
|
7
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
8
7
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
9
8
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
9
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
11
10
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
11
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
12
12
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
13
13
|
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."); }
|
|
14
14
|
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,18 +24,18 @@ import SegmentTimeLine from './SegmentTimeLine';
|
|
|
24
24
|
import useRecordList from './useRecordList';
|
|
25
25
|
import useVideoFit from './useVideoFit';
|
|
26
26
|
import DisableMark from '../DisableMark';
|
|
27
|
-
import "./index.css";
|
|
28
27
|
import { cloneDeep } from 'lodash-es';
|
|
28
|
+
import "./index.css";
|
|
29
29
|
var defaultState = {
|
|
30
30
|
screenNum: 4,
|
|
31
31
|
selectIndex: 0,
|
|
32
|
-
modes:
|
|
33
|
-
currentTimes:
|
|
32
|
+
modes: {},
|
|
33
|
+
currentTimes: {},
|
|
34
34
|
loading: false,
|
|
35
35
|
seekTo: 0,
|
|
36
36
|
mergeSegments: [],
|
|
37
37
|
timeMode: 24,
|
|
38
|
-
winLoadingStatus:
|
|
38
|
+
winLoadingStatus: {}
|
|
39
39
|
};
|
|
40
40
|
/**
|
|
41
41
|
* @desc 录像设计的时间全部需要到毫秒
|
|
@@ -80,6 +80,7 @@ function RecordPlayer(_a) {
|
|
|
80
80
|
return v.name === screenNum;
|
|
81
81
|
});
|
|
82
82
|
}, [screenNum]);
|
|
83
|
+
// 填充数据扩充list.length
|
|
83
84
|
var screenList = useMemo(function () {
|
|
84
85
|
return mergeFill(screenNum, list, {
|
|
85
86
|
recordType: 1
|
|
@@ -101,8 +102,9 @@ function RecordPlayer(_a) {
|
|
|
101
102
|
errorCallback: queryRecordErrorHandle !== null && queryRecordErrorHandle !== void 0 ? queryRecordErrorHandle : function () {},
|
|
102
103
|
loaddingCallback: function loaddingCallback(idx, loadding) {
|
|
103
104
|
return setState(function (old) {
|
|
104
|
-
var
|
|
105
|
-
status
|
|
105
|
+
var item = old.mergeSegments[idx];
|
|
106
|
+
var status = Object.assign({}, old.winLoadingStatus);
|
|
107
|
+
status["".concat(item.cid, "-").concat(item.date)] = loadding;
|
|
106
108
|
return Object.assign(Object.assign({}, old), {
|
|
107
109
|
winLoadingStatus: status
|
|
108
110
|
});
|
|
@@ -110,11 +112,12 @@ function RecordPlayer(_a) {
|
|
|
110
112
|
}
|
|
111
113
|
});
|
|
112
114
|
// 缓存所有player对象
|
|
113
|
-
var playerRef = useRef(
|
|
115
|
+
var playerRef = useRef({});
|
|
114
116
|
// 获取选中player对象
|
|
115
117
|
var getPlayerItem = function getPlayerItem() {
|
|
116
|
-
var _a;
|
|
117
|
-
|
|
118
|
+
var _a, _b;
|
|
119
|
+
var item = list[state.selectIndex];
|
|
120
|
+
return (_b = (_a = playerRef.current) === null || _a === void 0 ? void 0 : _a[item === null || item === void 0 ? void 0 : item.cid]) === null || _b === void 0 ? void 0 : _b.current;
|
|
118
121
|
};
|
|
119
122
|
// 当前窗口信息
|
|
120
123
|
var segmentItem = useMemo(function () {
|
|
@@ -124,8 +127,12 @@ function RecordPlayer(_a) {
|
|
|
124
127
|
return segmentItem.date;
|
|
125
128
|
}, [segmentItem.date]);
|
|
126
129
|
var currentTime = useMemo(function () {
|
|
127
|
-
|
|
128
|
-
|
|
130
|
+
var item = state.mergeSegments[state.selectIndex];
|
|
131
|
+
if (!item) {
|
|
132
|
+
return undefined;
|
|
133
|
+
}
|
|
134
|
+
return state.currentTimes["".concat(item.cid, "-").concat(item.date)];
|
|
135
|
+
}, [state.currentTimes, state.mergeSegments, state.selectIndex]);
|
|
129
136
|
/**
|
|
130
137
|
* @desc 用户缓存接收list的变化。
|
|
131
138
|
*/
|
|
@@ -160,7 +167,7 @@ function RecordPlayer(_a) {
|
|
|
160
167
|
mergeList[i].cid = item.cid;
|
|
161
168
|
mergeList[i].recordType = item.recordType;
|
|
162
169
|
// 更新变化的currentTime
|
|
163
|
-
times[
|
|
170
|
+
times["".concat(item.cid, "-").concat(item.date)] = list[i].date;
|
|
164
171
|
}
|
|
165
172
|
}
|
|
166
173
|
} catch (err) {
|
|
@@ -170,7 +177,7 @@ function RecordPlayer(_a) {
|
|
|
170
177
|
}
|
|
171
178
|
return Object.assign(Object.assign({}, old), {
|
|
172
179
|
mergeSegments: _toConsumableArray(mergeList),
|
|
173
|
-
currentTimes:
|
|
180
|
+
currentTimes: Object.assign({}, times)
|
|
174
181
|
});
|
|
175
182
|
});
|
|
176
183
|
}, [list, listKey, prevListKey]);
|
|
@@ -214,8 +221,9 @@ function RecordPlayer(_a) {
|
|
|
214
221
|
}
|
|
215
222
|
}
|
|
216
223
|
if (newState.hasOwnProperty('mode')) {
|
|
217
|
-
var
|
|
218
|
-
newModes
|
|
224
|
+
var item = state.mergeSegments[state.selectIndex];
|
|
225
|
+
var newModes = Object.assign({}, state.modes);
|
|
226
|
+
newModes["".concat(item.cid, "-").concat(item.date)] = newState.mode;
|
|
219
227
|
obj.modes = newModes;
|
|
220
228
|
}
|
|
221
229
|
if (newState.hasOwnProperty('timeMode')) {
|
|
@@ -286,8 +294,9 @@ function RecordPlayer(_a) {
|
|
|
286
294
|
mergeSegments[old.selectIndex].segments = segments;
|
|
287
295
|
mergeSegments = _toConsumableArray(mergeSegments);
|
|
288
296
|
}
|
|
289
|
-
var currentTimes =
|
|
290
|
-
|
|
297
|
+
var currentTimes = Object.assign({}, old.currentTimes);
|
|
298
|
+
var item = mergeSegments[old.selectIndex];
|
|
299
|
+
currentTimes["".concat(item.cid, "-").concat(item.date)] = time;
|
|
291
300
|
return Object.assign(Object.assign({}, old), {
|
|
292
301
|
currentTimes: currentTimes,
|
|
293
302
|
mergeSegments: mergeSegments,
|
|
@@ -306,7 +315,8 @@ function RecordPlayer(_a) {
|
|
|
306
315
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
307
316
|
[segmentItem.cid, segmentItem.recordType, segmentItem.segments, state.loading]);
|
|
308
317
|
var _updatePlayer = function updatePlayer(player, index) {
|
|
309
|
-
|
|
318
|
+
var item = state.mergeSegments[index];
|
|
319
|
+
playerRef.current["".concat(item.cid, "-").concat(item.date)] = player;
|
|
310
320
|
setState(function (old) {
|
|
311
321
|
return Object.assign({}, old);
|
|
312
322
|
});
|
|
@@ -344,10 +354,10 @@ function RecordPlayer(_a) {
|
|
|
344
354
|
className: "player-layout",
|
|
345
355
|
ref: domRef
|
|
346
356
|
}, screenList.map(function (item, index) {
|
|
347
|
-
var _a, _b, _c, _d
|
|
357
|
+
var _a, _b, _c, _d;
|
|
348
358
|
return item.recordType === 1 ? /*#__PURE__*/React.createElement(SegmentPlayerWithExt, Object.assign({}, item, {
|
|
349
359
|
segments: ((_a = recordList[index]) === null || _a === void 0 ? void 0 : _a.segments) || [],
|
|
350
|
-
key: "".concat(
|
|
360
|
+
key: item.date && item.cid ? "".concat(item === null || item === void 0 ? void 0 : item.date, "-").concat(item.cid) : "".concat(index),
|
|
351
361
|
className: state.selectIndex === index ? 'player-current-index' : '',
|
|
352
362
|
updatePlayer: function updatePlayer(player) {
|
|
353
363
|
return _updatePlayer(player, index);
|
|
@@ -363,13 +373,13 @@ function RecordPlayer(_a) {
|
|
|
363
373
|
width: screenType.width,
|
|
364
374
|
height: screenType.height
|
|
365
375
|
},
|
|
366
|
-
mode: (
|
|
376
|
+
mode: (_b = state.modes["".concat(item === null || item === void 0 ? void 0 : item.date, "-").concat(item.cid)]) !== null && _b !== void 0 ? _b : item.mode,
|
|
367
377
|
fps: fps,
|
|
368
378
|
fpsDelay: fpsDelay,
|
|
369
|
-
httpLoading: state.winLoadingStatus[
|
|
379
|
+
httpLoading: state.winLoadingStatus["".concat(item === null || item === void 0 ? void 0 : item.date, "-").concat(item.cid)]
|
|
370
380
|
})) : /*#__PURE__*/React.createElement(FrontendPlayerWithExt, Object.assign({}, item, {
|
|
371
381
|
className: state.selectIndex === index ? 'player-current-index' : '',
|
|
372
|
-
segments: ((
|
|
382
|
+
segments: ((_c = recordList[index]) === null || _c === void 0 ? void 0 : _c.segments) || [],
|
|
373
383
|
updatePlayer: function updatePlayer(player) {
|
|
374
384
|
return _updatePlayer(player, index);
|
|
375
385
|
},
|
|
@@ -380,13 +390,13 @@ function RecordPlayer(_a) {
|
|
|
380
390
|
});
|
|
381
391
|
});
|
|
382
392
|
},
|
|
383
|
-
mode: (
|
|
384
|
-
key: "".concat(
|
|
393
|
+
mode: (_d = state.modes["".concat(item === null || item === void 0 ? void 0 : item.date, "-").concat(item.cid)]) !== null && _d !== void 0 ? _d : item.mode,
|
|
394
|
+
key: item.date && item.cid ? "".concat(item === null || item === void 0 ? void 0 : item.date, "-").concat(item.cid) : "".concat(index),
|
|
385
395
|
style: {
|
|
386
396
|
width: screenType.width,
|
|
387
397
|
height: screenType.height
|
|
388
398
|
},
|
|
389
|
-
httpLoading: state.winLoadingStatus[
|
|
399
|
+
httpLoading: state.winLoadingStatus["".concat(item === null || item === void 0 ? void 0 : item.date, "-").concat(item.cid)],
|
|
390
400
|
getLocalRecordUrl: getLocalRecordUrl,
|
|
391
401
|
pluginDownloadUrl: pluginDownloadUrl
|
|
392
402
|
}));
|
|
@@ -396,7 +406,7 @@ function RecordPlayer(_a) {
|
|
|
396
406
|
disabled: !segmentItem.cid,
|
|
397
407
|
width: "70%"
|
|
398
408
|
}, /*#__PURE__*/React.createElement(RecordTools, {
|
|
399
|
-
time: state.currentTimes[
|
|
409
|
+
time: state.currentTimes["".concat(segmentItem.cid, "-").concat(segmentItem.date)],
|
|
400
410
|
fit: fit,
|
|
401
411
|
toggleFit: toggleFit,
|
|
402
412
|
getPlayerItem: getPlayerItem,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { PlayModeType } from '../PlayerExt';
|
|
3
|
-
import { ISegmentType } from '../Player/player';
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { PlayModeType } from '../PlayerExt';
|
|
3
|
+
import type { ISegmentType,ExportPlayerType } from '../Player/player';
|
|
4
4
|
|
|
5
5
|
export type RecordItem = {
|
|
6
6
|
type?: 'flv' | 'hls' | 'native';
|
|
@@ -105,12 +105,12 @@ export interface IRecordPlayerState {
|
|
|
105
105
|
/**
|
|
106
106
|
* 插件OR浏览器
|
|
107
107
|
*/
|
|
108
|
-
modes:
|
|
108
|
+
modes: {[key:string]:PlayModeType};
|
|
109
109
|
|
|
110
110
|
/**
|
|
111
111
|
* 时间轴开始时间
|
|
112
112
|
*/
|
|
113
|
-
currentTimes:
|
|
113
|
+
currentTimes: {[key:string]:number};
|
|
114
114
|
|
|
115
115
|
/**
|
|
116
116
|
* 需要seek的时间针对当前窗口,为0时忽略
|
|
@@ -135,7 +135,7 @@ export interface IRecordPlayerState {
|
|
|
135
135
|
/**
|
|
136
136
|
* 窗口播放状态
|
|
137
137
|
*/
|
|
138
|
-
winLoadingStatus:
|
|
138
|
+
winLoadingStatus: {[key:string]:boolean};
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
export type ScreenItemLivePlayerType = {
|
|
@@ -205,7 +205,9 @@ export interface ILivePlayerProps {
|
|
|
205
205
|
export interface ILivePlayerState {
|
|
206
206
|
screenNum: number;
|
|
207
207
|
selectIndex: number;
|
|
208
|
-
modes:
|
|
208
|
+
modes: {[key:string]:PlayModeType};
|
|
209
209
|
}
|
|
210
210
|
|
|
211
211
|
export const RecordPlayer: React.FC<IRecordPlayerProps>;
|
|
212
|
+
|
|
213
|
+
export type PlayItemMapType = { [key: string]: React.MutableRefObject<ExportPlayerType> };
|