@cloud-app-dev/vidc 3.0.9 → 3.0.12
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/.prettierrc +1 -1
- package/.umirc.ts +3 -2
- package/clear-cache.sh +4 -0
- package/es/CustomRenderSelect/index.css +20 -0
- package/es/CustomRenderSelect/index.d.ts +10 -0
- package/es/CustomRenderSelect/index.js +73 -0
- package/es/List/DynamicGridList/index.js +4 -3
- package/es/List/DynamicList/utils.d.ts +1 -1
- package/es/List/DynamicList/utils.js +1 -1
- package/es/List/GridList/Demo.js +1 -1
- package/es/Player/api/index.d.ts +4 -4
- package/es/Player/contraller_bar/contraller_event.js +1 -1
- package/es/Player/demo.js +36 -12
- package/es/Player/event/errorEvent.d.ts +2 -2
- package/es/Player/event/errorEvent.js +2 -2
- package/es/Player/live_heart.d.ts +4 -2
- package/es/Player/live_heart.js +24 -12
- package/es/Player/message.js +4 -4
- package/es/Player/player.d.ts +4 -4
- package/es/Player/segment_player.js +1 -0
- package/es/Player/segment_timeline.d.ts +2 -1
- package/es/Player/segment_timeline.js +7 -12
- package/es/Player/single_player.js +2 -1
- package/es/Player/style/iconfont.css +150 -33
- package/es/Player/style/iconfont.ttf +0 -0
- package/es/Player/style/iconfont.woff +0 -0
- package/es/Player/style/iconfont.woff2 +0 -0
- package/es/Player/util.d.ts +1 -1
- package/es/Player/util.js +17 -22
- package/es/ScreenPlayer/Live.d.ts +1 -1
- package/es/ScreenPlayer/Live.js +67 -14
- package/es/ScreenPlayer/LiveTools.d.ts +3 -1
- package/es/ScreenPlayer/LiveTools.js +69 -33
- package/es/ScreenPlayer/PlayerWithExt.d.ts +2 -2
- package/es/ScreenPlayer/PlayerWithExt.js +5 -4
- package/es/ScreenPlayer/Record.d.ts +1 -1
- package/es/ScreenPlayer/Record.js +64 -32
- package/es/ScreenPlayer/RecordTools.d.ts +2 -1
- package/es/ScreenPlayer/RecordTools.js +46 -36
- package/es/ScreenPlayer/ScreenSelect.js +41 -20
- package/es/ScreenPlayer/SegmentTimeLine.d.ts +2 -2
- package/es/ScreenPlayer/SegmentTimeLine.js +17 -36
- package/es/ScreenPlayer/TimeMode.js +8 -2
- package/es/ScreenPlayer/TimeSlider.d.ts +2 -2
- package/es/ScreenPlayer/TimeSlider.js +15 -15
- package/es/ScreenPlayer/demo.js +4 -4
- package/es/ScreenPlayer/demo2.js +1 -1
- package/es/ScreenPlayer/index.css +29 -10
- package/es/ScreenPlayer/interface.d.ts +24 -4
- package/es/ScreenPlayer/useTimeSlider.d.ts +22 -0
- package/es/ScreenPlayer/useTimeSlider.js +485 -0
- package/es/ScreenPlayer/utils.d.ts +1 -0
- package/es/ScreenPlayer/utils.js +17 -8
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/package.json +2 -2
|
@@ -69,7 +69,8 @@ export function SegmentPlayerWithExt(_a) {
|
|
|
69
69
|
segments = _a.segments,
|
|
70
70
|
updatePlayer = _a.updatePlayer,
|
|
71
71
|
onClick = _a.onClick,
|
|
72
|
-
|
|
72
|
+
mode = _a.mode,
|
|
73
|
+
props = __rest(_a, ["begin", "style", "className", "segments", "updatePlayer", "onClick", "mode"]);
|
|
73
74
|
|
|
74
75
|
var ref = useRef();
|
|
75
76
|
var update = useCallback(function () {
|
|
@@ -87,7 +88,7 @@ export function SegmentPlayerWithExt(_a) {
|
|
|
87
88
|
onDoubleClick: toggleFullscreen
|
|
88
89
|
}, /*#__PURE__*/React.createElement(ExtModel, {
|
|
89
90
|
segments: segments,
|
|
90
|
-
mode:
|
|
91
|
+
mode: mode
|
|
91
92
|
}, /*#__PURE__*/React.createElement(SegmentPlayer, Object.assign({}, props, {
|
|
92
93
|
segments: segments,
|
|
93
94
|
type: "hls",
|
|
@@ -141,7 +142,7 @@ export function FrontendPlayerWithExt(_ref) {
|
|
|
141
142
|
return;
|
|
142
143
|
}
|
|
143
144
|
|
|
144
|
-
var endTime = moment(
|
|
145
|
+
var endTime = moment().unix();
|
|
145
146
|
var beginTime = moment(time).unix();
|
|
146
147
|
var videoUrl = new URL(state.url);
|
|
147
148
|
videoUrl.searchParams.set('begin', "".concat(beginTime));
|
|
@@ -151,7 +152,7 @@ export function FrontendPlayerWithExt(_ref) {
|
|
|
151
152
|
url: videoUrl.toString()
|
|
152
153
|
});
|
|
153
154
|
});
|
|
154
|
-
}, [
|
|
155
|
+
}, [state.url]);
|
|
155
156
|
var ref = useRef();
|
|
156
157
|
var update = useCallback(function () {
|
|
157
158
|
return updatePlayer(ref);
|
|
@@ -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, download }: IRecordPlayerProps): JSX.Element;
|
|
9
|
+
declare function RecordPlayer({ list, children, queryRecord, onIndexChange, onClose, onCloseAll, download, snapshot, defaultScreen, screenChange, defaultSelectIndex, }: IRecordPlayerProps): JSX.Element;
|
|
10
10
|
export default RecordPlayer;
|
|
@@ -1,5 +1,6 @@
|
|
|
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 _useUpdateEffect from "ahooks/es/useUpdateEffect";
|
|
3
4
|
import "antd/lib/message/style";
|
|
4
5
|
import _message from "antd/lib/message";
|
|
5
6
|
import _usePrevious from "ahooks/es/usePrevious";
|
|
@@ -36,6 +37,16 @@ import useRecordList from './useRecordList';
|
|
|
36
37
|
import useVideoFit from './useVideoFit';
|
|
37
38
|
import DisableMark from '../DisableMark';
|
|
38
39
|
import "./index.css";
|
|
40
|
+
var defaultState = {
|
|
41
|
+
screenNum: 4,
|
|
42
|
+
selectIndex: 0,
|
|
43
|
+
modes: [],
|
|
44
|
+
currentTimes: [],
|
|
45
|
+
loading: false,
|
|
46
|
+
seekTo: 0,
|
|
47
|
+
mergeSegments: [],
|
|
48
|
+
timeMode: 24
|
|
49
|
+
};
|
|
39
50
|
/**
|
|
40
51
|
* @desc 录像设计的时间全部需要到毫秒
|
|
41
52
|
* @param param0
|
|
@@ -51,18 +62,15 @@ function RecordPlayer(_ref) {
|
|
|
51
62
|
onIndexChange = _ref.onIndexChange,
|
|
52
63
|
onClose = _ref.onClose,
|
|
53
64
|
onCloseAll = _ref.onCloseAll,
|
|
54
|
-
download = _ref.download
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
mergeSegments: [],
|
|
64
|
-
timeMode: 24
|
|
65
|
-
}),
|
|
65
|
+
download = _ref.download,
|
|
66
|
+
snapshot = _ref.snapshot,
|
|
67
|
+
defaultScreen = _ref.defaultScreen,
|
|
68
|
+
screenChange = _ref.screenChange,
|
|
69
|
+
defaultSelectIndex = _ref.defaultSelectIndex;
|
|
70
|
+
|
|
71
|
+
var _useState = useState(Object.assign(Object.assign({}, defaultState), {
|
|
72
|
+
screenNum: defaultScreen !== null && defaultScreen !== void 0 ? defaultScreen : defaultState.screenNum
|
|
73
|
+
})),
|
|
66
74
|
_useState2 = _slicedToArray(_useState, 2),
|
|
67
75
|
state = _useState2[0],
|
|
68
76
|
setState = _useState2[1];
|
|
@@ -114,11 +122,6 @@ function RecordPlayer(_ref) {
|
|
|
114
122
|
|
|
115
123
|
return (_a = state.currentTimes[state.selectIndex]) !== null && _a !== void 0 ? _a : segmentItem.date;
|
|
116
124
|
}, [segmentItem.date, state.currentTimes, state.selectIndex]);
|
|
117
|
-
/**
|
|
118
|
-
* 专门
|
|
119
|
-
*/
|
|
120
|
-
|
|
121
|
-
useEffect(function () {}, [fit]);
|
|
122
125
|
/**
|
|
123
126
|
* @desc 用户缓存接收list的变化。
|
|
124
127
|
*/
|
|
@@ -203,7 +206,10 @@ function RecordPlayer(_ref) {
|
|
|
203
206
|
}
|
|
204
207
|
|
|
205
208
|
if (newState.hasOwnProperty('mode')) {
|
|
206
|
-
|
|
209
|
+
var newModes = _toConsumableArray(state.modes);
|
|
210
|
+
|
|
211
|
+
newModes[state.selectIndex] = newState.mode;
|
|
212
|
+
obj.modes = newModes;
|
|
207
213
|
}
|
|
208
214
|
|
|
209
215
|
if (newState.hasOwnProperty('timeMode')) {
|
|
@@ -307,20 +313,44 @@ function RecordPlayer(_ref) {
|
|
|
307
313
|
setState(function (old) {
|
|
308
314
|
return Object.assign({}, old);
|
|
309
315
|
});
|
|
310
|
-
};
|
|
311
|
-
|
|
316
|
+
};
|
|
317
|
+
/**
|
|
318
|
+
* 同步外部的selectIndex变化
|
|
319
|
+
*/
|
|
312
320
|
|
|
313
321
|
|
|
314
322
|
useEffect(function () {
|
|
315
|
-
|
|
323
|
+
if (typeof defaultSelectIndex !== 'number') {
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
setState(function (old) {
|
|
328
|
+
if (old.selectIndex !== defaultSelectIndex) {
|
|
329
|
+
return Object.assign(Object.assign({}, old), {
|
|
330
|
+
selectIndex: defaultSelectIndex
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
return old;
|
|
335
|
+
});
|
|
336
|
+
}, [defaultSelectIndex]); // index变化同步到父组件
|
|
337
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
338
|
+
|
|
339
|
+
_useUpdateEffect(function () {
|
|
340
|
+
return onIndexChange && onIndexChange(state.selectIndex);
|
|
316
341
|
}, [state.selectIndex]);
|
|
342
|
+
|
|
343
|
+
_useUpdateEffect(function () {
|
|
344
|
+
return screenChange && screenChange(state.screenNum);
|
|
345
|
+
}, [state.screenNum]);
|
|
346
|
+
|
|
317
347
|
return /*#__PURE__*/React.createElement("div", {
|
|
318
|
-
className: "split-screen-player-wrapper split-screen-player-wrapper-record"
|
|
319
|
-
ref: domRef
|
|
348
|
+
className: "split-screen-player-wrapper split-screen-player-wrapper-record"
|
|
320
349
|
}, /*#__PURE__*/React.createElement("div", {
|
|
321
|
-
className: "player-layout"
|
|
350
|
+
className: "player-layout",
|
|
351
|
+
ref: domRef
|
|
322
352
|
}, screenList.map(function (item, index) {
|
|
323
|
-
var _a, _b, _c, _d, _e, _f;
|
|
353
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
324
354
|
|
|
325
355
|
return item.recordType === 1 ? /*#__PURE__*/React.createElement(SegmentPlayerWithExt, Object.assign({}, item, {
|
|
326
356
|
segments: ((_a = recordList[index]) === null || _a === void 0 ? void 0 : _a.segments) || [],
|
|
@@ -339,10 +369,11 @@ function RecordPlayer(_ref) {
|
|
|
339
369
|
style: {
|
|
340
370
|
width: screenType.width,
|
|
341
371
|
height: screenType.height
|
|
342
|
-
}
|
|
372
|
+
},
|
|
373
|
+
mode: (_d = item.mode) !== null && _d !== void 0 ? _d : state.modes[index]
|
|
343
374
|
})) : /*#__PURE__*/React.createElement(FrontendPlayerWithExt, Object.assign({}, item, {
|
|
344
375
|
className: state.selectIndex === index ? 'player-current-index' : '',
|
|
345
|
-
segments: ((
|
|
376
|
+
segments: ((_e = recordList[index]) === null || _e === void 0 ? void 0 : _e.segments) || [],
|
|
346
377
|
updatePlayer: function updatePlayer(player) {
|
|
347
378
|
return _updatePlayer(player, index);
|
|
348
379
|
},
|
|
@@ -353,8 +384,8 @@ function RecordPlayer(_ref) {
|
|
|
353
384
|
});
|
|
354
385
|
});
|
|
355
386
|
},
|
|
356
|
-
mode: state.
|
|
357
|
-
key: "".concat((
|
|
387
|
+
mode: (_f = item.mode) !== null && _f !== void 0 ? _f : state.modes[index],
|
|
388
|
+
key: "".concat((_g = item === null || item === void 0 ? void 0 : item.date) !== null && _g !== void 0 ? _g : '', "-").concat((_h = item.cid) !== null && _h !== void 0 ? _h : '', "-").concat(index),
|
|
358
389
|
style: {
|
|
359
390
|
width: screenType.width,
|
|
360
391
|
height: screenType.height
|
|
@@ -370,18 +401,19 @@ function RecordPlayer(_ref) {
|
|
|
370
401
|
toggleFit: toggleFit,
|
|
371
402
|
getPlayerItem: getPlayerItem,
|
|
372
403
|
screenNum: state.screenNum,
|
|
373
|
-
mode: state.
|
|
404
|
+
mode: state.modes[state.selectIndex],
|
|
374
405
|
containerRef: domRef,
|
|
375
406
|
updateState: updateState,
|
|
376
407
|
onTimeChange: onTimeChange,
|
|
377
408
|
onClose: onClose,
|
|
378
409
|
onCloseAll: onCloseAll,
|
|
379
410
|
timeMode: state.timeMode,
|
|
380
|
-
download: download
|
|
411
|
+
download: download,
|
|
412
|
+
snapshot: snapshot
|
|
381
413
|
}), /*#__PURE__*/React.createElement(SegmentTimeLine, {
|
|
382
414
|
begin: timeBegin,
|
|
383
415
|
updateState: updateState,
|
|
384
|
-
|
|
416
|
+
segments: segmentItem.segments,
|
|
385
417
|
key: state.selectIndex,
|
|
386
418
|
onTimeChange: onTimeChange,
|
|
387
419
|
timeMode: state.timeMode
|
|
@@ -19,6 +19,7 @@ interface IToolsProps {
|
|
|
19
19
|
onCloseAll?: () => void;
|
|
20
20
|
timeMode: number;
|
|
21
21
|
download?: () => void;
|
|
22
|
+
snapshot?: (base64: string) => void;
|
|
22
23
|
}
|
|
23
|
-
declare function RecordTools({ containerRef, updateState, download, screenNum, timeMode, getPlayerItem, mode, toggleFit, fit, time, onTimeChange, onClose, onCloseAll }: IToolsProps): JSX.Element;
|
|
24
|
+
declare function RecordTools({ containerRef, updateState, download, screenNum, timeMode, getPlayerItem, mode, toggleFit, fit, time, onTimeChange, onClose, onCloseAll, snapshot, }: IToolsProps): JSX.Element;
|
|
24
25
|
export default RecordTools;
|
|
@@ -32,7 +32,8 @@ function RecordTools(_ref) {
|
|
|
32
32
|
time = _ref.time,
|
|
33
33
|
onTimeChange = _ref.onTimeChange,
|
|
34
34
|
onClose = _ref.onClose,
|
|
35
|
-
onCloseAll = _ref.onCloseAll
|
|
35
|
+
onCloseAll = _ref.onCloseAll,
|
|
36
|
+
snapshot = _ref.snapshot;
|
|
36
37
|
|
|
37
38
|
var _useFullscreen = _useFullscreen3(containerRef),
|
|
38
39
|
_useFullscreen2 = _slicedToArray(_useFullscreen, 2),
|
|
@@ -56,9 +57,10 @@ function RecordTools(_ref) {
|
|
|
56
57
|
player ? player.reload ? player.reload() : player.api.reload() : undefined;
|
|
57
58
|
};
|
|
58
59
|
|
|
59
|
-
var
|
|
60
|
+
var snapshotaction = function snapshotaction() {
|
|
60
61
|
var player = getPlayerItem();
|
|
61
|
-
|
|
62
|
+
var base64 = player ? player.api.snapshot() : undefined;
|
|
63
|
+
snapshot && snapshot(base64);
|
|
62
64
|
};
|
|
63
65
|
|
|
64
66
|
var player = getPlayerItem();
|
|
@@ -76,7 +78,7 @@ function RecordTools(_ref) {
|
|
|
76
78
|
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
77
79
|
type: "lm-player-xiangji1fill",
|
|
78
80
|
title: "\u622A\u56FE",
|
|
79
|
-
onClick:
|
|
81
|
+
onClick: snapshotaction
|
|
80
82
|
})), /*#__PURE__*/React.createElement("span", {
|
|
81
83
|
className: "player-tools-item",
|
|
82
84
|
onClick: reload
|
|
@@ -85,38 +87,56 @@ function RecordTools(_ref) {
|
|
|
85
87
|
title: "\u91CD\u8F7D"
|
|
86
88
|
})), /*#__PURE__*/React.createElement("span", {
|
|
87
89
|
className: "player-tools-item",
|
|
88
|
-
onClick:
|
|
90
|
+
onClick: download
|
|
89
91
|
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
90
|
-
type: "lm-player-
|
|
91
|
-
title: "\
|
|
92
|
+
type: "lm-player-xiazai",
|
|
93
|
+
title: "\u4E0B\u8F7D\u5F53\u524D\u5F55\u50CF"
|
|
92
94
|
})), /*#__PURE__*/React.createElement("span", {
|
|
93
95
|
className: "player-tools-item",
|
|
94
|
-
onClick:
|
|
96
|
+
onClick: function onClick() {
|
|
97
|
+
return updateState({
|
|
98
|
+
mode: mode !== 2 ? 2 : 1
|
|
99
|
+
});
|
|
100
|
+
}
|
|
95
101
|
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
96
|
-
|
|
97
|
-
|
|
102
|
+
style: {
|
|
103
|
+
top: 2,
|
|
104
|
+
position: 'relative',
|
|
105
|
+
left: 1
|
|
106
|
+
},
|
|
107
|
+
type: "lm-player-S_Device_shezhi",
|
|
108
|
+
title: "\u5207\u6362".concat(mode === 1 ? '插件' : '浏览器', "\u6A21\u5F0F")
|
|
98
109
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
99
110
|
className: "player-tools-mid"
|
|
100
|
-
}, /*#__PURE__*/React.createElement("
|
|
111
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
101
112
|
className: "player-tools-item",
|
|
102
|
-
onClick:
|
|
103
|
-
},
|
|
104
|
-
type: "lm-player-
|
|
105
|
-
title: "\
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
113
|
+
onClick: onClose
|
|
114
|
+
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
115
|
+
type: "lm-player-tingzhi",
|
|
116
|
+
title: "\u505C\u6B62",
|
|
117
|
+
style: {
|
|
118
|
+
fontSize: 16
|
|
119
|
+
}
|
|
109
120
|
})), /*#__PURE__*/React.createElement(TimeSelect, {
|
|
110
121
|
time: time,
|
|
111
122
|
onChange: onTimeChange
|
|
112
|
-
}), /*#__PURE__*/React.createElement("
|
|
123
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
113
124
|
className: "player-tools-item",
|
|
114
125
|
onClick: playToggle
|
|
115
126
|
}, player && !player.video.paused ? /*#__PURE__*/React.createElement(IconFont, {
|
|
116
127
|
type: "lm-player-Pause_Main",
|
|
117
|
-
title: "\u6682\u505C"
|
|
128
|
+
title: "\u6682\u505C",
|
|
129
|
+
style: {
|
|
130
|
+
fontSize: 22
|
|
131
|
+
}
|
|
118
132
|
}) : /*#__PURE__*/React.createElement(IconFont, {
|
|
119
|
-
|
|
133
|
+
style: {
|
|
134
|
+
fontSize: 17,
|
|
135
|
+
position: 'relative',
|
|
136
|
+
left: 2,
|
|
137
|
+
top: 2
|
|
138
|
+
},
|
|
139
|
+
type: "lm-player-bofang",
|
|
120
140
|
title: "\u64AD\u653E"
|
|
121
141
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
122
142
|
className: "player-tools-right"
|
|
@@ -124,26 +144,16 @@ function RecordTools(_ref) {
|
|
|
124
144
|
className: "player-tools-item",
|
|
125
145
|
onClick: onCloseAll
|
|
126
146
|
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
127
|
-
type: "lm-player-
|
|
147
|
+
type: "lm-player-quanbuguanbi",
|
|
128
148
|
title: "\u5173\u95ED\u6240\u6709"
|
|
129
|
-
})), /*#__PURE__*/React.createElement("span", {
|
|
130
|
-
className: "player-tools-item",
|
|
131
|
-
onClick: function onClick() {
|
|
132
|
-
return updateState({
|
|
133
|
-
mode: mode === 1 ? 2 : 1
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
137
|
-
type: "lm-player-YesorNo_No_Dark",
|
|
138
|
-
title: "\u5207\u6362".concat(mode === 1 ? '插件' : '浏览器', "\u6A21\u5F0F")
|
|
139
149
|
})), /*#__PURE__*/React.createElement("span", {
|
|
140
150
|
className: "player-tools-item",
|
|
141
151
|
onClick: toggleFit
|
|
142
152
|
}, fit === 'fill' ? /*#__PURE__*/React.createElement(IconFont, {
|
|
143
|
-
type: "lm-player-
|
|
153
|
+
type: "lm-player-huamianshiying",
|
|
144
154
|
title: "\u81EA\u9002\u5E94"
|
|
145
155
|
}) : /*#__PURE__*/React.createElement(IconFont, {
|
|
146
|
-
type: "lm-player-
|
|
156
|
+
type: "lm-player-huamianshiying",
|
|
147
157
|
title: "\u586B\u5145"
|
|
148
158
|
})), /*#__PURE__*/React.createElement(ScreenSelect, {
|
|
149
159
|
screenNum: screenNum,
|
|
@@ -152,10 +162,10 @@ function RecordTools(_ref) {
|
|
|
152
162
|
className: "player-tools-item",
|
|
153
163
|
onClick: toggleFullscreen
|
|
154
164
|
}, isFullscreen ? /*#__PURE__*/React.createElement(IconFont, {
|
|
155
|
-
type: "lm-player-
|
|
165
|
+
type: "lm-player-quanping",
|
|
156
166
|
title: "\u5168\u5C4F"
|
|
157
167
|
}) : /*#__PURE__*/React.createElement(IconFont, {
|
|
158
|
-
type: "lm-player-
|
|
168
|
+
type: "lm-player-quanping",
|
|
159
169
|
title: "\u5168\u5C4F"
|
|
160
170
|
})), /*#__PURE__*/React.createElement(TimeMode, {
|
|
161
171
|
timeMode: timeMode,
|
|
@@ -1,28 +1,49 @@
|
|
|
1
|
-
import "antd/lib/
|
|
2
|
-
import
|
|
3
|
-
import React from 'react';
|
|
1
|
+
import "antd/lib/select/style";
|
|
2
|
+
import _Select from "antd/lib/select";
|
|
3
|
+
import React, { useMemo } from 'react';
|
|
4
|
+
import CustomRenderSelect from '../CustomRenderSelect';
|
|
4
5
|
import { ScreenType } from './utils';
|
|
6
|
+
import IconFont from '../Player/iconfont';
|
|
5
7
|
|
|
6
8
|
function ScreenSelect(_ref) {
|
|
7
9
|
var screenNum = _ref.screenNum,
|
|
8
10
|
updateState = _ref.updateState;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
11
|
+
var icon = useMemo(function () {
|
|
12
|
+
return ScreenType.find(function (v) {
|
|
13
|
+
return v.name === screenNum;
|
|
14
|
+
}).icon;
|
|
15
|
+
}, []);
|
|
16
|
+
return /*#__PURE__*/React.createElement(CustomRenderSelect, {
|
|
17
|
+
value: screenNum,
|
|
18
|
+
dropdownClassName: "custom-select-dropdown ",
|
|
19
|
+
customRender: function customRender() {
|
|
20
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
21
|
+
className: "select-current-screen-item"
|
|
22
|
+
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
23
|
+
type: icon
|
|
24
|
+
}));
|
|
25
|
+
},
|
|
26
|
+
onChange: function onChange(v) {
|
|
27
|
+
return updateState({
|
|
28
|
+
screenNum: v
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
placement: "topLeft"
|
|
32
|
+
}, ScreenType.map(function (item) {
|
|
33
|
+
return /*#__PURE__*/React.createElement(_Select.Option, {
|
|
34
|
+
key: "".concat(item.name),
|
|
35
|
+
value: item.name
|
|
36
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
37
|
+
style: {
|
|
38
|
+
paddingRight: 4,
|
|
39
|
+
color: 'var(--icon)',
|
|
40
|
+
position: 'relative',
|
|
41
|
+
top: 1
|
|
42
|
+
}
|
|
43
|
+
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
44
|
+
type: item.icon
|
|
45
|
+
})), item.name, "\u5206\u5C4F");
|
|
46
|
+
}));
|
|
26
47
|
}
|
|
27
48
|
|
|
28
49
|
export default ScreenSelect;
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import { ISegmentType } from '../Player/player';
|
|
3
3
|
interface ISegmentTimeLineProps {
|
|
4
4
|
begin?: number;
|
|
5
|
-
|
|
5
|
+
segments?: ISegmentType[];
|
|
6
6
|
onTimeChange?: (time: number) => void;
|
|
7
7
|
timeMode: number;
|
|
8
8
|
updateState: (state: {
|
|
9
9
|
timeMode: number;
|
|
10
10
|
}) => void;
|
|
11
11
|
}
|
|
12
|
-
declare function SegmentTimeLine({ begin,
|
|
12
|
+
declare function SegmentTimeLine({ begin, segments, onTimeChange, timeMode, updateState }: ISegmentTimeLineProps): JSX.Element;
|
|
13
13
|
export default SegmentTimeLine;
|
|
@@ -1,59 +1,40 @@
|
|
|
1
|
-
import _useUnmount from "ahooks/es/useUnmount";
|
|
2
|
-
import _useUpdateEffect from "ahooks/es/useUpdateEffect";
|
|
3
1
|
import _useThrottleFn2 from "ahooks/es/useThrottleFn";
|
|
4
|
-
import _useSize from "ahooks/es/useSize";
|
|
5
2
|
import moment from 'moment';
|
|
6
|
-
import React, {
|
|
7
|
-
import
|
|
3
|
+
import React, { useMemo, useRef } from 'react';
|
|
4
|
+
import useTimeSlider from './useTimeSlider';
|
|
8
5
|
|
|
9
6
|
function SegmentTimeLine(_ref) {
|
|
10
7
|
var begin = _ref.begin,
|
|
11
|
-
|
|
8
|
+
segments = _ref.segments,
|
|
12
9
|
onTimeChange = _ref.onTimeChange,
|
|
13
10
|
timeMode = _ref.timeMode,
|
|
14
11
|
updateState = _ref.updateState;
|
|
15
12
|
var ref = useRef();
|
|
16
|
-
var timeSliderRef = useRef();
|
|
17
|
-
|
|
18
|
-
var size = _useSize(ref);
|
|
19
13
|
|
|
20
14
|
var _useThrottleFn = _useThrottleFn2(onTimeChange, {
|
|
21
15
|
wait: 300
|
|
22
16
|
}),
|
|
23
17
|
run = _useThrottleFn.run;
|
|
24
18
|
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
var time = useMemo(function () {
|
|
20
|
+
return begin !== null && begin !== void 0 ? begin : moment().set({
|
|
27
21
|
hours: 0,
|
|
28
22
|
minutes: 0,
|
|
29
23
|
seconds: 0
|
|
30
24
|
}).valueOf();
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
}
|
|
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;
|
|
25
|
+
}, [begin]);
|
|
26
|
+
useTimeSlider(ref, {
|
|
27
|
+
begin: time - timeMode / 2 * 3600 * 1000,
|
|
28
|
+
currentTime: time,
|
|
29
|
+
onTimeChange: run,
|
|
30
|
+
segments: segments,
|
|
31
|
+
hoursPer: timeMode,
|
|
32
|
+
onHoursPerChange: function onHoursPerChange(hour) {
|
|
33
|
+
return updateState({
|
|
34
|
+
timeMode: hour
|
|
35
|
+
});
|
|
36
|
+
}
|
|
55
37
|
});
|
|
56
|
-
|
|
57
38
|
return /*#__PURE__*/React.createElement("div", {
|
|
58
39
|
className: "record-time-line"
|
|
59
40
|
}, /*#__PURE__*/React.createElement("canvas", {
|
|
@@ -10,13 +10,19 @@ function TimeMode(_ref) {
|
|
|
10
10
|
value: timeMode,
|
|
11
11
|
onChange: onChange,
|
|
12
12
|
className: "time-mode-select",
|
|
13
|
-
dropdownClassName: "
|
|
13
|
+
dropdownClassName: "custom-select-dropdown",
|
|
14
14
|
placement: "topLeft"
|
|
15
15
|
}, TimeModeLibs.map(function (item) {
|
|
16
16
|
return /*#__PURE__*/React.createElement(_Select.Option, {
|
|
17
17
|
value: item.name,
|
|
18
18
|
key: item.name
|
|
19
|
-
},
|
|
19
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
20
|
+
style: {
|
|
21
|
+
display: 'inline-block',
|
|
22
|
+
width: 20,
|
|
23
|
+
textAlign: 'center'
|
|
24
|
+
}
|
|
25
|
+
}, item.name), "\u5C0F\u65F6");
|
|
20
26
|
}));
|
|
21
27
|
}
|
|
22
28
|
|
|
@@ -91,11 +91,11 @@ export default class TimeSlider {
|
|
|
91
91
|
*/
|
|
92
92
|
mousemoveFunc2: (e: MouseEvent) => void;
|
|
93
93
|
/**
|
|
94
|
-
*
|
|
94
|
+
* 点击 mouseup事件
|
|
95
95
|
*/
|
|
96
96
|
mouseupFunc: (e: MouseEvent) => void;
|
|
97
97
|
/**
|
|
98
|
-
*
|
|
98
|
+
* 拖动停止 mouseup事件
|
|
99
99
|
*/
|
|
100
100
|
mouseupFunc2: () => void;
|
|
101
101
|
/**
|
|
@@ -48,8 +48,9 @@ var TimeSlider = /*#__PURE__*/function () {
|
|
|
48
48
|
_this.g_isMousedown = true;
|
|
49
49
|
_this.g_mousedownCursor = _this.get_cursor_x_position(e); //记住mousedown的位置
|
|
50
50
|
|
|
51
|
-
document.addEventListener('mousemove', _this.mousemoveFunc);
|
|
52
|
-
|
|
51
|
+
document.addEventListener('mousemove', _this.mousemoveFunc); //拖动
|
|
52
|
+
|
|
53
|
+
document.addEventListener('mouseup', _this.mouseupFunc2); //停止拖动
|
|
53
54
|
};
|
|
54
55
|
/**
|
|
55
56
|
* 鼠标移出隐藏时间 mouseout事件
|
|
@@ -112,16 +113,12 @@ var TimeSlider = /*#__PURE__*/function () {
|
|
|
112
113
|
}
|
|
113
114
|
};
|
|
114
115
|
/**
|
|
115
|
-
*
|
|
116
|
+
* 点击 mouseup事件
|
|
116
117
|
*/
|
|
117
118
|
|
|
118
119
|
|
|
119
120
|
this.mouseupFunc = function (e) {
|
|
120
|
-
if (_this.g_isMousemove) {
|
|
121
|
-
//拖动 事件
|
|
122
|
-
_this.g_isMousemove = false;
|
|
123
|
-
_this.g_isMousedown = false; // this.returnTime = this.start_timestamp + (this.hours_per_ruler * 3600 * 1000) / 2;
|
|
124
|
-
} else {
|
|
121
|
+
if (!_this.g_isMousemove) {
|
|
125
122
|
// click 事件
|
|
126
123
|
_this.g_isMousedown = false;
|
|
127
124
|
|
|
@@ -144,11 +141,9 @@ var TimeSlider = /*#__PURE__*/function () {
|
|
|
144
141
|
|
|
145
142
|
_this.options.onTimeChange && _this.options.onTimeChange(current_timestamp, outTimeline);
|
|
146
143
|
}
|
|
147
|
-
|
|
148
|
-
document.removeEventListener('mousemove', _this.mousemoveFunc);
|
|
149
144
|
};
|
|
150
145
|
/**
|
|
151
|
-
*
|
|
146
|
+
* 拖动停止 mouseup事件
|
|
152
147
|
*/
|
|
153
148
|
|
|
154
149
|
|
|
@@ -466,10 +461,14 @@ var TimeSlider = /*#__PURE__*/function () {
|
|
|
466
461
|
}, {
|
|
467
462
|
key: "add_events",
|
|
468
463
|
value: function add_events() {
|
|
469
|
-
this.canvas.addEventListener('mousewheel', this.mousewheelFunc);
|
|
470
|
-
|
|
471
|
-
this.canvas.addEventListener('
|
|
472
|
-
|
|
464
|
+
this.canvas.addEventListener('mousewheel', this.mousewheelFunc); // 调整刻度范围
|
|
465
|
+
|
|
466
|
+
this.canvas.addEventListener('mousedown', this.mousedownFunc); // 触发 拖动或者点击标记
|
|
467
|
+
|
|
468
|
+
this.canvas.addEventListener('mousemove', this.mousemoveFunc2); //hover 提示当前刻度时间
|
|
469
|
+
|
|
470
|
+
this.canvas.addEventListener('mouseup', this.mouseupFunc); // 点击触发
|
|
471
|
+
|
|
473
472
|
this.canvas.addEventListener('mouseout', this.mouseoutFunc);
|
|
474
473
|
}
|
|
475
474
|
}, {
|
|
@@ -484,6 +483,7 @@ var TimeSlider = /*#__PURE__*/function () {
|
|
|
484
483
|
}, {
|
|
485
484
|
key: "destory",
|
|
486
485
|
value: function destory() {
|
|
486
|
+
this.clearCanvas();
|
|
487
487
|
this.remove_events();
|
|
488
488
|
this.canvas = null;
|
|
489
489
|
this.options = null;
|