@cloud-app-dev/vidc 3.1.16 → 3.1.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.
- package/es/Api/index.js +0 -23
- package/es/AppContext/Sync.js +1 -15
- package/es/AppContext/index.js +21 -52
- package/es/AppContext/static.js +0 -7
- package/es/Auth/index.js +2 -5
- package/es/AutoExit/index.js +1 -5
- package/es/Box/BetweenBox/index.js +6 -8
- package/es/Box/InfoBox/index.js +6 -8
- package/es/Box/TwoColumnBox/index.js +8 -18
- package/es/Box/deps/grid-factory.js +0 -12
- package/es/Box/index.js +4 -6
- package/es/CheckGroupFixed/index.js +19 -34
- package/es/Config/index.js +0 -4
- package/es/Config/utils.js +3 -18
- package/es/ConfigContext/index.js +1 -3
- package/es/CustomRenderSelect/index.js +13 -29
- package/es/DisableMark/index.js +2 -2
- package/es/DomMove/index.js +24 -37
- package/es/DomMove/utils.js +3 -8
- package/es/Drag/DragAndDropItem.js +19 -37
- package/es/Drag/DropItem.js +5 -15
- package/es/Drawer/Demo.js +3 -17
- package/es/Drawer/Footer.js +3 -5
- package/es/Drawer/index.js +28 -50
- package/es/ErrorFallback/index.js +1 -3
- package/es/FullScreen/index.js +8 -18
- package/es/HightLevel/index.js +1 -5
- package/es/IconFont/index.js +5 -11
- package/es/ImageView/index.js +8 -20
- package/es/Input/index.js +14 -27
- package/es/InstanceHistory/index.js +0 -2
- package/es/LabelValue/index.js +8 -10
- package/es/List/DynamicGridList/Demo.js +0 -11
- package/es/List/DynamicGridList/index.js +16 -25
- package/es/List/DynamicList/index.js +23 -38
- package/es/List/GridList/Demo.js +3 -16
- package/es/List/GridList/hook.js +34 -65
- package/es/List/GridList/utils.js +0 -1
- package/es/List/VList/index.js +10 -20
- package/es/List/VList/utils.js +2 -3
- package/es/List/index.js +5 -7
- package/es/LoaderApp/index.js +5 -22
- package/es/LoaderApp/loader.js +5 -13
- package/es/LoaderApp/sandbox.back.js +16 -81
- package/es/LoaderApp/sandbox.js +8 -22
- package/es/LoaderApp/utils.js +20 -49
- package/es/LoaderScript/index.js +8 -19
- package/es/LoaderScript/utils.js +0 -51
- package/es/Map/BasicMap/AMapInstance.js +0 -10
- package/es/Map/BasicMap/LeafletInstance.js +11 -20
- package/es/Map/BasicMap/index.js +6 -28
- package/es/Map/ClusterLayer/hook.js +10 -32
- package/es/Map/ClusterLayer/index.js +2 -6
- package/es/Map/Config/index.js +8 -21
- package/es/Map/Config/utils.js +0 -6
- package/es/Map/Context/index.js +2 -22
- package/es/Map/FindPio/index.js +0 -2
- package/es/Map/InfoWindow/MakerLikeWindow.js +9 -28
- package/es/Map/InfoWindow/demo.js +5 -22
- package/es/Map/InfoWindow/index.js +13 -29
- package/es/Map/LevelCenter/DragMarker/index.js +5 -9
- package/es/Map/LevelCenter/demo.js +6 -16
- package/es/Map/LevelCenter/index.js +8 -15
- package/es/Map/LoaderMap/index.js +10 -10
- package/es/Map/MapDrawSelect/demo.js +12 -23
- package/es/Map/MapDrawSelect/index.js +14 -21
- package/es/Map/MouseTool/index.js +16 -26
- package/es/Map/MouseTool/useMouseTools.js +6 -29
- package/es/Map/ResetTools/index.js +4 -8
- package/es/Map/SinglePoint/index.js +6 -13
- package/es/Map/hook/useMapEvent.js +3 -7
- package/es/Map/hook/useMapType.js +1 -2
- package/es/Map/useMarker/index.js +10 -24
- package/es/Map/withMap/index.js +0 -2
- package/es/Modal/index.d.ts +1 -1
- package/es/Modal/index.js +29 -50
- package/es/Picture/component/DefaultRects/RectInfo.js +11 -25
- package/es/Picture/component/DefaultRects/index.js +3 -5
- package/es/Picture/component/DrawRect/index.js +6 -8
- package/es/Picture/component/RectMenu/index.js +10 -16
- package/es/Picture/component/RectMenu/utils.js +3 -6
- package/es/Picture/component/Tools/index.js +6 -8
- package/es/Picture/component/WheelScale/index.js +3 -6
- package/es/Picture/dragBound.js +4 -17
- package/es/Picture/index.js +46 -87
- package/es/Picture/loadCaptureRectImage.js +10 -26
- package/es/Picture/useDraw.js +20 -39
- package/es/Picture/utils.js +2 -11
- package/es/Player/api/index.js +14 -78
- package/es/Player/context.js +1 -2
- package/es/Player/contraller_bar/bar.js +5 -9
- package/es/Player/contraller_bar/contraller_event.js +5 -23
- package/es/Player/contraller_bar/index.js +7 -9
- package/es/Player/contraller_bar/left_bar.js +15 -27
- package/es/Player/contraller_bar/right_bar.js +7 -18
- package/es/Player/contraller_bar/time.js +6 -16
- package/es/Player/contraller_bar/useBarStatus.js +5 -16
- package/es/Player/contraller_bar/volume.js +6 -26
- package/es/Player/demo.js +59 -75
- package/es/Player/event/errorEvent.js +14 -39
- package/es/Player/event/eventName.js +1 -1
- package/es/Player/event/index.js +19 -53
- package/es/Player/fps_play.js +10 -27
- package/es/Player/frontend_player.js +10 -19
- package/es/Player/frontend_timeline.js +25 -47
- package/es/Player/iconfont.js +2 -5
- package/es/Player/live_heart.js +2 -14
- package/es/Player/message.js +9 -29
- package/es/Player/segment_player.js +39 -77
- package/es/Player/segment_timeline.js +42 -68
- package/es/Player/single_player.js +64 -87
- package/es/Player/style/iconfont.js +10 -17
- package/es/Player/timeline.js +11 -28
- package/es/Player/util.js +0 -21
- package/es/PlayerExt/demo.js +11 -21
- package/es/PlayerExt/index.js +18 -43
- package/es/Progress/index.js +3 -15
- package/es/ROI/demo.js +0 -2
- package/es/ROI/index.js +15 -22
- package/es/ScreenPlayer/Live.js +34 -67
- package/es/ScreenPlayer/LiveTools.js +21 -38
- package/es/ScreenPlayer/PlayerWithExt.js +43 -78
- package/es/ScreenPlayer/RatePick.js +1 -3
- package/es/ScreenPlayer/Record.js +50 -121
- package/es/ScreenPlayer/RecordTools.js +32 -54
- package/es/ScreenPlayer/ScreenSelect.js +1 -3
- package/es/ScreenPlayer/SegmentTimeLine.js +8 -12
- package/es/ScreenPlayer/TimeMode.js +1 -3
- package/es/ScreenPlayer/TimeSelect.js +11 -26
- package/es/ScreenPlayer/demo.js +3 -1
- package/es/ScreenPlayer/demo2.js +9 -24
- package/es/ScreenPlayer/useRecordList.js +7 -72
- package/es/ScreenPlayer/useTimeSlider.js +40 -132
- package/es/ScreenPlayer/useVideoFit.js +5 -18
- package/es/ScreenPlayer/utils.js +0 -8
- package/es/Service/fetch-adapter.js +2 -37
- package/es/Service/http.js +8 -27
- package/es/TableLayout/index.js +3 -7
- package/es/ThemeAntd/demo.js +0 -2
- package/es/ThemeAntd/index.css +15 -0
- package/es/ThemeAntd/style/select.css +15 -0
- package/es/Timeout/index.js +10 -26
- package/es/Tree/demo.js +0 -2
- package/es/Tree/index.js +14 -21
- package/es/useDrawROI/index.js +51 -105
- package/es/useEventEmitterHandle/index.js +2 -6
- package/es/useFullscreen/demo.js +6 -16
- package/es/useFullscreen/index.js +5 -25
- package/es/useHistory/index.js +0 -2
- package/es/useInfiniteScroll/index.js +14 -39
- package/es/useRafInterval/index.js +2 -26
- package/es/useSimpleState/index.js +5 -16
- package/es/useVirtualList/index.js +19 -57
- package/es/utils.js +0 -28
- package/package.json +14 -14
package/es/Player/api/index.js
CHANGED
|
@@ -1,38 +1,24 @@
|
|
|
1
1
|
import _nextTick from "@cloud-app-dev/utils/es/nextTick";
|
|
2
|
-
|
|
3
2
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
-
|
|
5
3
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
6
|
-
|
|
7
4
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
|
-
|
|
9
5
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
10
|
-
|
|
11
6
|
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
12
|
-
|
|
13
7
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
|
-
|
|
15
8
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
16
|
-
|
|
17
9
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
18
|
-
|
|
19
10
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
20
|
-
|
|
21
11
|
import { useEffect, useState } from 'react';
|
|
22
12
|
import { createFlvPlayer, createHlsPlayer, tryCatch } from '../util';
|
|
23
|
-
|
|
24
13
|
var Api = /*#__PURE__*/function () {
|
|
25
14
|
function Api(container) {
|
|
26
15
|
var _this = this;
|
|
27
|
-
|
|
28
16
|
_classCallCheck(this, Api);
|
|
29
|
-
|
|
30
17
|
this.play = function () {
|
|
31
18
|
tryCatch(function () {
|
|
32
19
|
return _this.video.play();
|
|
33
20
|
});
|
|
34
21
|
};
|
|
35
|
-
|
|
36
22
|
this.pause = function () {
|
|
37
23
|
_this.video.pause();
|
|
38
24
|
};
|
|
@@ -40,40 +26,30 @@ var Api = /*#__PURE__*/function () {
|
|
|
40
26
|
* 设置currentTime实现seek
|
|
41
27
|
* @param {*} seconds
|
|
42
28
|
*/
|
|
43
|
-
|
|
44
|
-
|
|
45
29
|
this.seekTo = function (seconds) {
|
|
46
30
|
_this.video.currentTime = seconds;
|
|
47
31
|
};
|
|
48
|
-
|
|
49
32
|
this.setVolume = function (fraction) {
|
|
50
33
|
_this.video.volume = fraction;
|
|
51
34
|
};
|
|
52
|
-
|
|
53
35
|
this.getVolume = function () {
|
|
54
36
|
return _this.video.volume;
|
|
55
37
|
};
|
|
56
|
-
|
|
57
38
|
this.mute = function () {
|
|
58
39
|
_this.video.muted = true;
|
|
59
40
|
};
|
|
60
|
-
|
|
61
41
|
this.unmute = function () {
|
|
62
42
|
_this.video.muted = false;
|
|
63
43
|
};
|
|
64
44
|
/**
|
|
65
45
|
* 开启画中画功能
|
|
66
46
|
*/
|
|
67
|
-
|
|
68
|
-
|
|
69
47
|
this.requestPictureInPicture = function () {
|
|
70
48
|
_this.video.requestPictureInPicture();
|
|
71
49
|
};
|
|
72
50
|
/**
|
|
73
51
|
* 关闭画中画功能
|
|
74
52
|
*/
|
|
75
|
-
|
|
76
|
-
|
|
77
53
|
this.exitPictureInPicture = function () {
|
|
78
54
|
if (document.exitPictureInPicture && document.pictureInPictureElement === _this.video) {
|
|
79
55
|
document.exitPictureInPicture();
|
|
@@ -83,71 +59,52 @@ var Api = /*#__PURE__*/function () {
|
|
|
83
59
|
* 设置播放速率
|
|
84
60
|
* @param {*} rate
|
|
85
61
|
*/
|
|
86
|
-
|
|
87
|
-
|
|
88
62
|
this.setPlaybackRate = function (rate) {
|
|
89
63
|
_this.video.playbackRate = rate;
|
|
90
64
|
};
|
|
91
65
|
/**
|
|
92
66
|
* 获取视频总时长
|
|
93
67
|
*/
|
|
94
|
-
|
|
95
|
-
|
|
96
68
|
this.getDuration = function () {
|
|
97
69
|
var _this$video = _this.video,
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
70
|
+
duration = _this$video.duration,
|
|
71
|
+
seekable = _this$video.seekable;
|
|
101
72
|
if (duration === Infinity && seekable.length > 0) {
|
|
102
73
|
return seekable.end(seekable.length - 1);
|
|
103
74
|
}
|
|
104
|
-
|
|
105
75
|
return duration;
|
|
106
76
|
};
|
|
107
77
|
/**
|
|
108
78
|
* 获取当前播放时间
|
|
109
79
|
*/
|
|
110
|
-
|
|
111
|
-
|
|
112
80
|
this.getCurrentTime = function () {
|
|
113
81
|
return _this.video.currentTime;
|
|
114
82
|
};
|
|
115
83
|
/**
|
|
116
84
|
* 获取缓存时间
|
|
117
85
|
*/
|
|
118
|
-
|
|
119
|
-
|
|
120
86
|
this.getSecondsLoaded = function () {
|
|
121
87
|
return _this.getBufferedTime()[1];
|
|
122
88
|
};
|
|
123
89
|
/**
|
|
124
90
|
* 获取当前视频缓存的起止时间
|
|
125
91
|
*/
|
|
126
|
-
|
|
127
|
-
|
|
128
92
|
this.getBufferedTime = function () {
|
|
129
93
|
var buffered = _this.video.buffered;
|
|
130
|
-
|
|
131
94
|
if (buffered.length === 0) {
|
|
132
95
|
return [0, 0];
|
|
133
96
|
}
|
|
134
|
-
|
|
135
97
|
var end = buffered.end(buffered.length - 1);
|
|
136
98
|
var start = buffered.start(buffered.length - 1);
|
|
137
|
-
|
|
138
99
|
var duration = _this.getDuration();
|
|
139
|
-
|
|
140
100
|
if (end > duration) {
|
|
141
101
|
return duration;
|
|
142
102
|
}
|
|
143
|
-
|
|
144
103
|
return [start, end];
|
|
145
104
|
};
|
|
146
105
|
/**
|
|
147
106
|
* 视频截屏方法
|
|
148
107
|
*/
|
|
149
|
-
|
|
150
|
-
|
|
151
108
|
this.snapshot = function () {
|
|
152
109
|
var canvas = document.createElement('canvas');
|
|
153
110
|
var ctx = canvas.getContext('2d');
|
|
@@ -161,24 +118,16 @@ var Api = /*#__PURE__*/function () {
|
|
|
161
118
|
}, 200);
|
|
162
119
|
return canvas.toDataURL();
|
|
163
120
|
};
|
|
164
|
-
|
|
165
121
|
this.unload = function () {};
|
|
166
|
-
|
|
167
122
|
this.reload = function () {};
|
|
168
|
-
|
|
169
123
|
this.toggleFit = function () {};
|
|
170
|
-
|
|
171
124
|
this.openFpsPlay = function () {};
|
|
172
|
-
|
|
173
125
|
this.closeFpsPlay = function () {};
|
|
174
|
-
|
|
175
126
|
this.destroy = function () {
|
|
176
127
|
_this.container = null;
|
|
177
128
|
};
|
|
178
|
-
|
|
179
129
|
this.container = container;
|
|
180
130
|
}
|
|
181
|
-
|
|
182
131
|
_createClass(Api, [{
|
|
183
132
|
key: "video",
|
|
184
133
|
get: function get() {
|
|
@@ -195,48 +144,38 @@ var Api = /*#__PURE__*/function () {
|
|
|
195
144
|
return this.video.muted;
|
|
196
145
|
}
|
|
197
146
|
}]);
|
|
198
|
-
|
|
199
147
|
return Api;
|
|
200
148
|
}(); // 创建播放介质
|
|
201
|
-
|
|
202
|
-
|
|
203
149
|
export function useTypeAndPlay(url, type, isLive, container, segments, flvConfig, hlsConfig) {
|
|
204
150
|
var _useState = useState({
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
151
|
+
type: '',
|
|
152
|
+
flv: undefined,
|
|
153
|
+
hls: undefined
|
|
154
|
+
}),
|
|
155
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
156
|
+
state = _useState2[0],
|
|
157
|
+
setState = _useState2[1];
|
|
213
158
|
useEffect(function () {
|
|
214
159
|
var isReady = container && (url || type === 'flv' && segments);
|
|
215
|
-
|
|
216
160
|
if (!isReady) {
|
|
217
161
|
return undefined;
|
|
218
162
|
}
|
|
219
|
-
|
|
220
163
|
var video = container.querySelector('video');
|
|
221
164
|
var options = {};
|
|
222
|
-
|
|
223
165
|
switch (type) {
|
|
224
166
|
case 'flv':
|
|
225
167
|
options.type = 'flv';
|
|
226
168
|
options.flv = createFlvPlayer(video, url, isLive, flvConfig);
|
|
227
169
|
break;
|
|
228
|
-
|
|
229
170
|
case 'hls':
|
|
230
171
|
options.type = 'hls';
|
|
231
172
|
options.hls = createHlsPlayer(video, url, isLive, hlsConfig);
|
|
232
173
|
break;
|
|
233
|
-
|
|
234
174
|
default:
|
|
235
175
|
options.type = 'native';
|
|
236
176
|
video.setAttribute('src', url);
|
|
237
177
|
break;
|
|
238
178
|
}
|
|
239
|
-
|
|
240
179
|
video.paused && tryCatch(function () {
|
|
241
180
|
return video.play();
|
|
242
181
|
});
|
|
@@ -256,26 +195,23 @@ export function useTypeAndPlay(url, type, isLive, container, segments, flvConfig
|
|
|
256
195
|
video.pause();
|
|
257
196
|
video.removeAttribute('src');
|
|
258
197
|
}
|
|
259
|
-
|
|
260
198
|
setState({});
|
|
261
199
|
};
|
|
262
200
|
}, [url, container, segments, type, isLive, flvConfig, hlsConfig]);
|
|
263
201
|
return [state.type, state.flv, state.hls];
|
|
264
|
-
}
|
|
265
|
-
|
|
202
|
+
}
|
|
203
|
+
//创建Api
|
|
266
204
|
export function usePlayerApi(url, type, isLive, container, segments, flvConfig, hlsConfig) {
|
|
267
205
|
var _useState3 = useState(null),
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
206
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
207
|
+
api = _useState4[0],
|
|
208
|
+
setApi = _useState4[1];
|
|
272
209
|
var typePlay = useTypeAndPlay(url, type, isLive, container, segments, flvConfig, hlsConfig);
|
|
273
210
|
useEffect(function () {
|
|
274
211
|
if (!container) {
|
|
275
212
|
console.debug('wait create api...');
|
|
276
213
|
return undefined;
|
|
277
214
|
}
|
|
278
|
-
|
|
279
215
|
var api = new Api(container);
|
|
280
216
|
setApi(api);
|
|
281
217
|
return function () {
|
package/es/Player/context.js
CHANGED
|
@@ -3,8 +3,7 @@ import React from 'react';
|
|
|
3
3
|
export var Context = /*#__PURE__*/React.createContext(null);
|
|
4
4
|
export function Provider(_a) {
|
|
5
5
|
var children = _a.children,
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
props = __rest(_a, ["children"]);
|
|
8
7
|
return /*#__PURE__*/React.createElement(Context.Provider, {
|
|
9
8
|
value: Object.assign({}, props)
|
|
10
9
|
}, children);
|
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import React from 'react';
|
|
3
|
-
|
|
4
3
|
function Bar(_a) {
|
|
5
4
|
var _a$visibel = _a.visibel,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
visibel = _a$visibel === void 0 ? true : _a$visibel,
|
|
6
|
+
_a$className = _a.className,
|
|
7
|
+
className = _a$className === void 0 ? '' : _a$className,
|
|
8
|
+
children = _a.children,
|
|
9
|
+
props = __rest(_a, ["visibel", "className", "children"]);
|
|
12
10
|
if (visibel === false) {
|
|
13
11
|
return null;
|
|
14
12
|
}
|
|
15
|
-
|
|
16
13
|
return /*#__PURE__*/React.createElement("span", Object.assign({
|
|
17
14
|
className: "contraller-bar-item ".concat(className)
|
|
18
15
|
}, props), children);
|
|
19
16
|
}
|
|
20
|
-
|
|
21
17
|
export default Bar;
|
|
@@ -1,42 +1,29 @@
|
|
|
1
1
|
import _useEventListener from "ahooks/es/useEventListener";
|
|
2
2
|
import _useMount from "ahooks/es/useMount";
|
|
3
|
-
|
|
4
3
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
5
|
-
|
|
6
4
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7
|
-
|
|
8
5
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
9
|
-
|
|
10
6
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
11
|
-
|
|
12
7
|
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
13
|
-
|
|
14
8
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
|
-
|
|
16
9
|
import React, { useState, useRef, useContext } from 'react';
|
|
17
10
|
import { Context } from '../context';
|
|
18
11
|
import EventName from '../event/eventName';
|
|
19
|
-
|
|
20
12
|
function ContrallerEvent(_ref) {
|
|
21
13
|
var children = _ref.children;
|
|
22
|
-
|
|
23
14
|
var _useContext = useContext(Context),
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
15
|
+
event = _useContext.event,
|
|
16
|
+
container = _useContext.container;
|
|
27
17
|
var timer = useRef(null);
|
|
28
|
-
|
|
29
18
|
var _useState = useState(true),
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
19
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
20
|
+
visibel = _useState2[0],
|
|
21
|
+
setVisibel = _useState2[1];
|
|
34
22
|
var showContraller = function showContraller() {
|
|
35
23
|
clearTimeout(timer.current);
|
|
36
24
|
setVisibel(true);
|
|
37
25
|
event.emit(EventName.SHOW_CONTRALLER);
|
|
38
26
|
};
|
|
39
|
-
|
|
40
27
|
var hideContraller = function hideContraller() {
|
|
41
28
|
clearTimeout(timer.current);
|
|
42
29
|
timer.current = setTimeout(function () {
|
|
@@ -44,24 +31,19 @@ function ContrallerEvent(_ref) {
|
|
|
44
31
|
event.emit(EventName.HIDE_CONTRALLER);
|
|
45
32
|
}, 3 * 1000);
|
|
46
33
|
};
|
|
47
|
-
|
|
48
34
|
_useMount(function () {
|
|
49
35
|
return hideContraller();
|
|
50
36
|
});
|
|
51
|
-
|
|
52
37
|
_useEventListener('mouseenter', showContraller, {
|
|
53
38
|
target: container
|
|
54
39
|
});
|
|
55
|
-
|
|
56
40
|
_useEventListener('mouseleave', hideContraller, {
|
|
57
41
|
target: container
|
|
58
42
|
});
|
|
59
|
-
|
|
60
43
|
return /*#__PURE__*/React.createElement(React.Fragment, null, React.Children.map(children, function (child) {
|
|
61
44
|
return /*#__PURE__*/React.isValidElement(child) ? /*#__PURE__*/React.cloneElement(child, {
|
|
62
45
|
visibel: visibel
|
|
63
46
|
}) : child;
|
|
64
47
|
}));
|
|
65
48
|
}
|
|
66
|
-
|
|
67
49
|
export default ContrallerEvent;
|
|
@@ -2,16 +2,15 @@ import React from 'react';
|
|
|
2
2
|
import LeftBar from './left_bar';
|
|
3
3
|
import RightBar from './right_bar';
|
|
4
4
|
import "../style/bar.css";
|
|
5
|
-
|
|
6
5
|
function ContrallerBar(_ref) {
|
|
7
6
|
var rightExtContents = _ref.rightExtContents,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
rightMidExtContents = _ref.rightMidExtContents,
|
|
8
|
+
visibel = _ref.visibel,
|
|
9
|
+
leftExtContents = _ref.leftExtContents,
|
|
10
|
+
leftMidExtContents = _ref.leftMidExtContents,
|
|
11
|
+
reload = _ref.reload,
|
|
12
|
+
hideTimeProgress = _ref.hideTimeProgress,
|
|
13
|
+
oneFpsPlay = _ref.oneFpsPlay;
|
|
15
14
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
16
15
|
className: "contraller-bar-layout ".concat(!visibel ? 'hide-contraller-bar' : '')
|
|
17
16
|
}, /*#__PURE__*/React.createElement(LeftBar, {
|
|
@@ -25,5 +24,4 @@ function ContrallerBar(_ref) {
|
|
|
25
24
|
rightMidExtContents: rightMidExtContents
|
|
26
25
|
})));
|
|
27
26
|
}
|
|
28
|
-
|
|
29
27
|
export default ContrallerBar;
|
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
-
|
|
3
2
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
-
|
|
5
3
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
-
|
|
7
4
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
8
|
-
|
|
9
5
|
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
10
|
-
|
|
11
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
-
|
|
13
7
|
import React, { useState, useCallback, useMemo, useContext } from 'react';
|
|
14
8
|
import IconFont from '../iconfont';
|
|
15
9
|
import Bar from './bar';
|
|
@@ -17,35 +11,30 @@ import { Context } from '../context';
|
|
|
17
11
|
import { useVideoEvent } from '../event';
|
|
18
12
|
import Volume from './volume';
|
|
19
13
|
import Time from './time';
|
|
20
|
-
|
|
21
14
|
function LeftBar(_ref) {
|
|
22
15
|
var reload = _ref.reload,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
16
|
+
leftExtContents = _ref.leftExtContents,
|
|
17
|
+
leftMidExtContents = _ref.leftMidExtContents,
|
|
18
|
+
hideTimeProgress = _ref.hideTimeProgress,
|
|
19
|
+
oneFpsPlay = _ref.oneFpsPlay;
|
|
28
20
|
var _useContext = useContext(Context),
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
21
|
+
api = _useContext.api,
|
|
22
|
+
container = _useContext.container,
|
|
23
|
+
isLive = _useContext.isLive,
|
|
24
|
+
isFpsPlay = _useContext.isFpsPlay;
|
|
34
25
|
var _useState = useState(Date.now()),
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
26
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
27
|
+
dep = _useState2[0],
|
|
28
|
+
setDep = _useState2[1];
|
|
39
29
|
var updateRender = function updateRender() {
|
|
40
30
|
return setDep(Date.now());
|
|
41
31
|
};
|
|
42
|
-
|
|
43
32
|
useVideoEvent('play', updateRender);
|
|
44
33
|
useVideoEvent('pause', updateRender);
|
|
45
34
|
useVideoEvent('volumechange', updateRender);
|
|
46
|
-
var video = container.querySelector('video');
|
|
35
|
+
var video = container.querySelector('video');
|
|
36
|
+
//缓存值
|
|
47
37
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
48
|
-
|
|
49
38
|
var paused = useMemo(function () {
|
|
50
39
|
return video === null || video === void 0 ? void 0 : video.paused;
|
|
51
40
|
}, [dep, video]);
|
|
@@ -54,8 +43,8 @@ function LeftBar(_ref) {
|
|
|
54
43
|
}, [paused]);
|
|
55
44
|
var statusText = useMemo(function () {
|
|
56
45
|
return paused ? '播放' : '暂停';
|
|
57
|
-
}, [paused]);
|
|
58
|
-
|
|
46
|
+
}, [paused]);
|
|
47
|
+
//TODO 方法
|
|
59
48
|
var changePlayStatus = useCallback(function () {
|
|
60
49
|
if (video === null || video === void 0 ? void 0 : video.paused) {
|
|
61
50
|
var buffered = api.getSecondsLoaded();
|
|
@@ -83,5 +72,4 @@ function LeftBar(_ref) {
|
|
|
83
72
|
title: "\u9010\u5E27\u64AD\u653E"
|
|
84
73
|
})), leftMidExtContents);
|
|
85
74
|
}
|
|
86
|
-
|
|
87
75
|
export default LeftBar;
|
|
@@ -1,35 +1,25 @@
|
|
|
1
1
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
-
|
|
3
2
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
-
|
|
5
3
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
-
|
|
7
4
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
8
|
-
|
|
9
5
|
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
10
|
-
|
|
11
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
-
|
|
13
7
|
import React, { useContext } from 'react';
|
|
14
8
|
import IconFont from '../iconfont';
|
|
15
9
|
import Bar from './bar';
|
|
16
10
|
import useFullscreen from '../../useFullscreen';
|
|
17
11
|
import { Context } from '../context';
|
|
18
|
-
|
|
19
12
|
function RightBar(_ref) {
|
|
20
13
|
var rightExtContents = _ref.rightExtContents,
|
|
21
|
-
|
|
22
|
-
|
|
14
|
+
rightMidExtContents = _ref.rightMidExtContents;
|
|
23
15
|
var _useContext = useContext(Context),
|
|
24
|
-
|
|
25
|
-
|
|
16
|
+
container = _useContext.container;
|
|
26
17
|
var _useFullscreen = useFullscreen(container),
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
18
|
+
_useFullscreen2 = _slicedToArray(_useFullscreen, 2),
|
|
19
|
+
isFullScreen = _useFullscreen2[0],
|
|
20
|
+
_useFullscreen2$ = _useFullscreen2[1],
|
|
21
|
+
enterFullscreen = _useFullscreen2$.enterFullscreen,
|
|
22
|
+
exitFullscreen = _useFullscreen2$.exitFullscreen;
|
|
33
23
|
var fullscreen = isFullScreen ? exitFullscreen : enterFullscreen;
|
|
34
24
|
return /*#__PURE__*/React.createElement("div", {
|
|
35
25
|
className: "contraller-right-bar"
|
|
@@ -39,5 +29,4 @@ function RightBar(_ref) {
|
|
|
39
29
|
type: isFullScreen ? 'lm-player-ExitFull_Main' : 'lm-player-Full_Main'
|
|
40
30
|
})), rightExtContents);
|
|
41
31
|
}
|
|
42
|
-
|
|
43
32
|
export default RightBar;
|
|
@@ -1,34 +1,24 @@
|
|
|
1
1
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
-
|
|
3
2
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
-
|
|
5
3
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
-
|
|
7
4
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
8
|
-
|
|
9
5
|
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
10
|
-
|
|
11
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
-
|
|
13
7
|
import React, { useContext } from 'react';
|
|
14
8
|
import { Context } from '../context';
|
|
15
9
|
import { useTimes } from '../timeline';
|
|
16
10
|
import { timeStamp } from '../util';
|
|
17
|
-
|
|
18
11
|
function Time() {
|
|
19
12
|
var _useContext = useContext(Context),
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
13
|
+
api = _useContext.api,
|
|
14
|
+
event = _useContext.event,
|
|
15
|
+
isFpsPlay = _useContext.isFpsPlay;
|
|
24
16
|
var _useTimes = useTimes(api, event, isFpsPlay),
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
17
|
+
_useTimes2 = _slicedToArray(_useTimes, 3),
|
|
18
|
+
current = _useTimes2[0],
|
|
19
|
+
duration = _useTimes2[2];
|
|
29
20
|
return /*#__PURE__*/React.createElement("span", {
|
|
30
21
|
className: "video-time-progress"
|
|
31
22
|
}, timeStamp(current), "/", timeStamp(duration || 0));
|
|
32
23
|
}
|
|
33
|
-
|
|
34
24
|
export default Time;
|
|
@@ -1,27 +1,19 @@
|
|
|
1
1
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
-
|
|
3
2
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
-
|
|
5
3
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
-
|
|
7
4
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
8
|
-
|
|
9
5
|
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
10
|
-
|
|
11
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
-
|
|
13
7
|
import { useState } from 'react';
|
|
14
8
|
import { useRegisterPlayerEvents } from '../event';
|
|
15
9
|
import EventName from '../event/eventName';
|
|
16
|
-
|
|
17
10
|
function useBarStatus(event) {
|
|
18
11
|
var _useState = useState({
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
12
|
+
status: 1
|
|
13
|
+
}),
|
|
14
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
15
|
+
state = _useState2[0],
|
|
16
|
+
setState = _useState2[1];
|
|
25
17
|
var show = function show() {
|
|
26
18
|
return setState(function (old) {
|
|
27
19
|
return Object.assign(Object.assign({}, old), {
|
|
@@ -29,7 +21,6 @@ function useBarStatus(event) {
|
|
|
29
21
|
});
|
|
30
22
|
});
|
|
31
23
|
};
|
|
32
|
-
|
|
33
24
|
var hide = function hide() {
|
|
34
25
|
return setState(function (old) {
|
|
35
26
|
return Object.assign(Object.assign({}, old), {
|
|
@@ -37,9 +28,7 @@ function useBarStatus(event) {
|
|
|
37
28
|
});
|
|
38
29
|
});
|
|
39
30
|
};
|
|
40
|
-
|
|
41
31
|
useRegisterPlayerEvents(event, [[EventName.SHOW_CONTRALLER, show], [EventName.HIDE_CONTRALLER, hide]]);
|
|
42
32
|
return state.status;
|
|
43
33
|
}
|
|
44
|
-
|
|
45
34
|
export default useBarStatus;
|