@cloud-app-dev/vidc 4.0.1 → 4.0.3
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/AppContext/index.js +20 -61
- package/es/AutoExit/index.js +5 -9
- package/es/Config/index.js +0 -5
- package/es/Config/utils.js +7 -27
- package/es/ConfigContext/index.d.ts +1 -1
- package/es/ConfigContext/index.js +1 -3
- package/es/CustomRenderSelect/index.js +19 -39
- package/es/DynamicGridList/index.js +16 -28
- package/es/FullScreen/index.js +10 -21
- package/es/GridList/hook.js +36 -67
- package/es/GridList/index.d.ts +1 -1
- package/es/GridList/index.js +1 -1
- package/es/ImageView/index.js +16 -31
- package/es/LabelValue/index.d.ts +0 -8
- package/es/LabelValue/index.js +11 -16
- package/es/List/index.js +5 -7
- package/es/ListWithSizeAnimate/demo.js +3 -15
- package/es/LoaderScript/utils.js +100 -153
- package/es/Map/Config/index.d.ts +4 -2
- package/es/Map/Config/index.js +17 -32
- package/es/Map/Config/utils.d.ts +2 -2
- package/es/Map/Config/utils.js +40 -51
- package/es/Map/InfoWindow/MakerLikeWindow.js +35 -29
- package/es/Map/InfoWindow/demo.js +17 -29
- package/es/Map/interface.d.ts +14 -0
- package/es/Picture/component/Tools/index.js +5 -7
- package/es/Picture/demo.js +15 -19
- package/es/Picture/index.js +70 -104
- package/es/Picture/utils.js +14 -28
- package/es/Player/api/index.js +26 -94
- package/es/Player/contraller_bar/right_bar.js +12 -23
- package/es/Player/demo.js +47 -62
- package/es/Player/event/errorEvent.js +15 -40
- package/es/Player/fps_play.js +12 -28
- package/es/Player/frontend_timeline.js +28 -48
- package/es/Player/player.d.ts +2 -1
- package/es/Player/segment_timeline.js +45 -69
- package/es/Player/single_player.js +101 -109
- package/es/Player/util.js +8 -27
- package/es/Progress/index.js +5 -16
- package/es/ROI/index.d.ts +0 -6
- package/es/ROI/index.js +17 -26
- package/es/RefDrawer/Footer.js +3 -5
- package/es/RefDrawer/demo.js +0 -3
- package/es/RefDrawer/index.js +17 -27
- package/es/RefModal/demo.js +0 -3
- package/es/RefModal/index.js +27 -27
- package/es/ScreenPlayer/Live.d.ts +1 -1
- package/es/ScreenPlayer/Live.js +36 -70
- package/es/ScreenPlayer/LiveTools.js +20 -39
- package/es/ScreenPlayer/PlayerWithExt.js +48 -85
- package/es/ScreenPlayer/RecordTools.d.ts +1 -1
- package/es/ScreenPlayer/RecordTools.js +27 -53
- package/es/ScreenPlayer/SegmentTimeLine.js +8 -13
- package/es/ScreenPlayer/TimeSelect.js +9 -24
- package/es/ScreenPlayer/demo.js +1 -1
- package/es/ScreenPlayer/demo2.js +76 -108
- package/es/ScreenPlayer/useTimeSlider.js +63 -141
- package/es/Service/http.js +14 -34
- package/es/TableLayout/index.js +6 -10
- package/es/ThemeAntd/index.js +0 -1
- package/es/Timeout/index.js +16 -31
- package/es/VList/index.d.ts +1 -9
- package/es/VList/index.js +18 -30
- package/es/typings.d.ts +1 -0
- package/es/useDrawROI/index.js +61 -115
- package/es/useInfiniteScroll/index.js +24 -45
- package/es/utils.js +18 -42
- package/package.json +4 -5
- package/es/ROI/utils.d.ts +0 -1
- package/es/ROI/utils.js +0 -1
- package/es/ThemeAntd/demo.html +0 -32
package/es/Player/api/index.js
CHANGED
|
@@ -1,152 +1,110 @@
|
|
|
1
1
|
import _nextTick from "@cloud-app-dev/utils/es/nextTick";
|
|
2
2
|
import _useMemoizedFn from "ahooks/es/useMemoizedFn";
|
|
3
|
-
|
|
3
|
+
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); }
|
|
4
4
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
|
-
|
|
6
5
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
7
|
-
|
|
8
6
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
9
|
-
|
|
10
7
|
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."); }
|
|
11
|
-
|
|
12
8
|
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); }
|
|
13
|
-
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
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; }
|
|
17
|
-
|
|
9
|
+
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
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
18
11
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
19
|
-
|
|
20
12
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
21
|
-
|
|
22
|
-
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); } }
|
|
23
|
-
|
|
13
|
+
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, _toPropertyKey(descriptor.key), descriptor); } }
|
|
24
14
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
25
|
-
|
|
26
|
-
function
|
|
27
|
-
|
|
15
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
16
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
17
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
28
18
|
import { useEffect, useMemo, useState } from 'react';
|
|
29
19
|
import { tryCatch } from "../../utils";
|
|
30
20
|
import { createFlvPlayer, createHlsPlayer } from "../util";
|
|
31
|
-
|
|
32
21
|
var Api = /*#__PURE__*/function () {
|
|
33
22
|
function Api(container) {
|
|
34
23
|
var _this = this;
|
|
35
|
-
|
|
36
24
|
_classCallCheck(this, Api);
|
|
37
|
-
|
|
38
25
|
_defineProperty(this, "container", void 0);
|
|
39
|
-
|
|
40
26
|
_defineProperty(this, "play", function () {
|
|
41
27
|
tryCatch(function () {
|
|
42
28
|
var _this$video;
|
|
43
|
-
|
|
44
29
|
return (_this$video = _this.video) === null || _this$video === void 0 ? void 0 : _this$video.play();
|
|
45
30
|
});
|
|
46
31
|
});
|
|
47
|
-
|
|
48
32
|
_defineProperty(this, "pause", function () {
|
|
49
33
|
var _this$video2;
|
|
50
|
-
|
|
51
34
|
(_this$video2 = _this.video) === null || _this$video2 === void 0 ? void 0 : _this$video2.pause();
|
|
52
35
|
});
|
|
53
|
-
|
|
54
36
|
_defineProperty(this, "seekTo", function (seconds) {
|
|
55
37
|
if (_this.video) {
|
|
56
38
|
_this.video.currentTime = seconds;
|
|
57
39
|
}
|
|
58
40
|
});
|
|
59
|
-
|
|
60
41
|
_defineProperty(this, "setVolume", function (fraction) {
|
|
61
42
|
if (_this.video) {
|
|
62
43
|
_this.video.volume = fraction;
|
|
63
44
|
}
|
|
64
45
|
});
|
|
65
|
-
|
|
66
46
|
_defineProperty(this, "getVolume", function () {
|
|
67
47
|
var _this$video3;
|
|
68
|
-
|
|
69
48
|
return (_this$video3 = _this.video) === null || _this$video3 === void 0 ? void 0 : _this$video3.volume;
|
|
70
49
|
});
|
|
71
|
-
|
|
72
50
|
_defineProperty(this, "mute", function () {
|
|
73
51
|
if (_this.video) {
|
|
74
52
|
_this.video.muted = true;
|
|
75
53
|
}
|
|
76
54
|
});
|
|
77
|
-
|
|
78
55
|
_defineProperty(this, "unmute", function () {
|
|
79
56
|
if (_this.video) {
|
|
80
57
|
_this.video.muted = false;
|
|
81
58
|
}
|
|
82
59
|
});
|
|
83
|
-
|
|
84
60
|
_defineProperty(this, "requestPictureInPicture", function () {
|
|
85
61
|
var _this$video4;
|
|
86
|
-
|
|
87
62
|
(_this$video4 = _this.video) === null || _this$video4 === void 0 ? void 0 : _this$video4.requestPictureInPicture();
|
|
88
63
|
});
|
|
89
|
-
|
|
90
64
|
_defineProperty(this, "exitPictureInPicture", function () {
|
|
91
65
|
if (document.exitPictureInPicture && document.pictureInPictureElement === _this.video) {
|
|
92
66
|
document.exitPictureInPicture();
|
|
93
67
|
}
|
|
94
68
|
});
|
|
95
|
-
|
|
96
69
|
_defineProperty(this, "setPlaybackRate", function (rate) {
|
|
97
70
|
if (_this.video) {
|
|
98
71
|
_this.video.playbackRate = rate;
|
|
99
72
|
}
|
|
100
73
|
});
|
|
101
|
-
|
|
102
74
|
_defineProperty(this, "getDuration", function () {
|
|
103
75
|
var _ref = _this.video || {},
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
76
|
+
duration = _ref.duration,
|
|
77
|
+
seekable = _ref.seekable;
|
|
107
78
|
if (duration === Infinity && seekable && seekable.length > 0) {
|
|
108
79
|
return seekable.end(seekable.length - 1);
|
|
109
80
|
}
|
|
110
|
-
|
|
111
81
|
return duration !== null && duration !== void 0 ? duration : 0;
|
|
112
82
|
});
|
|
113
|
-
|
|
114
83
|
_defineProperty(this, "getCurrentTime", function () {
|
|
115
84
|
var _this$video$currentTi, _this$video5;
|
|
116
|
-
|
|
117
85
|
return (_this$video$currentTi = (_this$video5 = _this.video) === null || _this$video5 === void 0 ? void 0 : _this$video5.currentTime) !== null && _this$video$currentTi !== void 0 ? _this$video$currentTi : 0;
|
|
118
86
|
});
|
|
119
|
-
|
|
120
87
|
_defineProperty(this, "getSecondsLoaded", function () {
|
|
121
88
|
var _this$getBufferedTime;
|
|
122
|
-
|
|
123
89
|
return (_this$getBufferedTime = _this.getBufferedTime()[1]) !== null && _this$getBufferedTime !== void 0 ? _this$getBufferedTime : 0;
|
|
124
90
|
});
|
|
125
|
-
|
|
126
91
|
_defineProperty(this, "getBufferedTime", function () {
|
|
127
92
|
var _buffered$end, _buffered$start, _this$getDuration;
|
|
128
|
-
|
|
129
93
|
var _ref2 = _this.video || {},
|
|
130
|
-
|
|
131
|
-
|
|
94
|
+
buffered = _ref2.buffered;
|
|
132
95
|
if (buffered && buffered.length === 0) {
|
|
133
96
|
return [0, 0];
|
|
134
97
|
}
|
|
135
|
-
|
|
136
98
|
var end = (_buffered$end = buffered === null || buffered === void 0 ? void 0 : buffered.end(buffered.length - 1)) !== null && _buffered$end !== void 0 ? _buffered$end : 0;
|
|
137
99
|
var start = (_buffered$start = buffered === null || buffered === void 0 ? void 0 : buffered.start(buffered.length - 1)) !== null && _buffered$start !== void 0 ? _buffered$start : 0;
|
|
138
100
|
var duration = (_this$getDuration = _this.getDuration()) !== null && _this$getDuration !== void 0 ? _this$getDuration : 0;
|
|
139
|
-
|
|
140
101
|
if (end > duration) {
|
|
141
102
|
return [start, duration];
|
|
142
103
|
}
|
|
143
|
-
|
|
144
104
|
return [start, end];
|
|
145
105
|
});
|
|
146
|
-
|
|
147
106
|
_defineProperty(this, "snapshot", function () {
|
|
148
107
|
var _this$video$videoWidt, _this$video6, _this$video$videoHeig, _this$video7, _ctx;
|
|
149
|
-
|
|
150
108
|
var canvas = document.createElement('canvas');
|
|
151
109
|
var ctx = canvas.getContext('2d');
|
|
152
110
|
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;
|
|
@@ -159,24 +117,16 @@ var Api = /*#__PURE__*/function () {
|
|
|
159
117
|
}, 200);
|
|
160
118
|
return canvas.toDataURL();
|
|
161
119
|
});
|
|
162
|
-
|
|
163
120
|
_defineProperty(this, "unload", function () {});
|
|
164
|
-
|
|
165
121
|
_defineProperty(this, "reload", function () {});
|
|
166
|
-
|
|
167
122
|
_defineProperty(this, "toggleFit", function () {});
|
|
168
|
-
|
|
169
123
|
_defineProperty(this, "openFpsPlay", function () {});
|
|
170
|
-
|
|
171
124
|
_defineProperty(this, "closeFpsPlay", function () {});
|
|
172
|
-
|
|
173
125
|
_defineProperty(this, "destroy", function () {
|
|
174
126
|
_this.container = null;
|
|
175
127
|
});
|
|
176
|
-
|
|
177
128
|
this.container = container;
|
|
178
129
|
}
|
|
179
|
-
|
|
180
130
|
_createClass(Api, [{
|
|
181
131
|
key: "video",
|
|
182
132
|
get: function get() {
|
|
@@ -186,64 +136,53 @@ var Api = /*#__PURE__*/function () {
|
|
|
186
136
|
key: "paused",
|
|
187
137
|
get: function get() {
|
|
188
138
|
var _this$video8;
|
|
189
|
-
|
|
190
139
|
return (_this$video8 = this.video) === null || _this$video8 === void 0 ? void 0 : _this$video8.paused;
|
|
191
140
|
}
|
|
192
141
|
}, {
|
|
193
142
|
key: "muted",
|
|
194
143
|
get: function get() {
|
|
195
144
|
var _this$video9;
|
|
196
|
-
|
|
197
145
|
return (_this$video9 = this.video) === null || _this$video9 === void 0 ? void 0 : _this$video9.muted;
|
|
198
146
|
}
|
|
147
|
+
|
|
199
148
|
/**
|
|
200
149
|
* 设置currentTime实现seek
|
|
201
150
|
* @param {*} seconds
|
|
202
151
|
*/
|
|
203
|
-
|
|
204
152
|
}]);
|
|
205
|
-
|
|
206
153
|
return Api;
|
|
207
154
|
}();
|
|
208
|
-
|
|
209
155
|
// 创建播放介质
|
|
210
156
|
export function useTypeAndPlay(url, type, isLive, container, segments, flvConfig, hlsConfig) {
|
|
211
157
|
var _useState = useState({
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
158
|
+
type: '',
|
|
159
|
+
flv: undefined,
|
|
160
|
+
hls: undefined
|
|
161
|
+
}),
|
|
162
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
163
|
+
state = _useState2[0],
|
|
164
|
+
setState = _useState2[1];
|
|
220
165
|
useEffect(function () {
|
|
221
166
|
var isReady = container && (url || type === 'flv' && segments);
|
|
222
|
-
|
|
223
167
|
if (!isReady) {
|
|
224
168
|
return undefined;
|
|
225
169
|
}
|
|
226
|
-
|
|
227
170
|
var video = container.querySelector('video');
|
|
228
171
|
var options = {};
|
|
229
|
-
|
|
230
172
|
switch (type) {
|
|
231
173
|
case 'flv':
|
|
232
174
|
options.type = 'flv';
|
|
233
175
|
options.flv = createFlvPlayer(video, url, isLive, flvConfig);
|
|
234
176
|
break;
|
|
235
|
-
|
|
236
177
|
case 'hls':
|
|
237
178
|
options.type = 'hls';
|
|
238
179
|
options.hls = createHlsPlayer(video, url, isLive, hlsConfig);
|
|
239
180
|
break;
|
|
240
|
-
|
|
241
181
|
default:
|
|
242
182
|
options.type = 'native';
|
|
243
183
|
video === null || video === void 0 ? void 0 : video.setAttribute('src', url !== null && url !== void 0 ? url : '');
|
|
244
184
|
break;
|
|
245
185
|
}
|
|
246
|
-
|
|
247
186
|
(video === null || video === void 0 ? void 0 : video.paused) && tryCatch(function () {
|
|
248
187
|
return video === null || video === void 0 ? void 0 : video.play();
|
|
249
188
|
});
|
|
@@ -253,38 +192,34 @@ export function useTypeAndPlay(url, type, isLive, container, segments, flvConfig
|
|
|
253
192
|
options.flv.pause();
|
|
254
193
|
tryCatch(function () {
|
|
255
194
|
var _options$flv;
|
|
256
|
-
|
|
257
195
|
return (_options$flv = options.flv) === null || _options$flv === void 0 ? void 0 : _options$flv.destroy();
|
|
258
196
|
});
|
|
259
197
|
} else if (options.hls) {
|
|
260
198
|
video === null || video === void 0 ? void 0 : video.pause();
|
|
261
199
|
tryCatch(function () {
|
|
262
200
|
var _options$hls;
|
|
263
|
-
|
|
264
201
|
return (_options$hls = options.hls) === null || _options$hls === void 0 ? void 0 : _options$hls.destroy();
|
|
265
202
|
});
|
|
266
203
|
} else {
|
|
267
204
|
video === null || video === void 0 ? void 0 : video.pause();
|
|
268
205
|
video === null || video === void 0 ? void 0 : video.removeAttribute('src');
|
|
269
206
|
}
|
|
270
|
-
|
|
271
207
|
setState({});
|
|
272
208
|
};
|
|
273
209
|
}, [url, container, segments, type, isLive, flvConfig, hlsConfig]);
|
|
274
210
|
return [state.type, state.flv, state.hls];
|
|
275
|
-
}
|
|
211
|
+
}
|
|
276
212
|
|
|
213
|
+
//创建Api
|
|
277
214
|
export function usePlayerApi(url, type, isLive, container, segments, flvConfig, hlsConfig) {
|
|
278
215
|
var _useState3 = useState(undefined),
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
216
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
217
|
+
api = _useState4[0],
|
|
218
|
+
setApi = _useState4[1];
|
|
283
219
|
var _useState5 = useState(Date.now()),
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
220
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
221
|
+
forceKey = _useState6[0],
|
|
222
|
+
setForceKey = _useState6[1];
|
|
288
223
|
var config = useMemo(function () {
|
|
289
224
|
return {
|
|
290
225
|
flvConfig: _objectSpread({}, flvConfig),
|
|
@@ -292,17 +227,14 @@ export function usePlayerApi(url, type, isLive, container, segments, flvConfig,
|
|
|
292
227
|
};
|
|
293
228
|
}, [forceKey]);
|
|
294
229
|
var typePlay = useTypeAndPlay(url, type, isLive, container, segments, config.flvConfig, config.hlsConfig);
|
|
295
|
-
|
|
296
230
|
var rePlay = _useMemoizedFn(function () {
|
|
297
231
|
return setForceKey(Date.now());
|
|
298
232
|
});
|
|
299
|
-
|
|
300
233
|
useEffect(function () {
|
|
301
234
|
if (!container) {
|
|
302
235
|
console.debug('wait create api...');
|
|
303
236
|
return undefined;
|
|
304
237
|
}
|
|
305
|
-
|
|
306
238
|
var api = new Api(container);
|
|
307
239
|
setApi(api);
|
|
308
240
|
return function () {
|
|
@@ -1,37 +1,27 @@
|
|
|
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
|
-
function
|
|
8
|
-
|
|
9
|
-
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
|
-
|
|
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; }
|
|
5
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
11
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
-
|
|
13
7
|
import React, { useContext } from 'react';
|
|
14
|
-
import IconFont from "../iconfont";
|
|
15
|
-
import Bar from "./bar";
|
|
16
8
|
import useFullscreen from "../../useFullscreen";
|
|
17
9
|
import { Context } from "../context";
|
|
10
|
+
import IconFont from "../iconfont";
|
|
11
|
+
import Bar from "./bar";
|
|
18
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
13
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
|
-
|
|
21
14
|
function RightBar(_ref) {
|
|
22
15
|
var rightExtContents = _ref.rightExtContents,
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
rightMidExtContents = _ref.rightMidExtContents;
|
|
25
17
|
var _useContext = useContext(Context),
|
|
26
|
-
|
|
27
|
-
|
|
18
|
+
container = _useContext.container;
|
|
28
19
|
var _useFullscreen = useFullscreen(container),
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
20
|
+
_useFullscreen2 = _slicedToArray(_useFullscreen, 2),
|
|
21
|
+
isFullScreen = _useFullscreen2[0],
|
|
22
|
+
_useFullscreen2$ = _useFullscreen2[1],
|
|
23
|
+
enterFullscreen = _useFullscreen2$.enterFullscreen,
|
|
24
|
+
exitFullscreen = _useFullscreen2$.exitFullscreen;
|
|
35
25
|
var fullscreen = isFullScreen ? exitFullscreen : enterFullscreen;
|
|
36
26
|
return /*#__PURE__*/_jsxs("div", {
|
|
37
27
|
className: "contraller-right-bar",
|
|
@@ -39,10 +29,9 @@ function RightBar(_ref) {
|
|
|
39
29
|
children: /*#__PURE__*/_jsx(IconFont, {
|
|
40
30
|
title: isFullScreen ? '窗口' : '全屏',
|
|
41
31
|
onClick: fullscreen,
|
|
42
|
-
type: isFullScreen ? 'lm-player-
|
|
32
|
+
type: isFullScreen ? 'lm-player-S_View_ScreenViewExit' : 'lm-player-S_View_ScreenViewFull'
|
|
43
33
|
})
|
|
44
34
|
}), rightExtContents]
|
|
45
35
|
});
|
|
46
36
|
}
|
|
47
|
-
|
|
48
37
|
export default RightBar;
|
package/es/Player/demo.js
CHANGED
|
@@ -1,21 +1,15 @@
|
|
|
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); }
|
|
1
2
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
-
|
|
3
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
-
|
|
5
|
-
function
|
|
6
|
-
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
7
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
-
|
|
9
8
|
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."); }
|
|
10
|
-
|
|
11
9
|
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); }
|
|
12
|
-
|
|
13
|
-
function
|
|
14
|
-
|
|
15
|
-
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; }
|
|
16
|
-
|
|
10
|
+
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
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
17
12
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
18
|
-
|
|
19
13
|
import { Button, ConfigProvider, Input, Select } from 'antd';
|
|
20
14
|
import moment from 'dayjs';
|
|
21
15
|
import React, { useState } from 'react';
|
|
@@ -42,18 +36,16 @@ var options2 = [{
|
|
|
42
36
|
value: 0,
|
|
43
37
|
label: '录像'
|
|
44
38
|
}];
|
|
45
|
-
|
|
46
39
|
function Demo1() {
|
|
47
40
|
var _useState = useState({
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
41
|
+
type: undefined,
|
|
42
|
+
isLive: 1,
|
|
43
|
+
url: 'http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4',
|
|
44
|
+
tempUrl: ''
|
|
45
|
+
}),
|
|
46
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
47
|
+
state = _useState2[0],
|
|
48
|
+
setState = _useState2[1];
|
|
57
49
|
return /*#__PURE__*/_jsxs("div", {
|
|
58
50
|
style: {
|
|
59
51
|
width: '100%'
|
|
@@ -133,38 +125,35 @@ function Demo1() {
|
|
|
133
125
|
})]
|
|
134
126
|
});
|
|
135
127
|
}
|
|
136
|
-
|
|
137
128
|
var mm = moment().set('hours', 0).set('minutes', 0).set('seconds', 0);
|
|
138
129
|
var m = mm.clone();
|
|
139
|
-
|
|
140
130
|
function Demo2() {
|
|
141
131
|
var _useState3 = useState({
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
132
|
+
isLive: 1,
|
|
133
|
+
segments: [{
|
|
134
|
+
beginTime: m.valueOf(),
|
|
135
|
+
endTime: m.set('minutes', 1).valueOf(),
|
|
136
|
+
url: 'http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4'
|
|
137
|
+
}, {
|
|
138
|
+
beginTime: m.set('minutes', 1).valueOf(),
|
|
139
|
+
endTime: m.set('minutes', 2).valueOf()
|
|
140
|
+
}, {
|
|
141
|
+
beginTime: m.set('minutes', 2).valueOf(),
|
|
142
|
+
endTime: m.set('minutes', 3).valueOf(),
|
|
143
|
+
url: 'http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4?date=1'
|
|
144
|
+
}, {
|
|
145
|
+
beginTime: m.set('minutes', 3).valueOf(),
|
|
146
|
+
endTime: m.set('minutes', 4).valueOf()
|
|
147
|
+
}, {
|
|
148
|
+
beginTime: m.set('minutes', 4).valueOf(),
|
|
149
|
+
endTime: m.set('minutes', 5).valueOf(),
|
|
150
|
+
url: 'http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4?date=2'
|
|
151
|
+
}],
|
|
152
|
+
tempUrl: ''
|
|
153
|
+
}),
|
|
154
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
155
|
+
state = _useState4[0],
|
|
156
|
+
setState = _useState4[1];
|
|
168
157
|
return /*#__PURE__*/_jsxs("div", {
|
|
169
158
|
style: {
|
|
170
159
|
width: '100%',
|
|
@@ -213,18 +202,16 @@ function Demo2() {
|
|
|
213
202
|
})]
|
|
214
203
|
});
|
|
215
204
|
}
|
|
216
|
-
|
|
217
205
|
function Demo3() {
|
|
218
206
|
var _useState5 = useState({
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
207
|
+
url: 'http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4',
|
|
208
|
+
tempUrl: '',
|
|
209
|
+
begin: 1652889636000,
|
|
210
|
+
end: 1652890200000
|
|
211
|
+
}),
|
|
212
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
213
|
+
state = _useState6[0],
|
|
214
|
+
setState = _useState6[1];
|
|
228
215
|
return /*#__PURE__*/_jsxs("div", {
|
|
229
216
|
style: {
|
|
230
217
|
width: '600px',
|
|
@@ -281,12 +268,10 @@ function Demo3() {
|
|
|
281
268
|
})]
|
|
282
269
|
});
|
|
283
270
|
}
|
|
284
|
-
|
|
285
271
|
var App = function App() {
|
|
286
272
|
return /*#__PURE__*/_jsxs(ConfigProvider, {
|
|
287
273
|
prefixCls: "cloudapp",
|
|
288
274
|
children: [/*#__PURE__*/_jsx(Demo1, {}), /*#__PURE__*/_jsx(Demo2, {}), /*#__PURE__*/_jsx(Demo3, {})]
|
|
289
275
|
});
|
|
290
276
|
};
|
|
291
|
-
|
|
292
277
|
export default App;
|