@cloud-app-dev/vidc 3.0.37 → 3.0.39
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.
|
@@ -134,6 +134,9 @@ function RecordPlayer(_a) {
|
|
|
134
134
|
var timeBegin = useMemo(function () {
|
|
135
135
|
return segmentItem.date;
|
|
136
136
|
}, [segmentItem.date]);
|
|
137
|
+
var currentTime = useMemo(function () {
|
|
138
|
+
return state.currentTimes[state.selectIndex];
|
|
139
|
+
}, [state.currentTimes, state.selectIndex]);
|
|
137
140
|
/**
|
|
138
141
|
* @desc 用户缓存接收list的变化。
|
|
139
142
|
*/
|
|
@@ -283,23 +286,32 @@ function RecordPlayer(_a) {
|
|
|
283
286
|
return _context.abrupt("return");
|
|
284
287
|
|
|
285
288
|
case 5:
|
|
289
|
+
if (!(time > Date.now())) {
|
|
290
|
+
_context.next = 8;
|
|
291
|
+
break;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
console.warn('查询时间超出正常范围!');
|
|
295
|
+
return _context.abrupt("return");
|
|
296
|
+
|
|
297
|
+
case 8:
|
|
286
298
|
index = segmentItem.segments.findIndex(function (v) {
|
|
287
299
|
return time >= v.beginTime && time < v.endTime;
|
|
288
300
|
});
|
|
289
301
|
|
|
290
302
|
if (!(index === -1)) {
|
|
291
|
-
_context.next =
|
|
303
|
+
_context.next = 14;
|
|
292
304
|
break;
|
|
293
305
|
}
|
|
294
306
|
|
|
295
|
-
_context.next =
|
|
307
|
+
_context.next = 12;
|
|
296
308
|
return queryRecord({
|
|
297
309
|
cid: segmentItem.cid,
|
|
298
310
|
date: time,
|
|
299
311
|
recordType: segmentItem.recordType
|
|
300
312
|
});
|
|
301
313
|
|
|
302
|
-
case
|
|
314
|
+
case 12:
|
|
303
315
|
segments = _context.sent;
|
|
304
316
|
setState(function (old) {
|
|
305
317
|
return Object.assign(Object.assign({}, old), {
|
|
@@ -307,7 +319,7 @@ function RecordPlayer(_a) {
|
|
|
307
319
|
});
|
|
308
320
|
});
|
|
309
321
|
|
|
310
|
-
case
|
|
322
|
+
case 14:
|
|
311
323
|
//更新time
|
|
312
324
|
setState(function (old) {
|
|
313
325
|
var mergeSegments = old.mergeSegments;
|
|
@@ -328,7 +340,7 @@ function RecordPlayer(_a) {
|
|
|
328
340
|
});
|
|
329
341
|
});
|
|
330
342
|
|
|
331
|
-
case
|
|
343
|
+
case 15:
|
|
332
344
|
case "end":
|
|
333
345
|
return _context.stop();
|
|
334
346
|
}
|
|
@@ -457,6 +469,7 @@ function RecordPlayer(_a) {
|
|
|
457
469
|
disabled: !segmentItem.cid
|
|
458
470
|
}, /*#__PURE__*/React.createElement(SegmentTimeLine, {
|
|
459
471
|
begin: timeBegin,
|
|
472
|
+
currentTime: currentTime,
|
|
460
473
|
updateState: updateState,
|
|
461
474
|
segments: segmentItem.segments,
|
|
462
475
|
onTimeChange: onTimeChange,
|
|
@@ -18,8 +18,8 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
18
18
|
import React from 'react';
|
|
19
19
|
import IconFont from '../Player/iconfont';
|
|
20
20
|
import ScreenSelect from './ScreenSelect';
|
|
21
|
-
import TimeSelect from './TimeSelect';
|
|
22
|
-
|
|
21
|
+
import TimeSelect from './TimeSelect'; // import TimeMode from './TimeMode';
|
|
22
|
+
|
|
23
23
|
import useFullscreen from '../useFullscreen';
|
|
24
24
|
import Volume from '../Player/contraller_bar/volume';
|
|
25
25
|
import RatePick from './RatePick';
|
|
@@ -200,14 +200,7 @@ function RecordTools(_ref) {
|
|
|
200
200
|
}) : /*#__PURE__*/React.createElement(IconFont, {
|
|
201
201
|
type: "lm-player-quanping",
|
|
202
202
|
title: "\u5168\u5C4F"
|
|
203
|
-
}))
|
|
204
|
-
timeMode: timeMode,
|
|
205
|
-
onChange: function onChange(m) {
|
|
206
|
-
return updateState({
|
|
207
|
-
timeMode: m
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
})));
|
|
203
|
+
}))));
|
|
211
204
|
}
|
|
212
205
|
|
|
213
206
|
export default RecordTools;
|
|
@@ -8,6 +8,7 @@ interface ISegmentTimeLineProps {
|
|
|
8
8
|
updateState: (state: {
|
|
9
9
|
timeMode: number;
|
|
10
10
|
}) => void;
|
|
11
|
+
currentTime?: number;
|
|
11
12
|
}
|
|
12
|
-
declare function SegmentTimeLine({ begin, segments, onTimeChange, timeMode, updateState }: ISegmentTimeLineProps): JSX.Element;
|
|
13
|
+
declare function SegmentTimeLine({ begin, segments, onTimeChange, timeMode, updateState, currentTime }: ISegmentTimeLineProps): JSX.Element;
|
|
13
14
|
export default SegmentTimeLine;
|
|
@@ -8,7 +8,8 @@ function SegmentTimeLine(_ref) {
|
|
|
8
8
|
segments = _ref.segments,
|
|
9
9
|
onTimeChange = _ref.onTimeChange,
|
|
10
10
|
timeMode = _ref.timeMode,
|
|
11
|
-
updateState = _ref.updateState
|
|
11
|
+
updateState = _ref.updateState,
|
|
12
|
+
currentTime = _ref.currentTime;
|
|
12
13
|
var ref = useRef();
|
|
13
14
|
|
|
14
15
|
var _useThrottleFn = _useThrottleFn2(onTimeChange, {
|
|
@@ -24,8 +25,8 @@ function SegmentTimeLine(_ref) {
|
|
|
24
25
|
}).valueOf();
|
|
25
26
|
}, [begin]);
|
|
26
27
|
useTimeSlider(ref, {
|
|
27
|
-
begin: time,
|
|
28
|
-
currentTime: time,
|
|
28
|
+
begin: time - timeMode / 2 * 3600 * 1000,
|
|
29
|
+
currentTime: currentTime !== null && currentTime !== void 0 ? currentTime : time,
|
|
29
30
|
onTimeChange: run,
|
|
30
31
|
segments: segments,
|
|
31
32
|
hoursPer: timeMode,
|
|
@@ -17,8 +17,8 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
17
17
|
|
|
18
18
|
import moment from 'moment';
|
|
19
19
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
20
|
-
var hours = [1, 6, 12, 24];
|
|
21
|
-
|
|
20
|
+
var hours = [1, 6, 12, 24];
|
|
21
|
+
var currentColor = '#FF000A';
|
|
22
22
|
var normalLineColor = '#ffffff';
|
|
23
23
|
var hoverLineColor = '#319BFF';
|
|
24
24
|
var minPerStep = [1, 2, 5, 10, 15, 20, 30, 60, 120, 180, 240, 360, 720, 1440];
|
|
@@ -237,20 +237,32 @@ function useTimeSlider(canvasRef, _ref2) {
|
|
|
237
237
|
* 绘制当前刻度
|
|
238
238
|
* @returns
|
|
239
239
|
*/
|
|
240
|
-
// const drawCurrentLine = () => {
|
|
241
|
-
// const { currentTime, begin, hoursPer } = state;
|
|
242
|
-
// const time = currentTime;
|
|
243
|
-
// const range = [begin, currentTime + hoursPer * 3600 * 1000];
|
|
244
|
-
// if (time < range[0] || time > range[1]) {
|
|
245
|
-
// return;
|
|
246
|
-
// }
|
|
247
|
-
// const ms_current = time - begin;
|
|
248
|
-
// const px_per_ms = width / (hoursPer * 60 * 60 * 1000); // px/ms
|
|
249
|
-
// const left = px_per_ms * ms_current;
|
|
250
|
-
// drawText(ctx, { fillStyle: '#ffffff', font: '12px Arial', x: left - 64, y: 14, text: formartTimestemp(time) });
|
|
251
|
-
// drawLine(ctx, left, 20, left, height, currentColor, 2); //中间当前点线
|
|
252
|
-
// };
|
|
253
240
|
|
|
241
|
+
|
|
242
|
+
var drawCurrentLine = function drawCurrentLine() {
|
|
243
|
+
var currentTime = state.currentTime,
|
|
244
|
+
begin = state.begin,
|
|
245
|
+
hoursPer = state.hoursPer;
|
|
246
|
+
var time = currentTime;
|
|
247
|
+
var range = [begin, currentTime + hoursPer * 3600 * 1000];
|
|
248
|
+
|
|
249
|
+
if (time < range[0] || time > range[1]) {
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
var ms_current = time - begin;
|
|
254
|
+
var px_per_ms = width / (hoursPer * 60 * 60 * 1000); // px/ms
|
|
255
|
+
|
|
256
|
+
var left = px_per_ms * ms_current;
|
|
257
|
+
drawText(ctx, {
|
|
258
|
+
fillStyle: '#ffffff',
|
|
259
|
+
font: '12px Arial',
|
|
260
|
+
x: left - 64,
|
|
261
|
+
y: 14,
|
|
262
|
+
text: formartTimestemp(time)
|
|
263
|
+
});
|
|
264
|
+
drawLine(ctx, left, 20, left, height, currentColor, 2); //中间当前点线
|
|
265
|
+
};
|
|
254
266
|
/**
|
|
255
267
|
* 绘制提示时间
|
|
256
268
|
*/
|
|
@@ -291,16 +303,15 @@ function useTimeSlider(canvasRef, _ref2) {
|
|
|
291
303
|
if (canvas) {
|
|
292
304
|
clearCanvas();
|
|
293
305
|
drawOverlay();
|
|
294
|
-
drawScale();
|
|
295
|
-
|
|
306
|
+
drawScale();
|
|
307
|
+
drawCurrentLine();
|
|
296
308
|
state.hover.time && drawHoverLine();
|
|
297
309
|
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
298
310
|
|
|
299
311
|
}, [canvas, state.begin, state.currentTime, state.hoursPer, segments, state.hover]);
|
|
300
312
|
|
|
301
313
|
_useUpdateEffect(function () {
|
|
302
|
-
|
|
303
|
-
update({
|
|
314
|
+
return update({
|
|
304
315
|
begin: begin
|
|
305
316
|
});
|
|
306
317
|
}, [begin]);
|
|
@@ -309,8 +320,13 @@ function useTimeSlider(canvasRef, _ref2) {
|
|
|
309
320
|
return update({
|
|
310
321
|
hoursPer: hoursPer
|
|
311
322
|
});
|
|
312
|
-
}, [hoursPer]);
|
|
323
|
+
}, [hoursPer]);
|
|
313
324
|
|
|
325
|
+
_useUpdateEffect(function () {
|
|
326
|
+
return update({
|
|
327
|
+
currentTime: currentTime
|
|
328
|
+
});
|
|
329
|
+
}, [currentTime]);
|
|
314
330
|
/**
|
|
315
331
|
* 触发绘制范围单位(hour)
|
|
316
332
|
*/
|
|
@@ -442,7 +458,12 @@ function useTimeSlider(canvasRef, _ref2) {
|
|
|
442
458
|
|
|
443
459
|
var outTimeline = segmentItem && !segmentItem.url; // const new_begin = new_current - (state.hoursPer * 60 * 60 * 1000) / 2;
|
|
444
460
|
// setState((old) => ({ ...old, begin: new_begin, current: new_current }));
|
|
445
|
-
|
|
461
|
+
|
|
462
|
+
setState(function (old) {
|
|
463
|
+
return Object.assign(Object.assign({}, old), {
|
|
464
|
+
current: new_current
|
|
465
|
+
});
|
|
466
|
+
});
|
|
446
467
|
|
|
447
468
|
_nextTick(function () {
|
|
448
469
|
return onTimeChange === null || onTimeChange === void 0 ? void 0 : onTimeChange(new_current, outTimeline);
|