@cloud-app-dev/vidc 3.0.7 → 3.0.8
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/RecordTools.d.ts +2 -1
- package/es/ScreenPlayer/RecordTools.js +3 -1
- package/es/ScreenPlayer/SegmentTimeLine.d.ts +1 -1
- package/es/ScreenPlayer/SegmentTimeLine.js +26 -7
- package/es/ScreenPlayer/TimeSlider.d.ts +2 -0
- package/es/ScreenPlayer/TimeSlider.js +28 -6
- package/es/ScreenPlayer/interface.d.ts +3 -2
- package/package.json +1 -1
|
@@ -18,6 +18,7 @@ interface IToolsProps {
|
|
|
18
18
|
onClose?: () => void;
|
|
19
19
|
onCloseAll?: () => void;
|
|
20
20
|
timeMode: number;
|
|
21
|
+
download?: () => void;
|
|
21
22
|
}
|
|
22
|
-
declare function RecordTools({ containerRef, updateState, screenNum, timeMode, 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;
|
|
23
24
|
export default RecordTools;
|
|
@@ -22,6 +22,7 @@ import TimeMode from './TimeMode';
|
|
|
22
22
|
function RecordTools(_ref) {
|
|
23
23
|
var containerRef = _ref.containerRef,
|
|
24
24
|
updateState = _ref.updateState,
|
|
25
|
+
download = _ref.download,
|
|
25
26
|
screenNum = _ref.screenNum,
|
|
26
27
|
timeMode = _ref.timeMode,
|
|
27
28
|
getPlayerItem = _ref.getPlayerItem,
|
|
@@ -89,7 +90,8 @@ function RecordTools(_ref) {
|
|
|
89
90
|
type: "lm-player-YesorNo_No_Dark",
|
|
90
91
|
title: "\u5173\u95ED\u5F53\u524D"
|
|
91
92
|
})), /*#__PURE__*/React.createElement("span", {
|
|
92
|
-
className: "player-tools-item"
|
|
93
|
+
className: "player-tools-item",
|
|
94
|
+
onClick: download
|
|
93
95
|
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
94
96
|
type: "lm-player-S_Edit_LoadDown",
|
|
95
97
|
title: "\u4E0B\u8F7D\u5F53\u524D\u5F55\u50CF"
|
|
@@ -9,5 +9,5 @@ interface ISegmentTimeLineProps {
|
|
|
9
9
|
timeMode: number;
|
|
10
10
|
}) => void;
|
|
11
11
|
}
|
|
12
|
-
declare function SegmentTimeLine({ begin, timeCell, onTimeChange, timeMode }: ISegmentTimeLineProps): JSX.Element;
|
|
12
|
+
declare function SegmentTimeLine({ begin, timeCell, onTimeChange, timeMode, updateState }: ISegmentTimeLineProps): JSX.Element;
|
|
13
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';
|
|
@@ -8,8 +10,10 @@ function SegmentTimeLine(_ref) {
|
|
|
8
10
|
var begin = _ref.begin,
|
|
9
11
|
timeCell = _ref.timeCell,
|
|
10
12
|
onTimeChange = _ref.onTimeChange,
|
|
11
|
-
timeMode = _ref.timeMode
|
|
13
|
+
timeMode = _ref.timeMode,
|
|
14
|
+
updateState = _ref.updateState;
|
|
12
15
|
var ref = useRef();
|
|
16
|
+
var timeSliderRef = useRef();
|
|
13
17
|
|
|
14
18
|
var size = _useSize(ref);
|
|
15
19
|
|
|
@@ -24,17 +28,32 @@ function SegmentTimeLine(_ref) {
|
|
|
24
28
|
minutes: 0,
|
|
25
29
|
seconds: 0
|
|
26
30
|
}).valueOf();
|
|
27
|
-
|
|
31
|
+
timeSliderRef.current = new TimeSlider(ref.current, {
|
|
28
32
|
onTimeChange: run,
|
|
29
33
|
start_timestamp: time - timeMode / 2 * 3600 * 1000,
|
|
30
34
|
current_timestamp: time,
|
|
31
35
|
timecell: timeCell,
|
|
32
|
-
hours_per_ruler: timeMode
|
|
36
|
+
hours_per_ruler: timeMode,
|
|
37
|
+
onHoursPerChange: function onHoursPerChange(hour) {
|
|
38
|
+
return updateState({
|
|
39
|
+
timeMode: hour
|
|
40
|
+
});
|
|
41
|
+
}
|
|
33
42
|
});
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
+
|
|
38
57
|
return /*#__PURE__*/React.createElement("div", {
|
|
39
58
|
className: "record-time-line"
|
|
40
59
|
}, /*#__PURE__*/React.createElement("canvas", {
|
|
@@ -5,6 +5,7 @@ export interface ITimeSliderOptions {
|
|
|
5
5
|
timecell?: TimeCellItem[];
|
|
6
6
|
current_timestamp?: number;
|
|
7
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
|
|
@@ -5,6 +5,8 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
|
|
|
5
5
|
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
6
|
|
|
7
7
|
import moment from 'moment';
|
|
8
|
+
import { nextTick } from 'process';
|
|
9
|
+
var hours = [1, 6, 12, 24];
|
|
8
10
|
var currentColor = '#FF000A';
|
|
9
11
|
var normalLineColor = '#ffffff';
|
|
10
12
|
var hoverLineColor = '#319BFF';
|
|
@@ -177,24 +179,33 @@ var TimeSlider = /*#__PURE__*/function () {
|
|
|
177
179
|
var middle_time = _this.start_timestamp + _this.hours_per_ruler * 3600 * 1000 / 2; //ms 记住当前中间的时间
|
|
178
180
|
|
|
179
181
|
if (delta < 0) {
|
|
180
|
-
|
|
182
|
+
// 缩小
|
|
183
|
+
var index = hours.indexOf(_this.zoom);
|
|
181
184
|
|
|
182
|
-
if (
|
|
183
|
-
_this.zoom =
|
|
185
|
+
if (index === hours.length - 1) {
|
|
186
|
+
_this.zoom = hours[index];
|
|
187
|
+
} else {
|
|
188
|
+
_this.zoom = hours[index + 1];
|
|
184
189
|
}
|
|
185
190
|
|
|
186
191
|
_this.hours_per_ruler = _this.zoom;
|
|
187
192
|
} else if (delta > 0) {
|
|
188
193
|
// 放大
|
|
189
|
-
|
|
194
|
+
var _index = hours.indexOf(_this.zoom);
|
|
190
195
|
|
|
191
|
-
if (
|
|
192
|
-
_this.zoom =
|
|
196
|
+
if (_index === 0) {
|
|
197
|
+
_this.zoom = hours[0];
|
|
198
|
+
} else {
|
|
199
|
+
_this.zoom = hours[_index - 1];
|
|
193
200
|
}
|
|
194
201
|
|
|
195
202
|
_this.hours_per_ruler = _this.zoom;
|
|
196
203
|
}
|
|
197
204
|
|
|
205
|
+
nextTick(function () {
|
|
206
|
+
return _this.options.onHoursPerChange && _this.options.onHoursPerChange(_this.hours_per_ruler);
|
|
207
|
+
});
|
|
208
|
+
|
|
198
209
|
_this.clearCanvas();
|
|
199
210
|
|
|
200
211
|
_this.start_timestamp = middle_time - _this.hours_per_ruler * 3600 * 1000 / 2; //start_timestamp = 当前中间的时间 - zoom/2
|
|
@@ -512,6 +523,17 @@ var TimeSlider = /*#__PURE__*/function () {
|
|
|
512
523
|
}
|
|
513
524
|
}
|
|
514
525
|
}
|
|
526
|
+
}, {
|
|
527
|
+
key: "drawHourChange",
|
|
528
|
+
value: function drawHourChange(hour) {
|
|
529
|
+
var middle_time = this.start_timestamp + this.hours_per_ruler * 3600 * 1000 / 2; //ms 记住当前中间的时间
|
|
530
|
+
|
|
531
|
+
this.hours_per_ruler = this.zoom = hour;
|
|
532
|
+
this.clearCanvas();
|
|
533
|
+
this.start_timestamp = middle_time - this.hours_per_ruler * 3600 * 1000 / 2; //start_timestamp = 当前中间的时间 - zoom/2
|
|
534
|
+
|
|
535
|
+
this.init(this.start_timestamp, this.timecell, true);
|
|
536
|
+
}
|
|
515
537
|
/**
|
|
516
538
|
* 清除canvas 每次重新绘制需要先清除
|
|
517
539
|
*/
|
|
@@ -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 {
|
|
@@ -77,7 +78,7 @@ export interface IRecordPlayerState {
|
|
|
77
78
|
/**
|
|
78
79
|
* 录像时间轴单页绘制时长单位(hour)
|
|
79
80
|
*/
|
|
80
|
-
timeMode:number
|
|
81
|
+
timeMode: number;
|
|
81
82
|
}
|
|
82
83
|
|
|
83
84
|
export type ScreenItemLivePlayerType = {
|