@cloud-app-dev/vidc 4.0.0 → 4.0.2
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 -22
- 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/InfoWindow/MakerLikeWindow.js +35 -29
- package/es/Map/InfoWindow/demo.js +17 -29
- 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.d.ts +4 -4
- package/es/Player/api/index.js +47 -92
- package/es/Player/contraller_bar/right_bar.js +12 -23
- package/es/Player/demo.js +47 -62
- package/es/Player/event/errorEvent.d.ts +1 -1
- package/es/Player/event/errorEvent.js +16 -41
- package/es/Player/fps_play.js +15 -33
- package/es/Player/frontend_timeline.js +28 -48
- package/es/Player/player.d.ts +3 -2
- package/es/Player/segment_timeline.js +45 -69
- package/es/Player/single_player.js +111 -117
- package/es/Player/util.d.ts +1 -1
- package/es/Player/util.js +9 -28
- 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 +3 -2
- 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/index.d.ts +0 -1
- package/es/index.js +0 -1
- 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 +5 -6
- package/es/LoaderApp/index.d.ts +0 -31
- package/es/LoaderApp/index.js +0 -138
- package/es/LoaderApp/index.less +0 -3
- package/es/LoaderApp/interface.d.ts +0 -9
- package/es/LoaderApp/loader.d.ts +0 -19
- package/es/LoaderApp/loader.js +0 -85
- package/es/LoaderApp/sandbox.back.d.ts +0 -18
- package/es/LoaderApp/sandbox.back.js +0 -368
- package/es/LoaderApp/sandbox.d.ts +0 -12
- package/es/LoaderApp/sandbox.js +0 -113
- package/es/LoaderApp/utils.d.ts +0 -19
- package/es/LoaderApp/utils.js +0 -275
- package/es/ROI/utils.d.ts +0 -1
- package/es/ROI/utils.js +0 -1
package/es/Player/api/index.js
CHANGED
|
@@ -1,145 +1,110 @@
|
|
|
1
1
|
import _nextTick from "@cloud-app-dev/utils/es/nextTick";
|
|
2
|
-
|
|
2
|
+
import _useMemoizedFn from "ahooks/es/useMemoizedFn";
|
|
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
|
+
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
|
+
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; }
|
|
3
6
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
-
|
|
5
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."); }
|
|
6
|
-
|
|
7
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); }
|
|
8
|
-
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
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
|
-
|
|
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; } }
|
|
13
11
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
|
-
|
|
15
12
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
16
|
-
|
|
17
|
-
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
|
-
|
|
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); } }
|
|
19
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; }
|
|
20
|
-
|
|
21
|
-
function
|
|
22
|
-
|
|
23
|
-
import { useEffect, useState } from 'react';
|
|
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); }
|
|
18
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
24
19
|
import { tryCatch } from "../../utils";
|
|
25
20
|
import { createFlvPlayer, createHlsPlayer } from "../util";
|
|
26
|
-
|
|
27
21
|
var Api = /*#__PURE__*/function () {
|
|
28
22
|
function Api(container) {
|
|
29
23
|
var _this = this;
|
|
30
|
-
|
|
31
24
|
_classCallCheck(this, Api);
|
|
32
|
-
|
|
33
25
|
_defineProperty(this, "container", void 0);
|
|
34
|
-
|
|
35
26
|
_defineProperty(this, "play", function () {
|
|
36
27
|
tryCatch(function () {
|
|
37
28
|
var _this$video;
|
|
38
|
-
|
|
39
29
|
return (_this$video = _this.video) === null || _this$video === void 0 ? void 0 : _this$video.play();
|
|
40
30
|
});
|
|
41
31
|
});
|
|
42
|
-
|
|
43
32
|
_defineProperty(this, "pause", function () {
|
|
44
33
|
var _this$video2;
|
|
45
|
-
|
|
46
34
|
(_this$video2 = _this.video) === null || _this$video2 === void 0 ? void 0 : _this$video2.pause();
|
|
47
35
|
});
|
|
48
|
-
|
|
49
36
|
_defineProperty(this, "seekTo", function (seconds) {
|
|
50
37
|
if (_this.video) {
|
|
51
38
|
_this.video.currentTime = seconds;
|
|
52
39
|
}
|
|
53
40
|
});
|
|
54
|
-
|
|
55
41
|
_defineProperty(this, "setVolume", function (fraction) {
|
|
56
42
|
if (_this.video) {
|
|
57
43
|
_this.video.volume = fraction;
|
|
58
44
|
}
|
|
59
45
|
});
|
|
60
|
-
|
|
61
46
|
_defineProperty(this, "getVolume", function () {
|
|
62
47
|
var _this$video3;
|
|
63
|
-
|
|
64
48
|
return (_this$video3 = _this.video) === null || _this$video3 === void 0 ? void 0 : _this$video3.volume;
|
|
65
49
|
});
|
|
66
|
-
|
|
67
50
|
_defineProperty(this, "mute", function () {
|
|
68
51
|
if (_this.video) {
|
|
69
52
|
_this.video.muted = true;
|
|
70
53
|
}
|
|
71
54
|
});
|
|
72
|
-
|
|
73
55
|
_defineProperty(this, "unmute", function () {
|
|
74
56
|
if (_this.video) {
|
|
75
57
|
_this.video.muted = false;
|
|
76
58
|
}
|
|
77
59
|
});
|
|
78
|
-
|
|
79
60
|
_defineProperty(this, "requestPictureInPicture", function () {
|
|
80
61
|
var _this$video4;
|
|
81
|
-
|
|
82
62
|
(_this$video4 = _this.video) === null || _this$video4 === void 0 ? void 0 : _this$video4.requestPictureInPicture();
|
|
83
63
|
});
|
|
84
|
-
|
|
85
64
|
_defineProperty(this, "exitPictureInPicture", function () {
|
|
86
65
|
if (document.exitPictureInPicture && document.pictureInPictureElement === _this.video) {
|
|
87
66
|
document.exitPictureInPicture();
|
|
88
67
|
}
|
|
89
68
|
});
|
|
90
|
-
|
|
91
69
|
_defineProperty(this, "setPlaybackRate", function (rate) {
|
|
92
70
|
if (_this.video) {
|
|
93
71
|
_this.video.playbackRate = rate;
|
|
94
72
|
}
|
|
95
73
|
});
|
|
96
|
-
|
|
97
74
|
_defineProperty(this, "getDuration", function () {
|
|
98
75
|
var _ref = _this.video || {},
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
76
|
+
duration = _ref.duration,
|
|
77
|
+
seekable = _ref.seekable;
|
|
102
78
|
if (duration === Infinity && seekable && seekable.length > 0) {
|
|
103
79
|
return seekable.end(seekable.length - 1);
|
|
104
80
|
}
|
|
105
|
-
|
|
106
|
-
return duration;
|
|
81
|
+
return duration !== null && duration !== void 0 ? duration : 0;
|
|
107
82
|
});
|
|
108
|
-
|
|
109
83
|
_defineProperty(this, "getCurrentTime", function () {
|
|
110
|
-
var _this$video5;
|
|
111
|
-
|
|
112
|
-
return (_this$video5 = _this.video) === null || _this$video5 === void 0 ? void 0 : _this$video5.currentTime;
|
|
84
|
+
var _this$video$currentTi, _this$video5;
|
|
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;
|
|
113
86
|
});
|
|
114
|
-
|
|
115
87
|
_defineProperty(this, "getSecondsLoaded", function () {
|
|
116
|
-
|
|
88
|
+
var _this$getBufferedTime;
|
|
89
|
+
return (_this$getBufferedTime = _this.getBufferedTime()[1]) !== null && _this$getBufferedTime !== void 0 ? _this$getBufferedTime : 0;
|
|
117
90
|
});
|
|
118
|
-
|
|
119
91
|
_defineProperty(this, "getBufferedTime", function () {
|
|
120
92
|
var _buffered$end, _buffered$start, _this$getDuration;
|
|
121
|
-
|
|
122
93
|
var _ref2 = _this.video || {},
|
|
123
|
-
|
|
124
|
-
|
|
94
|
+
buffered = _ref2.buffered;
|
|
125
95
|
if (buffered && buffered.length === 0) {
|
|
126
96
|
return [0, 0];
|
|
127
97
|
}
|
|
128
|
-
|
|
129
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;
|
|
130
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;
|
|
131
100
|
var duration = (_this$getDuration = _this.getDuration()) !== null && _this$getDuration !== void 0 ? _this$getDuration : 0;
|
|
132
|
-
|
|
133
101
|
if (end > duration) {
|
|
134
102
|
return [start, duration];
|
|
135
103
|
}
|
|
136
|
-
|
|
137
104
|
return [start, end];
|
|
138
105
|
});
|
|
139
|
-
|
|
140
106
|
_defineProperty(this, "snapshot", function () {
|
|
141
107
|
var _this$video$videoWidt, _this$video6, _this$video$videoHeig, _this$video7, _ctx;
|
|
142
|
-
|
|
143
108
|
var canvas = document.createElement('canvas');
|
|
144
109
|
var ctx = canvas.getContext('2d');
|
|
145
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;
|
|
@@ -152,24 +117,16 @@ var Api = /*#__PURE__*/function () {
|
|
|
152
117
|
}, 200);
|
|
153
118
|
return canvas.toDataURL();
|
|
154
119
|
});
|
|
155
|
-
|
|
156
120
|
_defineProperty(this, "unload", function () {});
|
|
157
|
-
|
|
158
121
|
_defineProperty(this, "reload", function () {});
|
|
159
|
-
|
|
160
122
|
_defineProperty(this, "toggleFit", function () {});
|
|
161
|
-
|
|
162
123
|
_defineProperty(this, "openFpsPlay", function () {});
|
|
163
|
-
|
|
164
124
|
_defineProperty(this, "closeFpsPlay", function () {});
|
|
165
|
-
|
|
166
125
|
_defineProperty(this, "destroy", function () {
|
|
167
126
|
_this.container = null;
|
|
168
127
|
});
|
|
169
|
-
|
|
170
128
|
this.container = container;
|
|
171
129
|
}
|
|
172
|
-
|
|
173
130
|
_createClass(Api, [{
|
|
174
131
|
key: "video",
|
|
175
132
|
get: function get() {
|
|
@@ -179,64 +136,53 @@ var Api = /*#__PURE__*/function () {
|
|
|
179
136
|
key: "paused",
|
|
180
137
|
get: function get() {
|
|
181
138
|
var _this$video8;
|
|
182
|
-
|
|
183
139
|
return (_this$video8 = this.video) === null || _this$video8 === void 0 ? void 0 : _this$video8.paused;
|
|
184
140
|
}
|
|
185
141
|
}, {
|
|
186
142
|
key: "muted",
|
|
187
143
|
get: function get() {
|
|
188
144
|
var _this$video9;
|
|
189
|
-
|
|
190
145
|
return (_this$video9 = this.video) === null || _this$video9 === void 0 ? void 0 : _this$video9.muted;
|
|
191
146
|
}
|
|
147
|
+
|
|
192
148
|
/**
|
|
193
149
|
* 设置currentTime实现seek
|
|
194
150
|
* @param {*} seconds
|
|
195
151
|
*/
|
|
196
|
-
|
|
197
152
|
}]);
|
|
198
|
-
|
|
199
153
|
return Api;
|
|
200
154
|
}();
|
|
201
|
-
|
|
202
155
|
// 创建播放介质
|
|
203
156
|
export function useTypeAndPlay(url, type, isLive, container, segments, flvConfig, hlsConfig) {
|
|
204
157
|
var _useState = useState({
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
158
|
+
type: '',
|
|
159
|
+
flv: undefined,
|
|
160
|
+
hls: undefined
|
|
161
|
+
}),
|
|
162
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
163
|
+
state = _useState2[0],
|
|
164
|
+
setState = _useState2[1];
|
|
213
165
|
useEffect(function () {
|
|
214
166
|
var isReady = container && (url || type === 'flv' && segments);
|
|
215
|
-
|
|
216
167
|
if (!isReady) {
|
|
217
168
|
return undefined;
|
|
218
169
|
}
|
|
219
|
-
|
|
220
170
|
var video = container.querySelector('video');
|
|
221
171
|
var options = {};
|
|
222
|
-
|
|
223
172
|
switch (type) {
|
|
224
173
|
case 'flv':
|
|
225
174
|
options.type = 'flv';
|
|
226
175
|
options.flv = createFlvPlayer(video, url, isLive, flvConfig);
|
|
227
176
|
break;
|
|
228
|
-
|
|
229
177
|
case 'hls':
|
|
230
178
|
options.type = 'hls';
|
|
231
179
|
options.hls = createHlsPlayer(video, url, isLive, hlsConfig);
|
|
232
180
|
break;
|
|
233
|
-
|
|
234
181
|
default:
|
|
235
182
|
options.type = 'native';
|
|
236
183
|
video === null || video === void 0 ? void 0 : video.setAttribute('src', url !== null && url !== void 0 ? url : '');
|
|
237
184
|
break;
|
|
238
185
|
}
|
|
239
|
-
|
|
240
186
|
(video === null || video === void 0 ? void 0 : video.paused) && tryCatch(function () {
|
|
241
187
|
return video === null || video === void 0 ? void 0 : video.play();
|
|
242
188
|
});
|
|
@@ -246,40 +192,49 @@ export function useTypeAndPlay(url, type, isLive, container, segments, flvConfig
|
|
|
246
192
|
options.flv.pause();
|
|
247
193
|
tryCatch(function () {
|
|
248
194
|
var _options$flv;
|
|
249
|
-
|
|
250
195
|
return (_options$flv = options.flv) === null || _options$flv === void 0 ? void 0 : _options$flv.destroy();
|
|
251
196
|
});
|
|
252
197
|
} else if (options.hls) {
|
|
253
198
|
video === null || video === void 0 ? void 0 : video.pause();
|
|
254
199
|
tryCatch(function () {
|
|
255
200
|
var _options$hls;
|
|
256
|
-
|
|
257
201
|
return (_options$hls = options.hls) === null || _options$hls === void 0 ? void 0 : _options$hls.destroy();
|
|
258
202
|
});
|
|
259
203
|
} else {
|
|
260
204
|
video === null || video === void 0 ? void 0 : video.pause();
|
|
261
205
|
video === null || video === void 0 ? void 0 : video.removeAttribute('src');
|
|
262
206
|
}
|
|
263
|
-
|
|
264
207
|
setState({});
|
|
265
208
|
};
|
|
266
209
|
}, [url, container, segments, type, isLive, flvConfig, hlsConfig]);
|
|
267
210
|
return [state.type, state.flv, state.hls];
|
|
268
|
-
}
|
|
211
|
+
}
|
|
269
212
|
|
|
213
|
+
//创建Api
|
|
270
214
|
export function usePlayerApi(url, type, isLive, container, segments, flvConfig, hlsConfig) {
|
|
271
215
|
var _useState3 = useState(undefined),
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
216
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
217
|
+
api = _useState4[0],
|
|
218
|
+
setApi = _useState4[1];
|
|
219
|
+
var _useState5 = useState(Date.now()),
|
|
220
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
221
|
+
forceKey = _useState6[0],
|
|
222
|
+
setForceKey = _useState6[1];
|
|
223
|
+
var config = useMemo(function () {
|
|
224
|
+
return {
|
|
225
|
+
flvConfig: _objectSpread({}, flvConfig),
|
|
226
|
+
hlsConfig: _objectSpread({}, hlsConfig)
|
|
227
|
+
};
|
|
228
|
+
}, [forceKey]);
|
|
229
|
+
var typePlay = useTypeAndPlay(url, type, isLive, container, segments, config.flvConfig, config.hlsConfig);
|
|
230
|
+
var rePlay = _useMemoizedFn(function () {
|
|
231
|
+
return setForceKey(Date.now());
|
|
232
|
+
});
|
|
277
233
|
useEffect(function () {
|
|
278
234
|
if (!container) {
|
|
279
235
|
console.debug('wait create api...');
|
|
280
236
|
return undefined;
|
|
281
237
|
}
|
|
282
|
-
|
|
283
238
|
var api = new Api(container);
|
|
284
239
|
setApi(api);
|
|
285
240
|
return function () {
|
|
@@ -288,6 +243,6 @@ export function usePlayerApi(url, type, isLive, container, segments, flvConfig,
|
|
|
288
243
|
});
|
|
289
244
|
};
|
|
290
245
|
}, [container, segments]);
|
|
291
|
-
return [api, typePlay];
|
|
246
|
+
return [api, typePlay, rePlay];
|
|
292
247
|
}
|
|
293
248
|
export default Api;
|
|
@@ -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;
|