@cloud-app-dev/vidc 3.0.6 → 3.0.9
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/DisableMark/index.js +0 -1
- package/es/ScreenPlayer/Record.d.ts +1 -1
- package/es/ScreenPlayer/Record.js +35 -13
- package/es/ScreenPlayer/RecordTools.d.ts +4 -1
- package/es/ScreenPlayer/RecordTools.js +13 -2
- package/es/ScreenPlayer/SegmentTimeLine.d.ts +5 -1
- package/es/ScreenPlayer/SegmentTimeLine.js +28 -7
- package/es/ScreenPlayer/TimeMode.d.ts +7 -0
- package/es/ScreenPlayer/TimeMode.js +23 -0
- package/es/ScreenPlayer/TimeSelect.js +0 -1
- package/es/ScreenPlayer/TimeSlider.d.ts +3 -1
- package/es/ScreenPlayer/TimeSlider.js +36 -16
- package/es/ScreenPlayer/index.css +17 -0
- package/es/ScreenPlayer/interface.d.ts +7 -1
- package/es/ScreenPlayer/utils.d.ts +3 -0
- package/es/ScreenPlayer/utils.js +9 -0
- package/package.json +1 -1
- package/release-build.sh +3 -0
package/es/DisableMark/index.js
CHANGED
|
@@ -3,7 +3,6 @@ import "./index.css";
|
|
|
3
3
|
export default function DisableMark(_ref) {
|
|
4
4
|
var children = _ref.children,
|
|
5
5
|
disabled = _ref.disabled;
|
|
6
|
-
console.log(disabled);
|
|
7
6
|
return /*#__PURE__*/React.createElement(React.Fragment, null, disabled ? /*#__PURE__*/React.createElement("div", {
|
|
8
7
|
className: "disable-mark"
|
|
9
8
|
}) : null, children);
|
|
@@ -6,5 +6,5 @@ import './index.less';
|
|
|
6
6
|
* @param param0
|
|
7
7
|
* @returns
|
|
8
8
|
*/
|
|
9
|
-
declare function RecordPlayer({ list, children, queryRecord, onIndexChange, onClose, onCloseAll }: IRecordPlayerProps): JSX.Element;
|
|
9
|
+
declare function RecordPlayer({ list, children, queryRecord, onIndexChange, onClose, onCloseAll, download }: IRecordPlayerProps): JSX.Element;
|
|
10
10
|
export default RecordPlayer;
|
|
@@ -1,5 +1,7 @@
|
|
|
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
2
|
|
|
3
|
+
import "antd/lib/message/style";
|
|
4
|
+
import _message from "antd/lib/message";
|
|
3
5
|
import _usePrevious from "ahooks/es/usePrevious";
|
|
4
6
|
|
|
5
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; }
|
|
@@ -48,7 +50,8 @@ function RecordPlayer(_ref) {
|
|
|
48
50
|
queryRecord = _ref.queryRecord,
|
|
49
51
|
onIndexChange = _ref.onIndexChange,
|
|
50
52
|
onClose = _ref.onClose,
|
|
51
|
-
onCloseAll = _ref.onCloseAll
|
|
53
|
+
onCloseAll = _ref.onCloseAll,
|
|
54
|
+
download = _ref.download;
|
|
52
55
|
|
|
53
56
|
var _useState = useState({
|
|
54
57
|
screenNum: 4,
|
|
@@ -57,7 +60,8 @@ function RecordPlayer(_ref) {
|
|
|
57
60
|
currentTimes: [],
|
|
58
61
|
loading: false,
|
|
59
62
|
seekTo: 0,
|
|
60
|
-
mergeSegments: []
|
|
63
|
+
mergeSegments: [],
|
|
64
|
+
timeMode: 24
|
|
61
65
|
}),
|
|
62
66
|
_useState2 = _slicedToArray(_useState, 2),
|
|
63
67
|
state = _useState2[0],
|
|
@@ -202,6 +206,10 @@ function RecordPlayer(_ref) {
|
|
|
202
206
|
obj.mode = newState.mode;
|
|
203
207
|
}
|
|
204
208
|
|
|
209
|
+
if (newState.hasOwnProperty('timeMode')) {
|
|
210
|
+
obj.timeMode = newState.timeMode;
|
|
211
|
+
}
|
|
212
|
+
|
|
205
213
|
setState(function (old) {
|
|
206
214
|
return Object.assign(Object.assign({}, old), obj);
|
|
207
215
|
});
|
|
@@ -213,7 +221,7 @@ function RecordPlayer(_ref) {
|
|
|
213
221
|
*/
|
|
214
222
|
|
|
215
223
|
|
|
216
|
-
var onTimeChange = useCallback(function (time) {
|
|
224
|
+
var onTimeChange = useCallback(function (time, outTimeline) {
|
|
217
225
|
return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
218
226
|
var index, segments;
|
|
219
227
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
@@ -228,23 +236,34 @@ function RecordPlayer(_ref) {
|
|
|
228
236
|
return _context.abrupt("return");
|
|
229
237
|
|
|
230
238
|
case 2:
|
|
239
|
+
if (!(outTimeline && segmentItem.recordType === 1)) {
|
|
240
|
+
_context.next = 5;
|
|
241
|
+
break;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// 云录像 若点击了缺失的片段,直接忽略
|
|
245
|
+
_message.warning('当前录像片段缺失!');
|
|
246
|
+
|
|
247
|
+
return _context.abrupt("return");
|
|
248
|
+
|
|
249
|
+
case 5:
|
|
231
250
|
index = segmentItem.segments.findIndex(function (v) {
|
|
232
251
|
return time >= v.beginTime && time < v.endTime;
|
|
233
252
|
});
|
|
234
253
|
|
|
235
254
|
if (!(index === -1)) {
|
|
236
|
-
_context.next =
|
|
255
|
+
_context.next = 11;
|
|
237
256
|
break;
|
|
238
257
|
}
|
|
239
258
|
|
|
240
|
-
_context.next =
|
|
259
|
+
_context.next = 9;
|
|
241
260
|
return queryRecord({
|
|
242
261
|
cid: segmentItem.cid,
|
|
243
262
|
date: time,
|
|
244
263
|
recordType: segmentItem.recordType
|
|
245
264
|
});
|
|
246
265
|
|
|
247
|
-
case
|
|
266
|
+
case 9:
|
|
248
267
|
segments = _context.sent;
|
|
249
268
|
setState(function (old) {
|
|
250
269
|
return Object.assign(Object.assign({}, old), {
|
|
@@ -252,7 +271,7 @@ function RecordPlayer(_ref) {
|
|
|
252
271
|
});
|
|
253
272
|
});
|
|
254
273
|
|
|
255
|
-
case
|
|
274
|
+
case 11:
|
|
256
275
|
//更新time
|
|
257
276
|
setState(function (old) {
|
|
258
277
|
var mergeSegments = old.mergeSegments;
|
|
@@ -273,7 +292,7 @@ function RecordPlayer(_ref) {
|
|
|
273
292
|
});
|
|
274
293
|
});
|
|
275
294
|
|
|
276
|
-
case
|
|
295
|
+
case 12:
|
|
277
296
|
case "end":
|
|
278
297
|
return _context.stop();
|
|
279
298
|
}
|
|
@@ -288,11 +307,10 @@ function RecordPlayer(_ref) {
|
|
|
288
307
|
setState(function (old) {
|
|
289
308
|
return Object.assign({}, old);
|
|
290
309
|
});
|
|
291
|
-
};
|
|
292
|
-
|
|
293
|
-
console.log(segmentItem.cid); // index变化同步到父组件
|
|
310
|
+
}; // index变化同步到父组件
|
|
294
311
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
295
312
|
|
|
313
|
+
|
|
296
314
|
useEffect(function () {
|
|
297
315
|
return onIndexChange(state.selectIndex);
|
|
298
316
|
}, [state.selectIndex]);
|
|
@@ -357,12 +375,16 @@ function RecordPlayer(_ref) {
|
|
|
357
375
|
updateState: updateState,
|
|
358
376
|
onTimeChange: onTimeChange,
|
|
359
377
|
onClose: onClose,
|
|
360
|
-
onCloseAll: onCloseAll
|
|
378
|
+
onCloseAll: onCloseAll,
|
|
379
|
+
timeMode: state.timeMode,
|
|
380
|
+
download: download
|
|
361
381
|
}), /*#__PURE__*/React.createElement(SegmentTimeLine, {
|
|
362
382
|
begin: timeBegin,
|
|
383
|
+
updateState: updateState,
|
|
363
384
|
timeCell: segmentItem.segments,
|
|
364
385
|
key: state.selectIndex,
|
|
365
|
-
onTimeChange: onTimeChange
|
|
386
|
+
onTimeChange: onTimeChange,
|
|
387
|
+
timeMode: state.timeMode
|
|
366
388
|
}))), children && /*#__PURE__*/React.cloneElement(children, {
|
|
367
389
|
selectIndex: state.selectIndex
|
|
368
390
|
}));
|
|
@@ -6,6 +6,7 @@ interface IToolsProps {
|
|
|
6
6
|
updateState: (state: {
|
|
7
7
|
screenNum?: number;
|
|
8
8
|
mode?: PlayModeType;
|
|
9
|
+
timeMode?: number;
|
|
9
10
|
}) => void;
|
|
10
11
|
screenNum: number;
|
|
11
12
|
mode: PlayModeType;
|
|
@@ -16,6 +17,8 @@ interface IToolsProps {
|
|
|
16
17
|
onTimeChange?: (time: number) => void;
|
|
17
18
|
onClose?: () => void;
|
|
18
19
|
onCloseAll?: () => void;
|
|
20
|
+
timeMode: number;
|
|
21
|
+
download?: () => void;
|
|
19
22
|
}
|
|
20
|
-
declare function RecordTools({ containerRef, updateState, screenNum, getPlayerItem, mode, toggleFit, fit, time, onTimeChange, onClose, onCloseAll }: IToolsProps): JSX.Element;
|
|
23
|
+
declare function RecordTools({ containerRef, updateState, download, screenNum, timeMode, getPlayerItem, mode, toggleFit, fit, time, onTimeChange, onClose, onCloseAll }: IToolsProps): JSX.Element;
|
|
21
24
|
export default RecordTools;
|
|
@@ -17,11 +17,14 @@ import React from 'react';
|
|
|
17
17
|
import IconFont from '../Player/iconfont';
|
|
18
18
|
import ScreenSelect from './ScreenSelect';
|
|
19
19
|
import TimeSelect from './TimeSelect';
|
|
20
|
+
import TimeMode from './TimeMode';
|
|
20
21
|
|
|
21
22
|
function RecordTools(_ref) {
|
|
22
23
|
var containerRef = _ref.containerRef,
|
|
23
24
|
updateState = _ref.updateState,
|
|
25
|
+
download = _ref.download,
|
|
24
26
|
screenNum = _ref.screenNum,
|
|
27
|
+
timeMode = _ref.timeMode,
|
|
25
28
|
getPlayerItem = _ref.getPlayerItem,
|
|
26
29
|
mode = _ref.mode,
|
|
27
30
|
toggleFit = _ref.toggleFit,
|
|
@@ -87,7 +90,8 @@ function RecordTools(_ref) {
|
|
|
87
90
|
type: "lm-player-YesorNo_No_Dark",
|
|
88
91
|
title: "\u5173\u95ED\u5F53\u524D"
|
|
89
92
|
})), /*#__PURE__*/React.createElement("span", {
|
|
90
|
-
className: "player-tools-item"
|
|
93
|
+
className: "player-tools-item",
|
|
94
|
+
onClick: download
|
|
91
95
|
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
92
96
|
type: "lm-player-S_Edit_LoadDown",
|
|
93
97
|
title: "\u4E0B\u8F7D\u5F53\u524D\u5F55\u50CF"
|
|
@@ -153,7 +157,14 @@ function RecordTools(_ref) {
|
|
|
153
157
|
}) : /*#__PURE__*/React.createElement(IconFont, {
|
|
154
158
|
type: "lm-player-Full_Main",
|
|
155
159
|
title: "\u5168\u5C4F"
|
|
156
|
-
}))
|
|
160
|
+
})), /*#__PURE__*/React.createElement(TimeMode, {
|
|
161
|
+
timeMode: timeMode,
|
|
162
|
+
onChange: function onChange(m) {
|
|
163
|
+
return updateState({
|
|
164
|
+
timeMode: m
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
})));
|
|
157
168
|
}
|
|
158
169
|
|
|
159
170
|
export default RecordTools;
|
|
@@ -4,6 +4,10 @@ interface ISegmentTimeLineProps {
|
|
|
4
4
|
begin?: number;
|
|
5
5
|
timeCell?: ISegmentType[];
|
|
6
6
|
onTimeChange?: (time: number) => void;
|
|
7
|
+
timeMode: number;
|
|
8
|
+
updateState: (state: {
|
|
9
|
+
timeMode: number;
|
|
10
|
+
}) => void;
|
|
7
11
|
}
|
|
8
|
-
declare function SegmentTimeLine({ begin, timeCell, onTimeChange }: ISegmentTimeLineProps): JSX.Element;
|
|
12
|
+
declare function SegmentTimeLine({ begin, timeCell, onTimeChange, timeMode, updateState }: ISegmentTimeLineProps): JSX.Element;
|
|
9
13
|
export default SegmentTimeLine;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import _useUnmount from "ahooks/es/useUnmount";
|
|
2
|
+
import _useUpdateEffect from "ahooks/es/useUpdateEffect";
|
|
1
3
|
import _useThrottleFn2 from "ahooks/es/useThrottleFn";
|
|
2
4
|
import _useSize from "ahooks/es/useSize";
|
|
3
5
|
import moment from 'moment';
|
|
@@ -7,8 +9,11 @@ import TimeSlider from './TimeSlider';
|
|
|
7
9
|
function SegmentTimeLine(_ref) {
|
|
8
10
|
var begin = _ref.begin,
|
|
9
11
|
timeCell = _ref.timeCell,
|
|
10
|
-
onTimeChange = _ref.onTimeChange
|
|
12
|
+
onTimeChange = _ref.onTimeChange,
|
|
13
|
+
timeMode = _ref.timeMode,
|
|
14
|
+
updateState = _ref.updateState;
|
|
11
15
|
var ref = useRef();
|
|
16
|
+
var timeSliderRef = useRef();
|
|
12
17
|
|
|
13
18
|
var size = _useSize(ref);
|
|
14
19
|
|
|
@@ -23,16 +28,32 @@ function SegmentTimeLine(_ref) {
|
|
|
23
28
|
minutes: 0,
|
|
24
29
|
seconds: 0
|
|
25
30
|
}).valueOf();
|
|
26
|
-
|
|
31
|
+
timeSliderRef.current = new TimeSlider(ref.current, {
|
|
27
32
|
onTimeChange: run,
|
|
28
|
-
start_timestamp: time -
|
|
33
|
+
start_timestamp: time - timeMode / 2 * 3600 * 1000,
|
|
29
34
|
current_timestamp: time,
|
|
30
|
-
timecell: timeCell
|
|
35
|
+
timecell: timeCell,
|
|
36
|
+
hours_per_ruler: timeMode,
|
|
37
|
+
onHoursPerChange: function onHoursPerChange(hour) {
|
|
38
|
+
return updateState({
|
|
39
|
+
timeMode: hour
|
|
40
|
+
});
|
|
41
|
+
}
|
|
31
42
|
});
|
|
32
|
-
return function () {
|
|
33
|
-
return timeLine.destory();
|
|
34
|
-
};
|
|
35
43
|
}, [begin, timeCell, size === null || size === void 0 ? void 0 : size.width, run]);
|
|
44
|
+
/**
|
|
45
|
+
* hour变化更新时间轴而不是重绘
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
_useUpdateEffect(function () {
|
|
49
|
+
return timeSliderRef.current.drawHourChange(timeMode);
|
|
50
|
+
}, [timeMode]);
|
|
51
|
+
|
|
52
|
+
_useUnmount(function () {
|
|
53
|
+
timeSliderRef.current.destory();
|
|
54
|
+
timeSliderRef.current = null;
|
|
55
|
+
});
|
|
56
|
+
|
|
36
57
|
return /*#__PURE__*/React.createElement("div", {
|
|
37
58
|
className: "record-time-line"
|
|
38
59
|
}, /*#__PURE__*/React.createElement("canvas", {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import "antd/lib/select/style";
|
|
2
|
+
import _Select from "antd/lib/select";
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { TimeModeLibs } from './utils';
|
|
5
|
+
|
|
6
|
+
function TimeMode(_ref) {
|
|
7
|
+
var timeMode = _ref.timeMode,
|
|
8
|
+
onChange = _ref.onChange;
|
|
9
|
+
return /*#__PURE__*/React.createElement(_Select, {
|
|
10
|
+
value: timeMode,
|
|
11
|
+
onChange: onChange,
|
|
12
|
+
className: "time-mode-select",
|
|
13
|
+
dropdownClassName: "time-mode-select-dropdown",
|
|
14
|
+
placement: "topLeft"
|
|
15
|
+
}, TimeModeLibs.map(function (item) {
|
|
16
|
+
return /*#__PURE__*/React.createElement(_Select.Option, {
|
|
17
|
+
value: item.name,
|
|
18
|
+
key: item.name
|
|
19
|
+
}, item.name, "\u5C0F\u65F6");
|
|
20
|
+
}));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default TimeMode;
|
|
@@ -4,7 +4,8 @@ export interface ITimeSliderOptions {
|
|
|
4
4
|
start_timestamp?: number;
|
|
5
5
|
timecell?: TimeCellItem[];
|
|
6
6
|
current_timestamp?: number;
|
|
7
|
-
onTimeChange?: (time: number) => void;
|
|
7
|
+
onTimeChange?: (time: number, outTimeline?: boolean) => void;
|
|
8
|
+
onHoursPerChange?: (hour: number) => void;
|
|
8
9
|
}
|
|
9
10
|
export declare type TimeCellItem = ISegmentType;
|
|
10
11
|
export default class TimeSlider {
|
|
@@ -115,6 +116,7 @@ export default class TimeSlider {
|
|
|
115
116
|
* 滚轮放大缩小,以时间轴中心为准 mousewheel事件
|
|
116
117
|
*/
|
|
117
118
|
mousewheelFunc: (event: any) => void;
|
|
119
|
+
drawHourChange(hour: number): void;
|
|
118
120
|
/**
|
|
119
121
|
* 获取鼠标posx
|
|
120
122
|
* @param {*} e
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import _nextTick from "@cloud-app-dev/utils/es/nextTick";
|
|
2
|
+
|
|
1
3
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
2
4
|
|
|
3
5
|
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); } }
|
|
@@ -5,6 +7,7 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
|
|
|
5
7
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
6
8
|
|
|
7
9
|
import moment from 'moment';
|
|
10
|
+
var hours = [1, 6, 12, 24];
|
|
8
11
|
var currentColor = '#FF000A';
|
|
9
12
|
var normalLineColor = '#ffffff';
|
|
10
13
|
var hoverLineColor = '#319BFF';
|
|
@@ -103,7 +106,7 @@ var TimeSlider = /*#__PURE__*/function () {
|
|
|
103
106
|
_this.drawLine(pos_x, 20, pos_x, _this.canVansH, hoverLineColor, 1);
|
|
104
107
|
|
|
105
108
|
_this.ctx.fillStyle = hoverLineColor;
|
|
106
|
-
_this.ctx.font =
|
|
109
|
+
_this.ctx.font = '10px Arial';
|
|
107
110
|
|
|
108
111
|
_this.ctx.fillText(_this.changeTime(current_timestamp), pos_x - 50, 12);
|
|
109
112
|
}
|
|
@@ -131,18 +134,15 @@ var TimeSlider = /*#__PURE__*/function () {
|
|
|
131
134
|
|
|
132
135
|
var timecellItem = _this.timecell.find(function (v) {
|
|
133
136
|
return current_timestamp >= v.beginTime && current_timestamp < v.endTime;
|
|
134
|
-
});
|
|
137
|
+
}); // 当前片段没有录像的时候
|
|
135
138
|
|
|
136
|
-
if (timecellItem && !timecellItem.url) {
|
|
137
|
-
// 无录像轴 不让点击
|
|
138
|
-
return;
|
|
139
|
-
}
|
|
140
139
|
|
|
140
|
+
var outTimeline = timecellItem && !timecellItem.url;
|
|
141
141
|
_this.current_timestamp = current_timestamp;
|
|
142
142
|
|
|
143
143
|
_this.set_time_to_middle(_this.current_timestamp);
|
|
144
144
|
|
|
145
|
-
_this.options.onTimeChange && _this.options.onTimeChange(current_timestamp);
|
|
145
|
+
_this.options.onTimeChange && _this.options.onTimeChange(current_timestamp, outTimeline);
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
document.removeEventListener('mousemove', _this.mousemoveFunc);
|
|
@@ -180,24 +180,33 @@ var TimeSlider = /*#__PURE__*/function () {
|
|
|
180
180
|
var middle_time = _this.start_timestamp + _this.hours_per_ruler * 3600 * 1000 / 2; //ms 记住当前中间的时间
|
|
181
181
|
|
|
182
182
|
if (delta < 0) {
|
|
183
|
-
|
|
183
|
+
// 缩小
|
|
184
|
+
var index = hours.indexOf(_this.zoom);
|
|
184
185
|
|
|
185
|
-
if (
|
|
186
|
-
_this.zoom =
|
|
186
|
+
if (index === hours.length - 1) {
|
|
187
|
+
_this.zoom = hours[index];
|
|
188
|
+
} else {
|
|
189
|
+
_this.zoom = hours[index + 1];
|
|
187
190
|
}
|
|
188
191
|
|
|
189
192
|
_this.hours_per_ruler = _this.zoom;
|
|
190
193
|
} else if (delta > 0) {
|
|
191
194
|
// 放大
|
|
192
|
-
|
|
195
|
+
var _index = hours.indexOf(_this.zoom);
|
|
193
196
|
|
|
194
|
-
if (
|
|
195
|
-
_this.zoom =
|
|
197
|
+
if (_index === 0) {
|
|
198
|
+
_this.zoom = hours[0];
|
|
199
|
+
} else {
|
|
200
|
+
_this.zoom = hours[_index - 1];
|
|
196
201
|
}
|
|
197
202
|
|
|
198
203
|
_this.hours_per_ruler = _this.zoom;
|
|
199
204
|
}
|
|
200
205
|
|
|
206
|
+
_nextTick(function () {
|
|
207
|
+
return _this.options.onHoursPerChange && _this.options.onHoursPerChange(_this.hours_per_ruler);
|
|
208
|
+
});
|
|
209
|
+
|
|
201
210
|
_this.clearCanvas();
|
|
202
211
|
|
|
203
212
|
_this.start_timestamp = middle_time - _this.hours_per_ruler * 3600 * 1000 / 2; //start_timestamp = 当前中间的时间 - zoom/2
|
|
@@ -233,7 +242,7 @@ var TimeSlider = /*#__PURE__*/function () {
|
|
|
233
242
|
this.options = options;
|
|
234
243
|
this.canvansW = this.canvas.width = this.canvas.clientWidth;
|
|
235
244
|
this.canVansH = this.canvas.height = this.canvas.clientHeight;
|
|
236
|
-
this.hours_per_ruler = (_a = this.options.hours_per_ruler) !== null && _a !== void 0 ? _a : this.hours_per_ruler;
|
|
245
|
+
this.zoom = this.hours_per_ruler = (_a = this.options.hours_per_ruler) !== null && _a !== void 0 ? _a : this.hours_per_ruler;
|
|
237
246
|
this.start_timestamp = (_b = this.options.start_timestamp) !== null && _b !== void 0 ? _b : this.start_timestamp;
|
|
238
247
|
this.current_timestamp = (_c = this.options.current_timestamp) !== null && _c !== void 0 ? _c : this.current_timestamp;
|
|
239
248
|
this.timecell = (_d = this.options.timecell) !== null && _d !== void 0 ? _d : this.timecell;
|
|
@@ -360,13 +369,13 @@ var TimeSlider = /*#__PURE__*/function () {
|
|
|
360
369
|
lineH = 10;
|
|
361
370
|
var big_date = this.graduation_title(date);
|
|
362
371
|
this.ctx.fillStyle = normalLineColor;
|
|
363
|
-
this.ctx.font =
|
|
372
|
+
this.ctx.font = '10px Arial';
|
|
364
373
|
this.ctx.fillText(big_date, graduation_left - 12, 30);
|
|
365
374
|
} else if (graduation_time / (60 * 1000) % medium_step === 0) {
|
|
366
375
|
lineH = 10;
|
|
367
376
|
var middle_date = this.graduation_title(date);
|
|
368
377
|
this.ctx.fillStyle = normalLineColor;
|
|
369
|
-
this.ctx.font =
|
|
378
|
+
this.ctx.font = '10px Arial';
|
|
370
379
|
this.ctx.fillText(middle_date, graduation_left - (middle_date.length > 5 ? 24 : 12), 30);
|
|
371
380
|
} else {
|
|
372
381
|
lineH = 5;
|
|
@@ -515,6 +524,17 @@ var TimeSlider = /*#__PURE__*/function () {
|
|
|
515
524
|
}
|
|
516
525
|
}
|
|
517
526
|
}
|
|
527
|
+
}, {
|
|
528
|
+
key: "drawHourChange",
|
|
529
|
+
value: function drawHourChange(hour) {
|
|
530
|
+
var middle_time = this.start_timestamp + this.hours_per_ruler * 3600 * 1000 / 2; //ms 记住当前中间的时间
|
|
531
|
+
|
|
532
|
+
this.hours_per_ruler = this.zoom = hour;
|
|
533
|
+
this.clearCanvas();
|
|
534
|
+
this.start_timestamp = middle_time - this.hours_per_ruler * 3600 * 1000 / 2; //start_timestamp = 当前中间的时间 - zoom/2
|
|
535
|
+
|
|
536
|
+
this.init(this.start_timestamp, this.timecell, true);
|
|
537
|
+
}
|
|
518
538
|
/**
|
|
519
539
|
* 清除canvas 每次重新绘制需要先清除
|
|
520
540
|
*/
|
|
@@ -105,3 +105,20 @@
|
|
|
105
105
|
justify-content: space-around;
|
|
106
106
|
align-items: center;
|
|
107
107
|
}
|
|
108
|
+
.time-mode-select {
|
|
109
|
+
font-size: var(--fs-small);
|
|
110
|
+
color: var(--gray1);
|
|
111
|
+
}
|
|
112
|
+
.time-mode-select .cloudapp-select-selector {
|
|
113
|
+
background-color: transparent !important;
|
|
114
|
+
border-radius: var(--radius1) !important;
|
|
115
|
+
}
|
|
116
|
+
.time-mode-select .anticon {
|
|
117
|
+
color: var(--gray1);
|
|
118
|
+
}
|
|
119
|
+
.time-mode-select-dropdown {
|
|
120
|
+
font-size: var(--fs-small);
|
|
121
|
+
}
|
|
122
|
+
.time-mode-select-dropdown .cloudapp-select-item {
|
|
123
|
+
font-size: var(--fs-small);
|
|
124
|
+
}
|
|
@@ -34,8 +34,9 @@ export interface IRecordPlayerProps {
|
|
|
34
34
|
*/
|
|
35
35
|
onCloseAll?: () => void;
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
37
|
+
* 录像下载回调
|
|
38
38
|
*/
|
|
39
|
+
download?: () => void;
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
export interface IRecordPlayerState {
|
|
@@ -73,6 +74,11 @@ export interface IRecordPlayerState {
|
|
|
73
74
|
* 加载中,用于拦截多次时间轴变化需要加载片段的情况
|
|
74
75
|
*/
|
|
75
76
|
loading?: boolean;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* 录像时间轴单页绘制时长单位(hour)
|
|
80
|
+
*/
|
|
81
|
+
timeMode: number;
|
|
76
82
|
}
|
|
77
83
|
|
|
78
84
|
export type ScreenItemLivePlayerType = {
|
|
@@ -4,6 +4,9 @@ export declare const ScreenType: {
|
|
|
4
4
|
width: string;
|
|
5
5
|
height: string;
|
|
6
6
|
}[];
|
|
7
|
+
export declare const TimeModeLibs: {
|
|
8
|
+
name: number;
|
|
9
|
+
}[];
|
|
7
10
|
export declare function mergeFill<T, S>(len: number, mergeArr: T[], fillItem: S): (T | S)[];
|
|
8
11
|
export declare const FILTER_KEY = "00|11|00";
|
|
9
12
|
/**
|
package/es/ScreenPlayer/utils.js
CHANGED
|
@@ -15,6 +15,15 @@ export var ScreenType = [{
|
|
|
15
15
|
width: '25%',
|
|
16
16
|
height: '25%'
|
|
17
17
|
}];
|
|
18
|
+
export var TimeModeLibs = [{
|
|
19
|
+
name: 24
|
|
20
|
+
}, {
|
|
21
|
+
name: 12
|
|
22
|
+
}, {
|
|
23
|
+
name: 6
|
|
24
|
+
}, {
|
|
25
|
+
name: 1
|
|
26
|
+
}];
|
|
18
27
|
export function mergeFill(len, mergeArr, fillItem) {
|
|
19
28
|
return new Array(len).fill(fillItem).map(function (v, i) {
|
|
20
29
|
return mergeArr[i] ? mergeArr[i] : v;
|
package/package.json
CHANGED