@cloud-app-dev/vidc 3.2.16 → 3.2.18

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 (271) hide show
  1. package/.prettierrc.js +1 -1
  2. package/.stylelintrc.js +113 -0
  3. package/es/AppContext/index.js +3 -4
  4. package/es/Box/InfoBox/index.less +8 -6
  5. package/es/Box/TwoColumnBox/index.less +32 -22
  6. package/es/Box/index.less +1 -1
  7. package/es/CheckGroupFixed/index.less +17 -14
  8. package/es/CustomRenderSelect/index.less +7 -7
  9. package/es/DisableMark/index.less +3 -3
  10. package/es/DomMove/index.js +5 -5
  11. package/es/Drag/DragAndDropItem.js +1 -2
  12. package/es/Drag/DropItem.js +2 -2
  13. package/es/Drag/index.d.ts +9 -7
  14. package/es/Drawer/index.js +19 -20
  15. package/es/Drawer/index.less +8 -8
  16. package/es/Drawer/interface.d.ts +4 -3
  17. package/es/DynamicGridList/Demo.js +1 -1
  18. package/es/DynamicList/index.less +2 -0
  19. package/es/FullScreen/index.less +6 -4
  20. package/es/GridList/Demo.js +2 -2
  21. package/es/GridList/index.js +2 -1
  22. package/es/GridList/index.less +1 -1
  23. package/es/ImageView/index.less +2 -1
  24. package/es/Input/index.less +1 -1
  25. package/es/LabelValue/index.less +5 -2
  26. package/es/List/index.less +2 -2
  27. package/es/ListWithSizeAnimate/demo.js +0 -1
  28. package/es/ListWithSizeAnimate/index.js +18 -28
  29. package/es/ListWithSizeAnimate/index.less +10 -6
  30. package/es/Map/BasicMap/index.less +8 -3
  31. package/es/Map/ClusterLayer/index.less +8 -6
  32. package/es/Map/FindPio/index.less +2 -2
  33. package/es/Map/LevelCenter/index.js +3 -4
  34. package/es/Map/MapDrawSelect/index.js +2 -3
  35. package/es/Map/ResetTools/index.less +10 -6
  36. package/es/Map/SinglePoint/index.less +3 -3
  37. package/es/Map/useMarker/index.js +1 -1
  38. package/es/Modal/index.js +17 -17
  39. package/es/Modal/index.less +10 -11
  40. package/es/Picture/component/DefaultRects/index.js +3 -1
  41. package/es/Picture/component/DefaultRects/index.less +51 -28
  42. package/es/Picture/component/DrawRect/index.js +3 -1
  43. package/es/Picture/component/DrawRect/index.less +2 -2
  44. package/es/Picture/component/RectMenu/index.less +11 -6
  45. package/es/Picture/component/Tools/index.js +1 -1
  46. package/es/Picture/component/Tools/index.less +12 -6
  47. package/es/Picture/index.js +50 -26
  48. package/es/Picture/index.less +3 -2
  49. package/es/Picture/useDraw.js +1 -1
  50. package/es/Picture/utils.js +35 -34
  51. package/es/Player/api/index.js +67 -35
  52. package/es/Player/contraller_bar/contraller_event.js +4 -4
  53. package/es/Player/contraller_bar/left_bar.js +12 -10
  54. package/es/Player/empty.js +6 -0
  55. package/es/Player/event/errorEvent.js +7 -8
  56. package/es/Player/event/index.js +1 -1
  57. package/es/Player/fps_play.js +10 -8
  58. package/es/Player/frontend_player.js +13 -10
  59. package/es/Player/frontend_timeline.js +41 -41
  60. package/es/Player/live_heart.js +15 -5
  61. package/es/Player/message.js +5 -5
  62. package/es/Player/segment_player.js +31 -24
  63. package/es/Player/segment_timeline.js +71 -71
  64. package/es/Player/single_player.js +17 -21
  65. package/es/Player/style/bar.less +13 -9
  66. package/es/Player/style/index.less +8 -4
  67. package/es/Player/style/message.less +22 -16
  68. package/es/Player/style/slider.less +40 -37
  69. package/es/Player/style/timeline.less +43 -33
  70. package/es/Player/style/volume.less +7 -4
  71. package/es/Player/timeline.js +16 -8
  72. package/es/Player/util.js +82 -58
  73. package/es/PlayerExt/index.less +2 -2
  74. package/es/Progress/index.d.ts +8 -11
  75. package/es/Progress/index.less +5 -4
  76. package/es/ROI/index.less +8 -4
  77. package/es/ScreenPlayer/index.less +49 -26
  78. package/es/TableLayout/index.less +1 -1
  79. package/es/ThemeAntd/demo.less +4 -3
  80. package/es/ThemeAntd/index.less +12 -12
  81. package/es/ThemeAntd/style/button.less +4 -4
  82. package/es/ThemeAntd/style/checkbox.less +3 -3
  83. package/es/ThemeAntd/style/input.less +7 -7
  84. package/es/ThemeAntd/style/pagination.less +4 -4
  85. package/es/ThemeAntd/style/picker.less +5 -5
  86. package/es/ThemeAntd/style/radio.less +2 -2
  87. package/es/ThemeAntd/style/scrollbar.less +5 -3
  88. package/es/ThemeAntd/style/select.less +8 -8
  89. package/es/ThemeAntd/style/table.less +4 -4
  90. package/es/Tree/index.less +13 -12
  91. package/es/VList/index.d.ts +12 -18
  92. package/es/useSimpleState/index.js +1 -1
  93. package/package.json +12 -6
  94. package/tsconfig.json +12 -0
  95. package/es/Api/index.d.ts +0 -12
  96. package/es/AppContext/Sync.d.ts +0 -8
  97. package/es/AppContext/index.d.ts +0 -10
  98. package/es/AppContext/static.d.ts +0 -8
  99. package/es/Auth/index.d.ts +0 -8
  100. package/es/AutoExit/index.d.ts +0 -6
  101. package/es/Box/BetweenBox/index.d.ts +0 -12
  102. package/es/Box/InfoBox/index.d.ts +0 -12
  103. package/es/Box/TwoColumnBox/index.d.ts +0 -10
  104. package/es/Box/deps/content-grid.d.ts +0 -9
  105. package/es/Box/deps/grid-factory.d.ts +0 -10
  106. package/es/Box/deps/simple-grid.d.ts +0 -9
  107. package/es/Box/index.d.ts +0 -14
  108. package/es/CheckGroupFixed/demo.d.ts +0 -3
  109. package/es/CheckGroupFixed/index.d.ts +0 -18
  110. package/es/Config/index.d.ts +0 -4
  111. package/es/Config/utils.d.ts +0 -4
  112. package/es/ConfigContext/index.d.ts +0 -22
  113. package/es/CustomRenderSelect/index.d.ts +0 -12
  114. package/es/DisableMark/index.d.ts +0 -9
  115. package/es/DomMove/demo.d.ts +0 -2
  116. package/es/DomMove/index.d.ts +0 -16
  117. package/es/DomMove/utils.d.ts +0 -8
  118. package/es/Drag/DragAndDropItem.d.ts +0 -4
  119. package/es/Drag/DropItem.d.ts +0 -4
  120. package/es/Drag/index.less +0 -0
  121. package/es/Drawer/Footer.d.ts +0 -5
  122. package/es/Drawer/demo.d.ts +0 -3
  123. package/es/Drawer/index.d.ts +0 -38
  124. package/es/DynamicGridList/Demo.d.ts +0 -3
  125. package/es/DynamicGridList/index.d.ts +0 -27
  126. package/es/DynamicList/demo.d.ts +0 -2
  127. package/es/DynamicList/index.d.ts +0 -31
  128. package/es/DynamicList/utils.d.ts +0 -4
  129. package/es/ErrorFallback/index.d.ts +0 -9
  130. package/es/FrontendPlayer/index.d.ts +0 -2
  131. package/es/FullScreen/index.d.ts +0 -22
  132. package/es/GridList/Demo.d.ts +0 -3
  133. package/es/GridList/data.d.ts +0 -16
  134. package/es/GridList/hook.d.ts +0 -13
  135. package/es/GridList/index.d.ts +0 -15
  136. package/es/GridList/utils.d.ts +0 -9
  137. package/es/HightLevel/index.d.ts +0 -9
  138. package/es/IconFont/index.d.ts +0 -12
  139. package/es/ImageView/index.d.ts +0 -17
  140. package/es/Input/demo.d.ts +0 -3
  141. package/es/Input/index.d.ts +0 -19
  142. package/es/InstanceHistory/index.d.ts +0 -3
  143. package/es/LabelValue/index.d.ts +0 -23
  144. package/es/List/demo.d.ts +0 -3
  145. package/es/List/index.d.ts +0 -41
  146. package/es/ListWithSizeAnimate/demo.d.ts +0 -2
  147. package/es/ListWithSizeAnimate/index.d.ts +0 -15
  148. package/es/LoaderApp/index.d.ts +0 -31
  149. package/es/LoaderApp/loader.d.ts +0 -19
  150. package/es/LoaderApp/sandbox.back.d.ts +0 -18
  151. package/es/LoaderApp/sandbox.d.ts +0 -12
  152. package/es/LoaderApp/utils.d.ts +0 -19
  153. package/es/LoaderScript/index.d.ts +0 -26
  154. package/es/LoaderScript/utils.d.ts +0 -14
  155. package/es/Map/BasicMap/AMapInstance.d.ts +0 -19
  156. package/es/Map/BasicMap/LeafletInstance.d.ts +0 -18
  157. package/es/Map/BasicMap/index.d.ts +0 -9
  158. package/es/Map/ClusterLayer/hook.d.ts +0 -5
  159. package/es/Map/ClusterLayer/index.d.ts +0 -6
  160. package/es/Map/Config/index.d.ts +0 -7
  161. package/es/Map/Config/utils.d.ts +0 -2
  162. package/es/Map/Context/index.d.ts +0 -11
  163. package/es/Map/FindPio/index.d.ts +0 -4
  164. package/es/Map/InfoWindow/MakerLikeWindow.d.ts +0 -4
  165. package/es/Map/InfoWindow/demo.d.ts +0 -3
  166. package/es/Map/InfoWindow/index.d.ts +0 -10
  167. package/es/Map/LevelCenter/DragMarker/index.d.ts +0 -10
  168. package/es/Map/LevelCenter/demo.d.ts +0 -3
  169. package/es/Map/LevelCenter/index.d.ts +0 -16
  170. package/es/Map/LevelCenter/index.less +0 -2
  171. package/es/Map/LoaderMap/index.d.ts +0 -12
  172. package/es/Map/MapDrawSelect/demo.d.ts +0 -3
  173. package/es/Map/MapDrawSelect/index.d.ts +0 -16
  174. package/es/Map/MapDrawSelect/index.less +0 -2
  175. package/es/Map/MouseTool/index.d.ts +0 -10
  176. package/es/Map/MouseTool/useMouseTools.d.ts +0 -7
  177. package/es/Map/ResetTools/index.d.ts +0 -10
  178. package/es/Map/SinglePoint/index.d.ts +0 -27
  179. package/es/Map/hook/useMapEvent.d.ts +0 -2
  180. package/es/Map/hook/useMapType.d.ts +0 -4
  181. package/es/Map/icon.d.ts +0 -2
  182. package/es/Map/index.d.ts +0 -24
  183. package/es/Map/useMarker/index.d.ts +0 -11
  184. package/es/Map/useMarker/index.less +0 -0
  185. package/es/Map/withMap/index.d.ts +0 -3
  186. package/es/Modal/demo.d.ts +0 -3
  187. package/es/Modal/index.d.ts +0 -44
  188. package/es/Picture/component/DefaultRects/RectInfo.d.ts +0 -8
  189. package/es/Picture/component/DefaultRects/index.d.ts +0 -13
  190. package/es/Picture/component/DefaultRects/utils.d.ts +0 -2
  191. package/es/Picture/component/DrawRect/index.d.ts +0 -13
  192. package/es/Picture/component/RectMenu/index.d.ts +0 -12
  193. package/es/Picture/component/RectMenu/utils.d.ts +0 -12
  194. package/es/Picture/component/Tools/index.d.ts +0 -13
  195. package/es/Picture/component/WheelScale/index.d.ts +0 -7
  196. package/es/Picture/demo.d.ts +0 -2
  197. package/es/Picture/dragBound.d.ts +0 -5
  198. package/es/Picture/index.d.ts +0 -19
  199. package/es/Picture/loadCaptureRectImage.d.ts +0 -8
  200. package/es/Picture/useDraw.d.ts +0 -1
  201. package/es/Picture/utils.d.ts +0 -21
  202. package/es/Player/api/index.d.ts +0 -68
  203. package/es/Player/context.d.ts +0 -21
  204. package/es/Player/contraller_bar/bar.d.ts +0 -8
  205. package/es/Player/contraller_bar/contraller_event.d.ts +0 -6
  206. package/es/Player/contraller_bar/index.d.ts +0 -14
  207. package/es/Player/contraller_bar/left_bar.d.ts +0 -10
  208. package/es/Player/contraller_bar/right_bar.d.ts +0 -8
  209. package/es/Player/contraller_bar/time.d.ts +0 -3
  210. package/es/Player/contraller_bar/useBarStatus.d.ts +0 -2
  211. package/es/Player/contraller_bar/volume.d.ts +0 -9
  212. package/es/Player/demo.d.ts +0 -3
  213. package/es/Player/event/errorEvent.d.ts +0 -16
  214. package/es/Player/event/eventName.d.ts +0 -18
  215. package/es/Player/event/index.d.ts +0 -24
  216. package/es/Player/fps_play.d.ts +0 -11
  217. package/es/Player/frontend_player.d.ts +0 -8
  218. package/es/Player/frontend_timeline.d.ts +0 -10
  219. package/es/Player/iconfont.d.ts +0 -5
  220. package/es/Player/index.d.ts +0 -2
  221. package/es/Player/live_heart.d.ts +0 -8
  222. package/es/Player/message.d.ts +0 -5
  223. package/es/Player/segment_player.d.ts +0 -9
  224. package/es/Player/segment_timeline.d.ts +0 -12
  225. package/es/Player/single_player.d.ts +0 -5
  226. package/es/Player/timeline.d.ts +0 -5
  227. package/es/Player/util.d.ts +0 -28
  228. package/es/PlayerExt/demo.d.ts +0 -3
  229. package/es/PlayerExt/index.d.ts +0 -48
  230. package/es/ROI/demo.d.ts +0 -3
  231. package/es/ROI/index.d.ts +0 -39
  232. package/es/ROI/utils.d.ts +0 -1
  233. package/es/ScreenPlayer/Live.d.ts +0 -10
  234. package/es/ScreenPlayer/LiveTools.d.ts +0 -29
  235. package/es/ScreenPlayer/PlayerWithExt.d.ts +0 -34
  236. package/es/ScreenPlayer/RatePick.d.ts +0 -7
  237. package/es/ScreenPlayer/Record.d.ts +0 -10
  238. package/es/ScreenPlayer/RecordTools.d.ts +0 -37
  239. package/es/ScreenPlayer/ScreenSelect.d.ts +0 -7
  240. package/es/ScreenPlayer/SegmentTimeLine.d.ts +0 -17
  241. package/es/ScreenPlayer/TimeMode.d.ts +0 -7
  242. package/es/ScreenPlayer/TimeSelect.d.ts +0 -7
  243. package/es/ScreenPlayer/demo.d.ts +0 -2
  244. package/es/ScreenPlayer/demo2.d.ts +0 -2
  245. package/es/ScreenPlayer/index.d.ts +0 -6
  246. package/es/ScreenPlayer/useTimeSlider.d.ts +0 -25
  247. package/es/ScreenPlayer/useVideoFit.d.ts +0 -5
  248. package/es/ScreenPlayer/utils.d.ts +0 -19
  249. package/es/SegmentPlayer/index.d.ts +0 -2
  250. package/es/Service/fetch-adapter.d.ts +0 -12
  251. package/es/Service/http.d.ts +0 -6
  252. package/es/Service/index.d.ts +0 -3
  253. package/es/Service/middleware.d.ts +0 -5
  254. package/es/TableLayout/index.d.ts +0 -13
  255. package/es/ThemeAntd/demo.d.ts +0 -4
  256. package/es/ThemeAntd/index.d.ts +0 -7
  257. package/es/Timeout/index.d.ts +0 -32
  258. package/es/Tree/demo.d.ts +0 -3
  259. package/es/Tree/index.d.ts +0 -24
  260. package/es/VList/utils.d.ts +0 -14
  261. package/es/index.d.ts +0 -52
  262. package/es/useDrawROI/index.d.ts +0 -16
  263. package/es/useEventEmitterHandle/index.d.ts +0 -2
  264. package/es/useFullscreen/demo.d.ts +0 -2
  265. package/es/useFullscreen/index.d.ts +0 -12
  266. package/es/useHistory/index.d.ts +0 -3
  267. package/es/useInfiniteScroll/index.d.ts +0 -16
  268. package/es/useRafInterval/index.d.ts +0 -5
  269. package/es/useSimpleState/index.d.ts +0 -3
  270. package/es/useVirtualList/index.d.ts +0 -13
  271. package/es/utils.d.ts +0 -25
@@ -33,36 +33,52 @@ var Api = /*#__PURE__*/function () {
33
33
 
34
34
  _defineProperty(this, "play", function () {
35
35
  tryCatch(function () {
36
- return _this.video.play();
36
+ var _this$video;
37
+
38
+ return (_this$video = _this.video) === null || _this$video === void 0 ? void 0 : _this$video.play();
37
39
  });
38
40
  });
39
41
 
40
42
  _defineProperty(this, "pause", function () {
41
- _this.video.pause();
43
+ var _this$video2;
44
+
45
+ (_this$video2 = _this.video) === null || _this$video2 === void 0 ? void 0 : _this$video2.pause();
42
46
  });
43
47
 
44
48
  _defineProperty(this, "seekTo", function (seconds) {
45
- _this.video.currentTime = seconds;
49
+ if (_this.video) {
50
+ _this.video.currentTime = seconds;
51
+ }
46
52
  });
47
53
 
48
54
  _defineProperty(this, "setVolume", function (fraction) {
49
- _this.video.volume = fraction;
55
+ if (_this.video) {
56
+ _this.video.volume = fraction;
57
+ }
50
58
  });
51
59
 
52
60
  _defineProperty(this, "getVolume", function () {
53
- return _this.video.volume;
61
+ var _this$video3;
62
+
63
+ return (_this$video3 = _this.video) === null || _this$video3 === void 0 ? void 0 : _this$video3.volume;
54
64
  });
55
65
 
56
66
  _defineProperty(this, "mute", function () {
57
- _this.video.muted = true;
67
+ if (_this.video) {
68
+ _this.video.muted = true;
69
+ }
58
70
  });
59
71
 
60
72
  _defineProperty(this, "unmute", function () {
61
- _this.video.muted = false;
73
+ if (_this.video) {
74
+ _this.video.muted = false;
75
+ }
62
76
  });
63
77
 
64
78
  _defineProperty(this, "requestPictureInPicture", function () {
65
- _this.video.requestPictureInPicture();
79
+ var _this$video4;
80
+
81
+ (_this$video4 = _this.video) === null || _this$video4 === void 0 ? void 0 : _this$video4.requestPictureInPicture();
66
82
  });
67
83
 
68
84
  _defineProperty(this, "exitPictureInPicture", function () {
@@ -72,15 +88,17 @@ var Api = /*#__PURE__*/function () {
72
88
  });
73
89
 
74
90
  _defineProperty(this, "setPlaybackRate", function (rate) {
75
- _this.video.playbackRate = rate;
91
+ if (_this.video) {
92
+ _this.video.playbackRate = rate;
93
+ }
76
94
  });
77
95
 
78
96
  _defineProperty(this, "getDuration", function () {
79
- var _this$video = _this.video,
80
- duration = _this$video.duration,
81
- seekable = _this$video.seekable;
97
+ var _ref = _this.video || {},
98
+ duration = _ref.duration,
99
+ seekable = _ref.seekable;
82
100
 
83
- if (duration === Infinity && seekable.length > 0) {
101
+ if (duration === Infinity && seekable && seekable.length > 0) {
84
102
  return seekable.end(seekable.length - 1);
85
103
  }
86
104
 
@@ -88,7 +106,9 @@ var Api = /*#__PURE__*/function () {
88
106
  });
89
107
 
90
108
  _defineProperty(this, "getCurrentTime", function () {
91
- return _this.video.currentTime;
109
+ var _this$video5;
110
+
111
+ return (_this$video5 = _this.video) === null || _this$video5 === void 0 ? void 0 : _this$video5.currentTime;
92
112
  });
93
113
 
94
114
  _defineProperty(this, "getSecondsLoaded", function () {
@@ -96,30 +116,34 @@ var Api = /*#__PURE__*/function () {
96
116
  });
97
117
 
98
118
  _defineProperty(this, "getBufferedTime", function () {
99
- var buffered = _this.video.buffered;
119
+ var _buffered$end, _buffered$start, _this$getDuration;
120
+
121
+ var _ref2 = _this.video || {},
122
+ buffered = _ref2.buffered;
100
123
 
101
- if (buffered.length === 0) {
124
+ if (buffered && buffered.length === 0) {
102
125
  return [0, 0];
103
126
  }
104
127
 
105
- var end = buffered.end(buffered.length - 1);
106
- var start = buffered.start(buffered.length - 1);
107
-
108
- var duration = _this.getDuration();
128
+ var end = (_buffered$end = buffered === null || buffered === void 0 ? void 0 : buffered.end(buffered.length - 1)) !== null && _buffered$end !== void 0 ? _buffered$end : 0;
129
+ var start = (_buffered$start = buffered === null || buffered === void 0 ? void 0 : buffered.start(buffered.length - 1)) !== null && _buffered$start !== void 0 ? _buffered$start : 0;
130
+ var duration = (_this$getDuration = _this.getDuration()) !== null && _this$getDuration !== void 0 ? _this$getDuration : 0;
109
131
 
110
132
  if (end > duration) {
111
- return duration;
133
+ return [start, duration];
112
134
  }
113
135
 
114
136
  return [start, end];
115
137
  });
116
138
 
117
139
  _defineProperty(this, "snapshot", function () {
140
+ var _this$video$videoWidt, _this$video6, _this$video$videoHeig, _this$video7, _ctx;
141
+
118
142
  var canvas = document.createElement('canvas');
119
143
  var ctx = canvas.getContext('2d');
120
- canvas.width = _this.video.videoWidth;
121
- canvas.height = _this.video.videoHeight;
122
- ctx.drawImage(_this.video, 0, 0, canvas.width, canvas.height);
144
+ canvas.width = (_this$video$videoWidt = (_this$video6 = _this.video) === null || _this$video6 === void 0 ? void 0 : _this$video6.videoWidth) !== null && _this$video$videoWidt !== void 0 ? _this$video$videoWidt : 0;
145
+ canvas.height = (_this$video$videoHeig = (_this$video7 = _this.video) === null || _this$video7 === void 0 ? void 0 : _this$video7.videoHeight) !== null && _this$video$videoHeig !== void 0 ? _this$video$videoHeig : 0;
146
+ (_ctx = ctx) === null || _ctx === void 0 ? void 0 : _ctx.drawImage(_this.video, 0, 0, canvas.width, canvas.height);
123
147
  setTimeout(function () {
124
148
  canvas.remove();
125
149
  canvas = null;
@@ -153,12 +177,16 @@ var Api = /*#__PURE__*/function () {
153
177
  }, {
154
178
  key: "paused",
155
179
  get: function get() {
156
- return this.video.paused;
180
+ var _this$video8;
181
+
182
+ return (_this$video8 = this.video) === null || _this$video8 === void 0 ? void 0 : _this$video8.paused;
157
183
  }
158
184
  }, {
159
185
  key: "muted",
160
186
  get: function get() {
161
- return this.video.muted;
187
+ var _this$video9;
188
+
189
+ return (_this$video9 = this.video) === null || _this$video9 === void 0 ? void 0 : _this$video9.muted;
162
190
  }
163
191
  /**
164
192
  * 设置currentTime实现seek
@@ -204,28 +232,32 @@ export function useTypeAndPlay(url, type, isLive, container, segments, flvConfig
204
232
 
205
233
  default:
206
234
  options.type = 'native';
207
- video.setAttribute('src', url);
235
+ video === null || video === void 0 ? void 0 : video.setAttribute('src', url !== null && url !== void 0 ? url : '');
208
236
  break;
209
237
  }
210
238
 
211
- video.paused && tryCatch(function () {
212
- return video.play();
239
+ (video === null || video === void 0 ? void 0 : video.paused) && tryCatch(function () {
240
+ return video === null || video === void 0 ? void 0 : video.play();
213
241
  });
214
242
  setState(options);
215
243
  return function () {
216
244
  if (options.flv) {
217
245
  options.flv.pause();
218
246
  tryCatch(function () {
219
- return options.flv.destroy();
247
+ var _options$flv;
248
+
249
+ return (_options$flv = options.flv) === null || _options$flv === void 0 ? void 0 : _options$flv.destroy();
220
250
  });
221
251
  } else if (options.hls) {
222
- video.pause();
252
+ video === null || video === void 0 ? void 0 : video.pause();
223
253
  tryCatch(function () {
224
- return options.hls.destroy();
254
+ var _options$hls;
255
+
256
+ return (_options$hls = options.hls) === null || _options$hls === void 0 ? void 0 : _options$hls.destroy();
225
257
  });
226
258
  } else {
227
- video.pause();
228
- video.removeAttribute('src');
259
+ video === null || video === void 0 ? void 0 : video.pause();
260
+ video === null || video === void 0 ? void 0 : video.removeAttribute('src');
229
261
  }
230
262
 
231
263
  setState({});
@@ -235,7 +267,7 @@ export function useTypeAndPlay(url, type, isLive, container, segments, flvConfig
235
267
  } //创建Api
236
268
 
237
269
  export function usePlayerApi(url, type, isLive, container, segments, flvConfig, hlsConfig) {
238
- var _useState3 = useState(null),
270
+ var _useState3 = useState(undefined),
239
271
  _useState4 = _slicedToArray(_useState3, 2),
240
272
  api = _useState4[0],
241
273
  setApi = _useState4[1];
@@ -13,7 +13,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
13
13
 
14
14
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
15
15
 
16
- import React, { useState, useRef, useContext } from 'react';
16
+ import React, { useContext, useRef, useState } from 'react';
17
17
  import { Context } from "../context";
18
18
  import EventName from "../event/eventName";
19
19
  import { Fragment as _Fragment } from "react/jsx-runtime";
@@ -26,7 +26,7 @@ function ContrallerEvent(_ref) {
26
26
  event = _useContext.event,
27
27
  container = _useContext.container;
28
28
 
29
- var timer = useRef(null);
29
+ var timer = useRef();
30
30
 
31
31
  var _useState = useState(true),
32
32
  _useState2 = _slicedToArray(_useState, 2),
@@ -36,14 +36,14 @@ function ContrallerEvent(_ref) {
36
36
  var showContraller = function showContraller() {
37
37
  clearTimeout(timer.current);
38
38
  setVisibel(true);
39
- event.emit(EventName.SHOW_CONTRALLER);
39
+ event === null || event === void 0 ? void 0 : event.emit(EventName.SHOW_CONTRALLER);
40
40
  };
41
41
 
42
42
  var hideContraller = function hideContraller() {
43
43
  clearTimeout(timer.current);
44
44
  timer.current = setTimeout(function () {
45
45
  setVisibel(false);
46
- event.emit(EventName.HIDE_CONTRALLER);
46
+ event === null || event === void 0 ? void 0 : event.emit(EventName.HIDE_CONTRALLER);
47
47
  }, 3 * 1000);
48
48
  };
49
49
 
@@ -10,13 +10,13 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
10
10
 
11
11
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
12
 
13
- import React, { useState, useCallback, useMemo, useContext } from 'react';
14
- import IconFont from "../iconfont";
15
- import Bar from "./bar";
13
+ import React, { useCallback, useContext, useMemo, useState } from 'react';
16
14
  import { Context } from "../context";
17
15
  import { useVideoEvent } from "../event";
18
- import Volume from "./volume";
16
+ import IconFont from "../iconfont";
17
+ import Bar from "./bar";
19
18
  import Time from "./time";
19
+ import Volume from "./volume";
20
20
  import { jsx as _jsx } from "react/jsx-runtime";
21
21
  import { jsxs as _jsxs } from "react/jsx-runtime";
22
22
 
@@ -45,7 +45,7 @@ function LeftBar(_ref) {
45
45
  useVideoEvent('play', updateRender);
46
46
  useVideoEvent('pause', updateRender);
47
47
  useVideoEvent('volumechange', updateRender);
48
- var video = container.querySelector('video'); //缓存值
48
+ var video = container === null || container === void 0 ? void 0 : container.querySelector('video'); //缓存值
49
49
  // eslint-disable-next-line react-hooks/exhaustive-deps
50
50
 
51
51
  var paused = useMemo(function () {
@@ -60,11 +60,13 @@ function LeftBar(_ref) {
60
60
 
61
61
  var changePlayStatus = useCallback(function () {
62
62
  if (video !== null && video !== void 0 && video.paused) {
63
- var buffered = api.getSecondsLoaded();
64
- api.seekTo(buffered - 1);
65
- api.play();
63
+ var _api$getSecondsLoaded;
64
+
65
+ var buffered = (_api$getSecondsLoaded = api === null || api === void 0 ? void 0 : api.getSecondsLoaded()) !== null && _api$getSecondsLoaded !== void 0 ? _api$getSecondsLoaded : 1;
66
+ api === null || api === void 0 ? void 0 : api.seekTo(buffered - 1);
67
+ api === null || api === void 0 ? void 0 : api.play();
66
68
  } else {
67
- api.pause();
69
+ api === null || api === void 0 ? void 0 : api.pause();
68
70
  }
69
71
  }, [video, api]);
70
72
  return /*#__PURE__*/_jsxs("div", {
@@ -87,7 +89,7 @@ function LeftBar(_ref) {
87
89
  })
88
90
  }), !isLive && oneFpsPlay && /*#__PURE__*/_jsx(Bar, {
89
91
  children: /*#__PURE__*/_jsx(IconFont, {
90
- onClick: isFpsPlay ? api.closeFpsPlay : api.openFpsPlay,
92
+ onClick: isFpsPlay ? api === null || api === void 0 ? void 0 : api.closeFpsPlay : api === null || api === void 0 ? void 0 : api.openFpsPlay,
91
93
  type: "lm-player-zhuzhenplay",
92
94
  title: "\u9010\u5E27\u64AD\u653E"
93
95
  })
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ export default function Empty() {
5
+ return /*#__PURE__*/_jsx(_Fragment, {});
6
+ }
@@ -18,15 +18,14 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
18
18
 
19
19
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
20
20
 
21
- import { useState, useEffect, useRef } from 'react';
22
- import EventName from "./eventName";
23
21
  import Flvjs from '@cloud-app-dev/flv.js';
24
22
  import Hls from 'hls.js';
23
+ import { useEffect, useRef, useState } from 'react';
25
24
  import { useRegisterPlayerEvent, useVideoEvent } from '.';
25
+ import EventName from "./eventName";
26
26
 
27
27
  function useErrorEvent(_ref) {
28
28
  var event = _ref.event,
29
- api = _ref.api,
30
29
  reload = _ref.reload,
31
30
  unload = _ref.unload,
32
31
  errorReloadTimer = _ref.errorReloadTimer,
@@ -40,7 +39,7 @@ function useErrorEvent(_ref) {
40
39
  setErrorTime = _useState2[1];
41
40
 
42
41
  var errorInfo = useRef(null);
43
- var reloadTimer = useRef(null);
42
+ var reloadTimer = useRef();
44
43
 
45
44
  var errorHandle = function errorHandle() {
46
45
  var _console;
@@ -69,7 +68,7 @@ function useErrorEvent(_ref) {
69
68
  var reloadSuccess = function reloadSuccess() {
70
69
  if (errorTimer > 0) {
71
70
  console.warn('视频重连成功!');
72
- event.emit(EventName.RELOAD_SUCCESS);
71
+ event === null || event === void 0 ? void 0 : event.emit(EventName.RELOAD_SUCCESS);
73
72
  clearErrorTimer();
74
73
  }
75
74
  };
@@ -96,19 +95,19 @@ function useErrorEvent(_ref) {
96
95
 
97
96
  if (errorTimer > errorReloadTimer) {
98
97
  unload();
99
- event.emit(EventName.RELOAD_FAIL);
98
+ event === null || event === void 0 ? void 0 : event.emit(EventName.RELOAD_FAIL);
100
99
  return undefined;
101
100
  }
102
101
 
103
102
  console.warn("\u89C6\u9891\u64AD\u653E\u51FA\u9519\uFF0C\u6B63\u5728\u8FDB\u884C\u91CD\u8FDE".concat(errorTimer));
104
103
  reloadTimer.current = setTimeout(function () {
105
- event.emit.apply(event, [EventName.ERROR_RELOAD, errorTimer].concat(_toConsumableArray(errorInfo.current)));
104
+ event === null || event === void 0 ? void 0 : event.emit.apply(event, [EventName.ERROR_RELOAD, errorTimer].concat(_toConsumableArray(errorInfo.current)));
106
105
  reload();
107
106
  }, 2 * 1000);
108
107
  return function () {
109
108
  clearTimeout(reloadTimer.current);
110
109
  }; // eslint-disable-next-line react-hooks/exhaustive-deps
111
- }, [errorTimer, api, event, flv, hls]);
110
+ }, [errorTimer, event, flv, hls]);
112
111
  }
113
112
 
114
113
  export default useErrorEvent;
@@ -117,7 +117,7 @@ var VideoEventInstance = /*#__PURE__*/function () {
117
117
  }();
118
118
 
119
119
  export function usePlayerEvent(video) {
120
- var _useState = useState(null),
120
+ var _useState = useState(undefined),
121
121
  _useState2 = _slicedToArray(_useState, 2),
122
122
  event = _useState2[0],
123
123
  setEvent = _useState2[1];
@@ -11,9 +11,9 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
11
11
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
12
 
13
13
  import React, { useEffect, useMemo, useRef, useState } from 'react';
14
- import Events from "./event/eventName";
15
14
  import useRafInterval from "../useRafInterval";
16
15
  import { useRegisterPlayerEvent } from "./event";
16
+ import Events from "./event/eventName";
17
17
  import { getDomStyleValue } from "./util";
18
18
  import { jsx as _jsx } from "react/jsx-runtime";
19
19
  var oneFps = 1 / 30;
@@ -30,21 +30,23 @@ function FPSPlay(_ref) {
30
30
  update = _useState2[1];
31
31
 
32
32
  var ref = useRef(null);
33
- var timerRef = useRef(null);
33
+ var timerRef = useRef();
34
34
  var fps_second = useMemo(function () {
35
35
  return fps ? 1 / fps : oneFps;
36
36
  }, [fps]);
37
37
  useEffect(function () {
38
38
  var fpsCapture = function fpsCapture() {
39
- if (!ref.current || !event.video) {
39
+ var _api$getCurrentTime, _api$getDuration;
40
+
41
+ if (!ref.current || !(event !== null && event !== void 0 && event.video)) {
40
42
  return;
41
43
  }
42
44
 
43
45
  var video = event.video;
44
- var fpsTime = api.getCurrentTime() + fps_second;
46
+ var fpsTime = (_api$getCurrentTime = api === null || api === void 0 ? void 0 : api.getCurrentTime()) !== null && _api$getCurrentTime !== void 0 ? _api$getCurrentTime : 0 + fps_second;
45
47
  video.currentTime = fpsTime;
46
48
 
47
- if (video.currentTime >= api.getDuration()) {
49
+ if (video.currentTime >= ((_api$getDuration = api === null || api === void 0 ? void 0 : api.getDuration()) !== null && _api$getDuration !== void 0 ? _api$getDuration : 0)) {
48
50
  clearInterval(timerRef.current);
49
51
  video.currentTime = 0;
50
52
  event.emit(Events.PLAY_ENDED);
@@ -63,7 +65,7 @@ function FPSPlay(_ref) {
63
65
 
64
66
  if (fit === 'fill') {
65
67
  //全画面绘制,存在拉伸
66
- ctx.drawImage(video, 0, 0, width, height);
68
+ ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, width, height);
67
69
  } else {
68
70
  // 自适应绘制
69
71
  var videoWidth = video.videoWidth;
@@ -71,7 +73,7 @@ function FPSPlay(_ref) {
71
73
  var scale = height / videoHeight;
72
74
  var s_vw = scale * videoWidth;
73
75
  var paddingSize = (width - s_vw) / 2;
74
- ctx.drawImage(video, paddingSize, 0, s_vw, height);
76
+ ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, paddingSize, 0, s_vw, height);
75
77
  }
76
78
  };
77
79
 
@@ -89,7 +91,7 @@ function FPSPlay(_ref) {
89
91
  }); // TODO: 未知情况,video会自动播放,轮训检测并暂停零时解决
90
92
 
91
93
  useRafInterval(function () {
92
- return !api.paused ? api.pause() : null;
94
+ return !(api !== null && api !== void 0 && api.paused) ? api === null || api === void 0 ? void 0 : api.pause() : null;
93
95
  }, 10);
94
96
  return /*#__PURE__*/_jsx("canvas", {
95
97
  className: "fps-play-canvas",
@@ -13,16 +13,17 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
13
13
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
14
14
 
15
15
  import React, { useMemo, useRef } from 'react';
16
- import SinglePlayer from "./single_player";
17
- import FrontendTimeLine from "./frontend_timeline";
18
16
  import Events from "./event/eventName";
19
- import { jsx as _jsx } from "react/jsx-runtime";
20
- import { Fragment as _Fragment } from "react/jsx-runtime";
21
-
17
+ import FrontendTimeLine from "./frontend_timeline";
18
+ import SinglePlayer from "./single_player";
22
19
  /**
23
20
  * @desc 主组件,负责片段整体逻辑控制
24
21
  * @return JSX.Element
25
22
  */
23
+
24
+ import { jsx as _jsx } from "react/jsx-runtime";
25
+ import { Fragment as _Fragment } from "react/jsx-runtime";
26
+
26
27
  function FrontendPlayer(_ref) {
27
28
  var url = _ref.url,
28
29
  begin = _ref.begin,
@@ -44,14 +45,16 @@ function FrontendPlayer(_ref) {
44
45
 
45
46
 
46
47
  var duration = useMemo(function () {
47
- return (end - begin) / 1000;
48
+ return (end !== null && end !== void 0 ? end : 0 - (begin !== null && begin !== void 0 ? begin : 0)) / 1000;
48
49
  }, [begin, end]); //单位s 秒
49
50
  // 重置reload
50
51
 
51
52
  var reload = _useMemoizedFn(function () {
52
- playRef.current.event.emit(Events.RELOAD);
53
+ var _playRef$current, _playRef$current2;
54
+
55
+ (_playRef$current = playRef.current) === null || _playRef$current === void 0 ? void 0 : _playRef$current.event.emit(Events.RELOAD);
53
56
  onSeek === null || onSeek === void 0 ? void 0 : onSeek(begin);
54
- playRef.current.api.reload();
57
+ (_playRef$current2 = playRef.current) === null || _playRef$current2 === void 0 ? void 0 : _playRef$current2.api.reload();
55
58
  });
56
59
 
57
60
  var onInit = _useMemoizedFn(function () {
@@ -61,9 +64,9 @@ function FrontendPlayer(_ref) {
61
64
 
62
65
  var hasReady = api && event;
63
66
  var timeline = customTimeLine !== null && customTimeLine !== void 0 ? customTimeLine : /*#__PURE__*/_jsx(FrontendTimeLine, {
64
- end: end,
67
+ end: end !== null && end !== void 0 ? end : 0,
65
68
  onSeek: onSeek,
66
- begin: begin,
69
+ begin: begin !== null && begin !== void 0 ? begin : 0,
67
70
  duration: duration
68
71
  });
69
72
  return /*#__PURE__*/_jsx(SinglePlayer, _objectSpread({
@@ -18,20 +18,53 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
18
18
 
19
19
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
20
20
 
21
- import React, { useMemo, useState, startTransition } from 'react';
21
+ import moment from 'moment';
22
+ import React, { startTransition, useMemo, useState } from 'react';
22
23
  import useBarStatus from "./contraller_bar/useBarStatus";
24
+ import "./style/timeline.less";
23
25
  import { useTimes } from "./timeline";
24
26
  import { FMT } from "./util";
25
- import moment from 'moment';
26
- import "./style/timeline.less";
27
27
  import { jsx as _jsx } from "react/jsx-runtime";
28
28
  import { jsxs as _jsxs } from "react/jsx-runtime";
29
29
 
30
- function FrontendTimeLine(_ref) {
31
- var duration = _ref.duration,
30
+ function TipTitle(_ref) {
31
+ var end = _ref.end,
32
32
  begin = _ref.begin,
33
- end = _ref.end,
34
- onSeek = _ref.onSeek;
33
+ left = _ref.left,
34
+ current = _ref.current,
35
+ markTime = _ref.markTime;
36
+
37
+ if (left === -1) {
38
+ return null;
39
+ }
40
+
41
+ return /*#__PURE__*/_jsxs("div", {
42
+ className: "frontend-line-tip-box",
43
+ style: {
44
+ left: left
45
+ },
46
+ children: [/*#__PURE__*/_jsx("div", {
47
+ style: {
48
+ fontWeight: 600
49
+ },
50
+ children: "\u5F55\u50CF\u4FE1\u606F"
51
+ }), /*#__PURE__*/_jsxs("div", {
52
+ children: ["\u5F00\u59CB\uFF1A", moment(begin).format(FMT)]
53
+ }), /*#__PURE__*/_jsxs("div", {
54
+ children: ["\u7ED3\u675F\uFF1A", moment(end).format(FMT)]
55
+ }), /*#__PURE__*/_jsxs("div", {
56
+ children: ["\u523B\u5EA6\uFF1A", moment(markTime).format(FMT)]
57
+ }), /*#__PURE__*/_jsxs("div", {
58
+ children: ["\u5F53\u524D\uFF1A", moment(current).format(FMT)]
59
+ })]
60
+ });
61
+ }
62
+
63
+ function FrontendTimeLine(_ref2) {
64
+ var duration = _ref2.duration,
65
+ begin = _ref2.begin,
66
+ end = _ref2.end,
67
+ onSeek = _ref2.onSeek;
35
68
 
36
69
  // time 是记录seek时跳了多少
37
70
  var _useState = useState({
@@ -94,7 +127,7 @@ function FrontendTimeLine(_ref) {
94
127
  });
95
128
  };
96
129
 
97
- var onLineMouseOut = function onLineMouseOut(e) {
130
+ var onLineMouseOut = function onLineMouseOut() {
98
131
  return startTransition(function () {
99
132
  return setState(function (old) {
100
133
  return _objectSpread(_objectSpread({}, old), {}, {
@@ -129,37 +162,4 @@ function FrontendTimeLine(_ref) {
129
162
  });
130
163
  }
131
164
 
132
- function TipTitle(_ref2) {
133
- var end = _ref2.end,
134
- begin = _ref2.begin,
135
- left = _ref2.left,
136
- current = _ref2.current,
137
- markTime = _ref2.markTime;
138
-
139
- if (left === -1) {
140
- return null;
141
- }
142
-
143
- return /*#__PURE__*/_jsxs("div", {
144
- className: "frontend-line-tip-box",
145
- style: {
146
- left: left
147
- },
148
- children: [/*#__PURE__*/_jsx("div", {
149
- style: {
150
- fontWeight: 600
151
- },
152
- children: "\u5F55\u50CF\u4FE1\u606F"
153
- }), /*#__PURE__*/_jsxs("div", {
154
- children: ["\u5F00\u59CB\uFF1A", moment(begin).format(FMT)]
155
- }), /*#__PURE__*/_jsxs("div", {
156
- children: ["\u7ED3\u675F\uFF1A", moment(end).format(FMT)]
157
- }), /*#__PURE__*/_jsxs("div", {
158
- children: ["\u523B\u5EA6\uFF1A", moment(markTime).format(FMT)]
159
- }), /*#__PURE__*/_jsxs("div", {
160
- children: ["\u5F53\u524D\uFF1A", moment(current).format(FMT)]
161
- })]
162
- });
163
- }
164
-
165
165
  export default FrontendTimeLine;
@@ -11,14 +11,16 @@ function useLiveHeart(_ref) {
11
11
 
12
12
  var documentVisibility = _useDocumentVisibility();
13
13
 
14
- var cTimeRef = useRef(null);
14
+ var cTimeRef = useRef(0);
15
15
 
16
16
  var run = function run() {
17
- if (!isLive || documentVisibility !== 'visible') {
17
+ var _api$getCurrentTime;
18
+
19
+ if (!isLive || documentVisibility !== 'visible' || !api) {
18
20
  return;
19
21
  }
20
22
 
21
- var current = api.getCurrentTime();
23
+ var current = (_api$getCurrentTime = api.getCurrentTime()) !== null && _api$getCurrentTime !== void 0 ? _api$getCurrentTime : 0;
22
24
  var buffered = api.getSecondsLoaded();
23
25
 
24
26
  if (buffered - current > 5) {
@@ -33,7 +35,9 @@ function useLiveHeart(_ref) {
33
35
  }, [documentVisibility]);
34
36
 
35
37
  _useRafInterval(function () {
36
- return cTimeRef.current = api.getCurrentTime();
38
+ var _api$getCurrentTime2;
39
+
40
+ return cTimeRef.current = (_api$getCurrentTime2 = api === null || api === void 0 ? void 0 : api.getCurrentTime()) !== null && _api$getCurrentTime2 !== void 0 ? _api$getCurrentTime2 : 0;
37
41
  }, 1 * 1000);
38
42
 
39
43
  _useRafInterval(function () {
@@ -41,9 +45,15 @@ function useLiveHeart(_ref) {
41
45
  }, 30 * 1000);
42
46
 
43
47
  _useRafInterval(function () {
48
+ var _api$video;
49
+
50
+ if (!api || !event) {
51
+ return;
52
+ }
53
+
44
54
  var cuurentTime = api.getCurrentTime();
45
55
 
46
- if (!!isLive && !api.video.paused && cuurentTime === cTimeRef.current) {
56
+ if (!!isLive && !((_api$video = api.video) !== null && _api$video !== void 0 && _api$video.paused) && cuurentTime === cTimeRef.current) {
47
57
  event.emit(Events.ERROR);
48
58
  }
49
59
  }, 20 * 1000);