@cloud-app-dev/vidc 3.0.11 → 3.0.14

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.
Files changed (45) hide show
  1. package/.prettierrc +1 -1
  2. package/es/CheckGroupFixed/index.js +1 -1
  3. package/es/DomMove/demo.d.ts +1 -1
  4. package/es/DomMove/demo.js +1 -1
  5. package/es/DomMove/index.js +4 -3
  6. package/es/FullScreen/index.js +5 -5
  7. package/es/Input/index.js +4 -4
  8. package/es/List/VList/index.d.ts +1 -1
  9. package/es/LoaderScript/index.js +3 -3
  10. package/es/LoaderScript/utils.js +4 -2
  11. package/es/Map/LevelCenter/DragMarker/index.js +2 -2
  12. package/es/Map/LoaderMap/index.js +3 -3
  13. package/es/Picture/component/DefaultRects/index.js +1 -1
  14. package/es/Picture/component/DrawRect/index.js +1 -1
  15. package/es/Picture/component/RectMenu/index.js +1 -1
  16. package/es/Picture/index.js +1 -2
  17. package/es/Player/contraller_bar/right_bar.js +2 -3
  18. package/es/Player/frontend_player.js +3 -2
  19. package/es/Player/frontend_timeline.js +1 -1
  20. package/es/Player/segment_player.js +1 -1
  21. package/es/Player/single_player.js +2 -2
  22. package/es/ScreenPlayer/Live.d.ts +6 -1
  23. package/es/ScreenPlayer/Live.js +8 -6
  24. package/es/ScreenPlayer/LiveTools.d.ts +1 -1
  25. package/es/ScreenPlayer/LiveTools.js +6 -7
  26. package/es/ScreenPlayer/PlayerWithExt.js +33 -19
  27. package/es/ScreenPlayer/Record.js +3 -3
  28. package/es/ScreenPlayer/RecordTools.js +3 -4
  29. package/es/ScreenPlayer/SegmentTimeLine.d.ts +2 -2
  30. package/es/ScreenPlayer/SegmentTimeLine.js +17 -36
  31. package/es/ScreenPlayer/TimeSlider.d.ts +2 -2
  32. package/es/ScreenPlayer/TimeSlider.js +21 -17
  33. package/es/ScreenPlayer/demo.js +3 -3
  34. package/es/ScreenPlayer/index.css +1 -0
  35. package/es/ScreenPlayer/useTimeSlider.d.ts +22 -0
  36. package/es/ScreenPlayer/useTimeSlider.js +519 -0
  37. package/es/Tree/index.js +24 -21
  38. package/es/index.d.ts +1 -0
  39. package/es/index.js +1 -0
  40. package/es/useFullscreen/index.d.ts +12 -0
  41. package/es/useFullscreen/index.js +95 -0
  42. package/es/utils.js +1 -1
  43. package/package.json +3 -2
  44. package/es/List/renderItem.d.ts +0 -20
  45. package/es/List/renderItem.js +0 -71
@@ -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, { useEffect, useRef } from 'react';
7
- import TimeSlider from './TimeSlider';
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
- timeCell = _ref.timeCell,
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
- useEffect(function () {
26
- var time = begin !== null && begin !== void 0 ? begin : moment().set({
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
- timeSliderRef.current = new TimeSlider(ref.current, {
32
- onTimeChange: run,
33
- start_timestamp: time - timeMode / 2 * 3600 * 1000,
34
- current_timestamp: time,
35
- timecell: timeCell,
36
- hours_per_ruler: timeMode,
37
- onHoursPerChange: function onHoursPerChange(hour) {
38
- return updateState({
39
- timeMode: hour
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", {
@@ -91,11 +91,11 @@ export default class TimeSlider {
91
91
  */
92
92
  mousemoveFunc2: (e: MouseEvent) => void;
93
93
  /**
94
- * 拖动/点击 mouseup事件
94
+ * 点击 mouseup事件
95
95
  */
96
96
  mouseupFunc: (e: MouseEvent) => void;
97
97
  /**
98
- * 拖动/点击 mouseup事件
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
- document.addEventListener('mouseup', _this.mouseupFunc2);
51
+ document.addEventListener('mousemove', _this.mousemoveFunc); //拖动
52
+
53
+ document.addEventListener('mouseup', _this.mouseupFunc2); //停止拖动
53
54
  };
54
55
  /**
55
56
  * 鼠标移出隐藏时间 mouseout事件
@@ -112,16 +113,14 @@ var TimeSlider = /*#__PURE__*/function () {
112
113
  }
113
114
  };
114
115
  /**
115
- * 拖动/点击 mouseup事件
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
+ var _a, _b;
122
+
123
+ if (!_this.g_isMousemove) {
125
124
  // click 事件
126
125
  _this.g_isMousedown = false;
127
126
 
@@ -142,13 +141,11 @@ var TimeSlider = /*#__PURE__*/function () {
142
141
 
143
142
  _this.set_time_to_middle(_this.current_timestamp);
144
143
 
145
- _this.options.onTimeChange && _this.options.onTimeChange(current_timestamp, outTimeline);
144
+ (_b = (_a = _this.options).onTimeChange) === null || _b === void 0 ? void 0 : _b.call(_a, current_timestamp, outTimeline);
146
145
  }
147
-
148
- document.removeEventListener('mousemove', _this.mousemoveFunc);
149
146
  };
150
147
  /**
151
- * 拖动/点击 mouseup事件
148
+ * 拖动停止 mouseup事件
152
149
  */
153
150
 
154
151
 
@@ -204,7 +201,9 @@ var TimeSlider = /*#__PURE__*/function () {
204
201
  }
205
202
 
206
203
  _nextTick(function () {
207
- return _this.options.onHoursPerChange && _this.options.onHoursPerChange(_this.hours_per_ruler);
204
+ var _a, _b;
205
+
206
+ return (_b = (_a = _this.options).onHoursPerChange) === null || _b === void 0 ? void 0 : _b.call(_a, _this.hours_per_ruler);
208
207
  });
209
208
 
210
209
  _this.clearCanvas();
@@ -466,10 +465,14 @@ var TimeSlider = /*#__PURE__*/function () {
466
465
  }, {
467
466
  key: "add_events",
468
467
  value: function add_events() {
469
- this.canvas.addEventListener('mousewheel', this.mousewheelFunc);
470
- this.canvas.addEventListener('mousedown', this.mousedownFunc);
471
- this.canvas.addEventListener('mousemove', this.mousemoveFunc2);
472
- this.canvas.addEventListener('mouseup', this.mouseupFunc);
468
+ this.canvas.addEventListener('mousewheel', this.mousewheelFunc); // 调整刻度范围
469
+
470
+ this.canvas.addEventListener('mousedown', this.mousedownFunc); // 触发 拖动或者点击标记
471
+
472
+ this.canvas.addEventListener('mousemove', this.mousemoveFunc2); //hover 提示当前刻度时间
473
+
474
+ this.canvas.addEventListener('mouseup', this.mouseupFunc); // 点击触发
475
+
473
476
  this.canvas.addEventListener('mouseout', this.mouseoutFunc);
474
477
  }
475
478
  }, {
@@ -484,6 +487,7 @@ var TimeSlider = /*#__PURE__*/function () {
484
487
  }, {
485
488
  key: "destory",
486
489
  value: function destory() {
490
+ this.clearCanvas();
487
491
  this.remove_events();
488
492
  this.canvas = null;
489
493
  this.options = null;
@@ -3,16 +3,16 @@ import _ConfigProvider from "antd/lib/config-provider";
3
3
  import React from 'react';
4
4
  import LivePlayer from './Live';
5
5
  var list = [{
6
- url: 'https://6a75ef90-3-server.antelopecloud.cn/flv_live?app=live&token=542446023_3356491776_1693469173_b34efba891f35a66b227642f66272534',
6
+ url: 'https://6a75ef90-3-server.antelopecloud.cn/flv_live?app=live&token=542446023_3356491776_1693558509_61374ba6efe326a4cb8b6bae86917a25',
7
7
  type: 'flv'
8
8
  }, {
9
- url: 'https://6a75ef90-3-server.antelopecloud.cn/flv_live?app=live&token=542446023_3356491776_1693469173_b34efba891f35a66b227642f66272534',
9
+ url: 'https://6a75ef89-1-server.antelopecloud.cn/flv_live?app=live&token=542446501_3356491776_1693535295_37062417b87df4be7dd5c02b01d87248',
10
10
  type: 'flv'
11
11
  }, {
12
12
  url: 'https://6a75ef90-1-server.antelopecloud.cn/flv_live?app=live&token=542453821_3356491776_1693535323_3a90f54c141b9a246d5679678ebafe90',
13
13
  type: 'flv'
14
14
  }, {
15
- url: 'https://6a75ef88-6-server.antelopecloud.cn/flv_live?app=live&token=542449206_3356491776_1693535342_803846974f04eb02e8115d10432d062f',
15
+ url: 'https://6a75ef90-6-server.antelopecloud.cn/flv_live?app=live&token=542449206_3356491776_1693535342_803846974f04eb02e8115d10432d062f',
16
16
  type: 'flv'
17
17
  }];
18
18
  export default function App() {
@@ -42,6 +42,7 @@
42
42
  display: flex;
43
43
  align-items: center;
44
44
  justify-content: space-between;
45
+ position: relative;
45
46
  }
46
47
  .split-screen-player-wrapper .player-tools .player-tools-left,
47
48
  .split-screen-player-wrapper .player-tools .player-tools-right {
@@ -0,0 +1,22 @@
1
+ /// <reference types="react" />
2
+ import type { ISegmentType } from '../Player/player';
3
+ export interface ITimeSliderOptions {
4
+ hoursPer?: number;
5
+ begin?: number;
6
+ segments?: TimeCellItem[];
7
+ currentTime?: number;
8
+ onTimeChange?: (time: number, outTimeline?: boolean) => void;
9
+ onHoursPerChange?: (hour: number) => void;
10
+ }
11
+ export declare type ITimeSliderState = {
12
+ hoursPer: number;
13
+ begin: number;
14
+ currentTime: number;
15
+ hover: {
16
+ x: number;
17
+ time: number;
18
+ };
19
+ };
20
+ export declare type TimeCellItem = ISegmentType;
21
+ declare function useTimeSlider(canvasRef: React.MutableRefObject<HTMLCanvasElement>, { hoursPer, begin, currentTime, segments, onTimeChange, onHoursPerChange }: ITimeSliderOptions): void;
22
+ export default useTimeSlider;