@cloud-app-dev/vidc 4.0.1 → 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 -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/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.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
|
@@ -1,31 +1,24 @@
|
|
|
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
|
import _useUpdateEffect from "ahooks/es/useUpdateEffect";
|
|
2
3
|
import _useMemoizedFn from "ahooks/es/useMemoizedFn";
|
|
3
4
|
import _useLatest from "ahooks/es/useLatest";
|
|
4
5
|
import _useToggle3 from "ahooks/es/useToggle";
|
|
6
|
+
import _cache from "@cloud-app-dev/utils/es/cache";
|
|
5
7
|
var _excluded = ["className", "url", "type", "hideContrallerBar", "isLive", "errorReloadTimer", "children", "onCanPlayerInit", "extActions"];
|
|
6
|
-
|
|
7
8
|
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; }
|
|
8
|
-
|
|
9
9
|
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; }
|
|
10
|
-
|
|
11
|
-
function
|
|
12
|
-
|
|
10
|
+
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; }
|
|
11
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
12
|
+
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); }
|
|
13
13
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
14
|
-
|
|
15
14
|
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."); }
|
|
16
|
-
|
|
17
15
|
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); }
|
|
18
|
-
|
|
19
|
-
function
|
|
20
|
-
|
|
21
|
-
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; }
|
|
22
|
-
|
|
16
|
+
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; }
|
|
17
|
+
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; } }
|
|
23
18
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
24
|
-
|
|
25
19
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
26
|
-
|
|
27
20
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
28
|
-
|
|
21
|
+
import { Watermark } from 'antd';
|
|
29
22
|
import React, { useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
30
23
|
import { usePlayerApi } from "./api";
|
|
31
24
|
import { Provider } from "./context";
|
|
@@ -43,106 +36,104 @@ import { getVideoType, playUnload } from "./util";
|
|
|
43
36
|
import "./style/index.less";
|
|
44
37
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
45
38
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
39
|
+
var WatermarkConfig = _cache.getCache('WatermarkConfig', 'session');
|
|
46
40
|
var SinglePlayer = /*#__PURE__*/React.forwardRef(function SinglePlayer(_ref, ref) {
|
|
47
41
|
var _props$reload;
|
|
48
|
-
|
|
49
42
|
var className = _ref.className,
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
43
|
+
url = _ref.url,
|
|
44
|
+
type = _ref.type,
|
|
45
|
+
hideContrallerBar = _ref.hideContrallerBar,
|
|
46
|
+
isLive = _ref.isLive,
|
|
47
|
+
errorReloadTimer = _ref.errorReloadTimer,
|
|
48
|
+
children = _ref.children,
|
|
49
|
+
onCanPlayerInit = _ref.onCanPlayerInit,
|
|
50
|
+
extActions = _ref.extActions,
|
|
51
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
60
52
|
var autoPlay = props.autoPlay,
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
53
|
+
preload = props.preload,
|
|
54
|
+
muted = props.muted,
|
|
55
|
+
poster = props.poster,
|
|
56
|
+
playsInline = props.playsInline,
|
|
57
|
+
loop = props.loop;
|
|
66
58
|
var rightExtContents = props.rightExtContents,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
59
|
+
rightMidExtContents = props.rightMidExtContents,
|
|
60
|
+
leftExtContents = props.leftExtContents,
|
|
61
|
+
leftMidExtContents = props.leftMidExtContents,
|
|
62
|
+
customTimeLine = props.customTimeLine;
|
|
71
63
|
var flvConfig = props.flvConfig,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
64
|
+
hlsConfig = props.hlsConfig,
|
|
65
|
+
videoEvents = props.videoEvents,
|
|
66
|
+
playerEvents = props.playerEvents,
|
|
67
|
+
oneFpsPlay = props.oneFpsPlay,
|
|
68
|
+
fpsDelay = props.fpsDelay,
|
|
69
|
+
fps = props.fps;
|
|
79
70
|
var _useState = useState({
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
71
|
+
container: undefined,
|
|
72
|
+
isFpsPlay: false
|
|
73
|
+
}),
|
|
74
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
75
|
+
state = _useState2[0],
|
|
76
|
+
setState = _useState2[1];
|
|
87
77
|
var _useToggle = _useToggle3('contain', 'fill'),
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
78
|
+
_useToggle2 = _slicedToArray(_useToggle, 2),
|
|
79
|
+
fit = _useToggle2[0],
|
|
80
|
+
toggle = _useToggle2[1].toggle;
|
|
92
81
|
|
|
82
|
+
// 视频格式判断,外部可以强制指定,也可以通过url自动判断
|
|
93
83
|
var vType = useMemo(function () {
|
|
94
84
|
return type || getVideoType(url);
|
|
95
85
|
}, [url, type]);
|
|
96
86
|
var domRef = useRef(null);
|
|
97
87
|
var video = useMemo(function () {
|
|
98
88
|
var _state$container$quer;
|
|
99
|
-
|
|
100
89
|
return state.container ? (_state$container$quer = state.container.querySelector('video')) !== null && _state$container$quer !== void 0 ? _state$container$quer : undefined : undefined;
|
|
101
|
-
}, [state.container]);
|
|
90
|
+
}, [state.container]);
|
|
102
91
|
|
|
103
|
-
|
|
92
|
+
// 生成事件对象
|
|
93
|
+
var event = usePlayerEvent(video);
|
|
104
94
|
|
|
95
|
+
// 注册外部自定义事件
|
|
105
96
|
useVideoEvents(event, videoEvents);
|
|
106
97
|
useRegisterPlayerEvents(event, playerEvents);
|
|
107
|
-
|
|
108
98
|
var _usePlayerApi = usePlayerApi(url, vType, isLive, state.container, flvConfig === null || flvConfig === void 0 ? void 0 : flvConfig.mediaDataSource.segments, flvConfig, hlsConfig),
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
99
|
+
_usePlayerApi2 = _slicedToArray(_usePlayerApi, 3),
|
|
100
|
+
api = _usePlayerApi2[0],
|
|
101
|
+
_usePlayerApi2$ = _slicedToArray(_usePlayerApi2[1], 3),
|
|
102
|
+
flv = _usePlayerApi2$[1],
|
|
103
|
+
hls = _usePlayerApi2$[2],
|
|
104
|
+
rePlay = _usePlayerApi2[2];
|
|
105
|
+
|
|
106
|
+
// 判断是否有链接传入
|
|
117
107
|
var hasLink = useMemo(function () {
|
|
118
108
|
return !!url || !!(flvConfig !== null && flvConfig !== void 0 && flvConfig.mediaDataSource.segments) && vType === 'flv';
|
|
119
109
|
}, [url, flvConfig === null || flvConfig === void 0 ? void 0 : flvConfig.mediaDataSource.segments, vType]);
|
|
120
|
-
|
|
121
110
|
var hlsRef = _useLatest(hls);
|
|
111
|
+
var flvRef = _useLatest(flv);
|
|
122
112
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
113
|
+
// 存储容器
|
|
126
114
|
useEffect(function () {
|
|
127
115
|
setState(function (old) {
|
|
128
116
|
return _objectSpread(_objectSpread({}, old), {}, {
|
|
129
117
|
container: domRef.current
|
|
130
118
|
});
|
|
131
119
|
});
|
|
132
|
-
}, []);
|
|
120
|
+
}, []);
|
|
133
121
|
|
|
122
|
+
// url 变化清理错误次数
|
|
134
123
|
useEffect(function () {
|
|
135
|
-
event === null || event === void 0 ? void 0 : event.emit(EventName.CLEAR_ERROR_TIMER);
|
|
136
|
-
|
|
124
|
+
event === null || event === void 0 ? void 0 : event.emit(EventName.CLEAR_ERROR_TIMER);
|
|
125
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
126
|
+
}, [url]);
|
|
137
127
|
|
|
128
|
+
// 特殊接口实现 reload是可能被重写的,但是API只暴露原生的方法
|
|
138
129
|
var reload = _useMemoizedFn(function () {
|
|
139
|
-
rePlay();
|
|
130
|
+
rePlay();
|
|
131
|
+
// playReload(video, event, flvRef.current, hlsRef.current, url);
|
|
140
132
|
});
|
|
141
133
|
|
|
142
134
|
var unload = _useMemoizedFn(function () {
|
|
143
135
|
return playUnload(video, flvRef.current, hlsRef.current);
|
|
144
136
|
});
|
|
145
|
-
|
|
146
137
|
var openFpsPlay = _useMemoizedFn(function () {
|
|
147
138
|
setState(function (old) {
|
|
148
139
|
return _objectSpread(_objectSpread({}, old), {}, {
|
|
@@ -151,7 +142,6 @@ var SinglePlayer = /*#__PURE__*/React.forwardRef(function SinglePlayer(_ref, ref
|
|
|
151
142
|
});
|
|
152
143
|
api === null || api === void 0 ? void 0 : api.pause();
|
|
153
144
|
});
|
|
154
|
-
|
|
155
145
|
var closeFpsPlay = _useMemoizedFn(function () {
|
|
156
146
|
setState(function (old) {
|
|
157
147
|
return _objectSpread(_objectSpread({}, old), {}, {
|
|
@@ -159,14 +149,13 @@ var SinglePlayer = /*#__PURE__*/React.forwardRef(function SinglePlayer(_ref, ref
|
|
|
159
149
|
});
|
|
160
150
|
});
|
|
161
151
|
api === null || api === void 0 ? void 0 : api.play();
|
|
162
|
-
});
|
|
163
|
-
|
|
152
|
+
});
|
|
164
153
|
|
|
154
|
+
// 合并api,加上代理
|
|
165
155
|
var playApi = useMemo(function () {
|
|
166
156
|
if (!api) {
|
|
167
157
|
return undefined;
|
|
168
158
|
}
|
|
169
|
-
|
|
170
159
|
var map = _objectSpread({
|
|
171
160
|
reload: reload,
|
|
172
161
|
unload: unload,
|
|
@@ -174,24 +163,23 @@ var SinglePlayer = /*#__PURE__*/React.forwardRef(function SinglePlayer(_ref, ref
|
|
|
174
163
|
openFpsPlay: openFpsPlay,
|
|
175
164
|
closeFpsPlay: closeFpsPlay
|
|
176
165
|
}, extActions);
|
|
177
|
-
|
|
178
166
|
return new Proxy(api, {
|
|
179
167
|
get: function get(target, key) {
|
|
180
168
|
var _map$key;
|
|
181
|
-
|
|
182
169
|
return (_map$key = map[key]) !== null && _map$key !== void 0 ? _map$key : target[key];
|
|
183
170
|
},
|
|
184
171
|
set: function set() {
|
|
185
172
|
return true;
|
|
186
173
|
}
|
|
187
|
-
});
|
|
188
|
-
|
|
174
|
+
});
|
|
175
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
176
|
+
}, [api]);
|
|
189
177
|
|
|
178
|
+
// 代理Event
|
|
190
179
|
var playEvent = useMemo(function () {
|
|
191
180
|
if (!event) {
|
|
192
181
|
return undefined;
|
|
193
182
|
}
|
|
194
|
-
|
|
195
183
|
return new Proxy(event, {
|
|
196
184
|
get: function get(target, key) {
|
|
197
185
|
return target[key];
|
|
@@ -200,8 +188,9 @@ var SinglePlayer = /*#__PURE__*/React.forwardRef(function SinglePlayer(_ref, ref
|
|
|
200
188
|
return true;
|
|
201
189
|
}
|
|
202
190
|
});
|
|
203
|
-
}, [event]);
|
|
191
|
+
}, [event]);
|
|
204
192
|
|
|
193
|
+
// ref暴露接口
|
|
205
194
|
useImperativeHandle(ref, function () {
|
|
206
195
|
return {
|
|
207
196
|
video: video,
|
|
@@ -211,14 +200,14 @@ var SinglePlayer = /*#__PURE__*/React.forwardRef(function SinglePlayer(_ref, ref
|
|
|
211
200
|
plugins: [flvRef.current, hlsRef.current],
|
|
212
201
|
fit: fit
|
|
213
202
|
};
|
|
214
|
-
},
|
|
203
|
+
},
|
|
204
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
215
205
|
[video, state.container, playApi, playEvent, fit]);
|
|
216
|
-
|
|
217
206
|
_useUpdateEffect(function () {
|
|
218
207
|
return api && event && video ? onCanPlayerInit === null || onCanPlayerInit === void 0 ? void 0 : onCanPlayerInit() : undefined;
|
|
219
|
-
}, [api, event, video]);
|
|
220
|
-
|
|
208
|
+
}, [api, event, video]);
|
|
221
209
|
|
|
210
|
+
// 补货视频错误,自定义处理
|
|
222
211
|
useErrorEvent({
|
|
223
212
|
unload: unload,
|
|
224
213
|
flv: flvRef.current,
|
|
@@ -226,8 +215,9 @@ var SinglePlayer = /*#__PURE__*/React.forwardRef(function SinglePlayer(_ref, ref
|
|
|
226
215
|
event: event,
|
|
227
216
|
reload: reload,
|
|
228
217
|
errorReloadTimer: errorReloadTimer
|
|
229
|
-
});
|
|
218
|
+
});
|
|
230
219
|
|
|
220
|
+
// 直播缓冲追回
|
|
231
221
|
useLiveHeart({
|
|
232
222
|
api: api,
|
|
233
223
|
event: event,
|
|
@@ -258,26 +248,28 @@ var SinglePlayer = /*#__PURE__*/React.forwardRef(function SinglePlayer(_ref, ref
|
|
|
258
248
|
container: state.container,
|
|
259
249
|
isLive: isLive,
|
|
260
250
|
isFpsPlay: state.isFpsPlay,
|
|
261
|
-
children: /*#__PURE__*/
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
251
|
+
children: /*#__PURE__*/_jsx(Watermark, _objectSpread(_objectSpread({}, WatermarkConfig), {}, {
|
|
252
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
253
|
+
className: "lm-player-container ".concat(className),
|
|
254
|
+
ref: domRef,
|
|
255
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
256
|
+
className: "player-mask-layout",
|
|
257
|
+
children: [/*#__PURE__*/_jsx("video", _objectSpread(_objectSpread({}, videoProps), {}, {
|
|
258
|
+
style: {
|
|
259
|
+
objectFit: fit,
|
|
260
|
+
visibility: state.isFpsPlay ? 'hidden' : 'unset'
|
|
261
|
+
}
|
|
262
|
+
})), hasApiEventInit && hasLink && state.isFpsPlay ? /*#__PURE__*/_jsx(FPSPlay, {
|
|
263
|
+
fps: fps,
|
|
264
|
+
event: event,
|
|
265
|
+
api: playApi,
|
|
266
|
+
fpsDelay: fpsDelay
|
|
267
|
+
}) : /*#__PURE__*/_jsx(Empty, {})]
|
|
268
|
+
}), hasApiEventInit && hasLink ? /*#__PURE__*/_jsx(VideoMessage, {}) : /*#__PURE__*/_jsx(Empty, {}), hasApiEventInit && hasLink && !hideContrallerBar ? /*#__PURE__*/_jsx(ContrallerEvent, {
|
|
269
|
+
children: /*#__PURE__*/_jsx(ContrallerBar, _objectSpread({}, contrallerProps))
|
|
270
|
+
}) : /*#__PURE__*/_jsx(Empty, {}), hasApiEventInit ? customTimeLine ? customTimeLine : !hideContrallerBar ? /*#__PURE__*/_jsx(Timeline, {}) : /*#__PURE__*/_jsx(Empty, {}) : /*#__PURE__*/_jsx(Empty, {}), children]
|
|
271
|
+
})
|
|
272
|
+
}))
|
|
281
273
|
});
|
|
282
274
|
});
|
|
283
275
|
SinglePlayer.defaultProps = {
|
package/es/Player/util.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
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
|
import Flvjs from '@cloud-app-dev/mpegts.js';
|
|
8
8
|
import Hls from 'hls.js';
|
|
9
9
|
import { tryCatch } from "../utils";
|
|
10
10
|
import Events from "./event/eventName";
|
|
11
|
-
|
|
12
11
|
/**
|
|
13
12
|
* 创建HLS对象
|
|
14
13
|
* @param {*} video
|
|
@@ -18,7 +17,6 @@ export function createHlsPlayer(video, url, isLive, hlsConfig) {
|
|
|
18
17
|
if (!Hls.isSupported() || !url) {
|
|
19
18
|
return undefined;
|
|
20
19
|
}
|
|
21
|
-
|
|
22
20
|
var player = new Hls(_objectSpread({
|
|
23
21
|
liveDurationInfinity: isLive,
|
|
24
22
|
enableWorker: true
|
|
@@ -27,37 +25,34 @@ export function createHlsPlayer(video, url, isLive, hlsConfig) {
|
|
|
27
25
|
player.attachMedia(video);
|
|
28
26
|
return player;
|
|
29
27
|
}
|
|
28
|
+
|
|
30
29
|
/**
|
|
31
30
|
* 创建FLV对象
|
|
32
31
|
* @param {*} video
|
|
33
32
|
* @param {*} options
|
|
34
33
|
*/
|
|
35
|
-
|
|
36
34
|
export function createFlvPlayer(video, url, isLive, flvConfig) {
|
|
37
35
|
if (!Flvjs.isSupported() || !url) {
|
|
38
36
|
return undefined;
|
|
39
37
|
}
|
|
40
|
-
|
|
41
38
|
Flvjs.LoggingControl.enableDebug = false;
|
|
42
39
|
Flvjs.LoggingControl.enableVerbose = false;
|
|
43
40
|
Flvjs.LoggingControl.enableWarn = false;
|
|
44
|
-
|
|
45
41
|
var mediaDataSource = _objectSpread({
|
|
46
42
|
type: 'flv',
|
|
47
43
|
url: url
|
|
48
44
|
}, flvConfig === null || flvConfig === void 0 ? void 0 : flvConfig.mediaDataSource);
|
|
49
|
-
|
|
50
45
|
var config = _objectSpread({
|
|
51
46
|
enableWorker: true,
|
|
52
47
|
isLive: isLive !== null && isLive !== void 0 ? isLive : true,
|
|
53
48
|
enableStashBuffer: !isLive
|
|
54
49
|
}, flvConfig === null || flvConfig === void 0 ? void 0 : flvConfig.config);
|
|
55
|
-
|
|
56
50
|
var player = Flvjs.createPlayer(mediaDataSource, config);
|
|
57
51
|
player.attachMediaElement(video);
|
|
58
52
|
player.load();
|
|
59
53
|
return player;
|
|
60
54
|
}
|
|
55
|
+
|
|
61
56
|
/**
|
|
62
57
|
* video unload
|
|
63
58
|
* @param video
|
|
@@ -65,26 +60,22 @@ export function createFlvPlayer(video, url, isLive, flvConfig) {
|
|
|
65
60
|
* @param hls
|
|
66
61
|
* @returns
|
|
67
62
|
*/
|
|
68
|
-
|
|
69
63
|
export var playUnload = function playUnload(video, flv, hls) {
|
|
70
64
|
if (!video) {
|
|
71
65
|
return;
|
|
72
66
|
}
|
|
73
|
-
|
|
74
67
|
video.pause();
|
|
75
|
-
|
|
76
68
|
if (flv) {
|
|
77
69
|
flv.unload();
|
|
78
70
|
return;
|
|
79
71
|
}
|
|
80
|
-
|
|
81
72
|
if (hls) {
|
|
82
73
|
hls.stopLoad();
|
|
83
74
|
return;
|
|
84
75
|
}
|
|
85
|
-
|
|
86
76
|
video.removeAttribute('src');
|
|
87
77
|
};
|
|
78
|
+
|
|
88
79
|
/**
|
|
89
80
|
* reload
|
|
90
81
|
* @param video
|
|
@@ -93,21 +84,17 @@ export var playUnload = function playUnload(video, flv, hls) {
|
|
|
93
84
|
* @param hls
|
|
94
85
|
* @param url
|
|
95
86
|
*/
|
|
96
|
-
|
|
97
87
|
export var playReload = function playReload(video, event, flv, hls, url) {
|
|
98
88
|
if (!video || !event) {
|
|
99
89
|
return undefined;
|
|
100
90
|
}
|
|
101
|
-
|
|
102
91
|
playUnload(video, flv, hls);
|
|
103
|
-
|
|
104
92
|
if (flv) {
|
|
105
93
|
tryCatch(function () {
|
|
106
94
|
flv.load();
|
|
107
95
|
flv.play();
|
|
108
96
|
});
|
|
109
97
|
}
|
|
110
|
-
|
|
111
98
|
if (hls && url) {
|
|
112
99
|
tryCatch(function () {
|
|
113
100
|
hls.swapAudioCodec();
|
|
@@ -117,26 +104,23 @@ export var playReload = function playReload(video, event, flv, hls, url) {
|
|
|
117
104
|
video.play();
|
|
118
105
|
});
|
|
119
106
|
}
|
|
120
|
-
|
|
121
107
|
if (!flv && !hls && url) {
|
|
122
108
|
video.setAttribute('src', url);
|
|
123
109
|
tryCatch(function () {
|
|
124
110
|
return video.play();
|
|
125
111
|
});
|
|
126
112
|
}
|
|
127
|
-
|
|
128
113
|
event.emit(Events.RELOAD);
|
|
129
114
|
};
|
|
115
|
+
|
|
130
116
|
/**
|
|
131
117
|
* 获取播放文件类型
|
|
132
118
|
* @param {*} url
|
|
133
119
|
*/
|
|
134
|
-
|
|
135
120
|
export function getVideoType(url) {
|
|
136
121
|
if (!url) {
|
|
137
122
|
return 'native';
|
|
138
123
|
}
|
|
139
|
-
|
|
140
124
|
return url.indexOf('.flv') > -1 ? 'flv' : url.indexOf('.m3u8') > -1 ? 'hls' : 'native';
|
|
141
125
|
}
|
|
142
126
|
export function timeStamp(second) {
|
|
@@ -144,11 +128,9 @@ export function timeStamp(second) {
|
|
|
144
128
|
var h = Math.round(second / 60 / 60 % 24);
|
|
145
129
|
var m = Math.round(second / 60 % 60);
|
|
146
130
|
var s = Math.round(second % 60);
|
|
147
|
-
|
|
148
131
|
if (h === 0) {
|
|
149
132
|
return "".concat(m < 10 ? '0' + m : m, ":").concat(s < 10 ? '0' + s : s);
|
|
150
133
|
}
|
|
151
|
-
|
|
152
134
|
return "".concat(h < 10 ? '0' + h : h, ":").concat(m < 10 ? '0' + m : m, ":").concat(s < 10 ? '0' + s : s);
|
|
153
135
|
}
|
|
154
136
|
export function getRandom() {
|
|
@@ -159,6 +141,5 @@ export function getDomStyleValue(dom, styleKey) {
|
|
|
159
141
|
if (!dom) {
|
|
160
142
|
return '';
|
|
161
143
|
}
|
|
162
|
-
|
|
163
144
|
return window.getComputedStyle(dom).getPropertyValue(styleKey);
|
|
164
145
|
}
|
package/es/Progress/index.js
CHANGED
|
@@ -1,30 +1,21 @@
|
|
|
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 { Progress } from 'antd';
|
|
14
8
|
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
15
9
|
import "./index.less";
|
|
16
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
-
|
|
18
11
|
function ProgressComponent(_ref) {
|
|
19
12
|
var status = _ref.status;
|
|
20
13
|
var timer = useRef();
|
|
21
14
|
var currentStatus = useRef('loading');
|
|
22
|
-
|
|
23
15
|
var _useState = useState(0),
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
16
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
17
|
+
percent = _useState2[0],
|
|
18
|
+
setPersent = _useState2[1];
|
|
28
19
|
var isHide = useMemo(function () {
|
|
29
20
|
return percent === 100;
|
|
30
21
|
}, [percent]);
|
|
@@ -32,7 +23,6 @@ function ProgressComponent(_ref) {
|
|
|
32
23
|
if ((status === 'over' || status === 'error') && percent === 0) {
|
|
33
24
|
return;
|
|
34
25
|
}
|
|
35
|
-
|
|
36
26
|
if (percent <= 90 && currentStatus.current === 'loading') {
|
|
37
27
|
var num = percent + 20;
|
|
38
28
|
timer.current = setTimeout(function () {
|
|
@@ -60,7 +50,6 @@ function ProgressComponent(_ref) {
|
|
|
60
50
|
className: "lm-c-loading-progress ".concat(isHide ? 'lm-c-loading-progress-over' : '')
|
|
61
51
|
});
|
|
62
52
|
}
|
|
63
|
-
|
|
64
53
|
ProgressComponent.defaultProps = {
|
|
65
54
|
status: 'loading'
|
|
66
55
|
};
|
package/es/ROI/index.d.ts
CHANGED
|
@@ -30,10 +30,4 @@ interface IRIOProps {
|
|
|
30
30
|
rowItems?: number;
|
|
31
31
|
}
|
|
32
32
|
declare function RIO({ children, debug, renderKey, onChange, isOpen, row, rowItems }: IRIOProps): JSX.Element;
|
|
33
|
-
declare namespace RIO {
|
|
34
|
-
var defaultProps: {
|
|
35
|
-
row: number;
|
|
36
|
-
rowItems: number;
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
33
|
export default RIO;
|
package/es/ROI/index.js
CHANGED
|
@@ -4,40 +4,36 @@ import useDrawROI from "../useDrawROI";
|
|
|
4
4
|
import "./index.less";
|
|
5
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
6
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
-
|
|
8
7
|
function RIO(_ref) {
|
|
9
8
|
var children = _ref.children,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
debug = _ref.debug,
|
|
10
|
+
renderKey = _ref.renderKey,
|
|
11
|
+
onChange = _ref.onChange,
|
|
12
|
+
isOpen = _ref.isOpen,
|
|
13
|
+
_ref$row = _ref.row,
|
|
14
|
+
row = _ref$row === void 0 ? 18 : _ref$row,
|
|
15
|
+
_ref$rowItems = _ref.rowItems,
|
|
16
|
+
rowItems = _ref$rowItems === void 0 ? 32 : _ref$rowItems;
|
|
16
17
|
var ref = useRef(null);
|
|
17
|
-
|
|
18
18
|
var _useDrawROI = useDrawROI(ref, {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
19
|
+
row: row,
|
|
20
|
+
rowItems: rowItems
|
|
21
|
+
}),
|
|
22
|
+
open = _useDrawROI.open,
|
|
23
|
+
close = _useDrawROI.close,
|
|
24
|
+
clear = _useDrawROI.clear,
|
|
25
|
+
rio = _useDrawROI.rio,
|
|
26
|
+
areas = _useDrawROI.areas;
|
|
27
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
29
28
|
useEffect(function () {
|
|
30
29
|
return isOpen ? open() : close();
|
|
31
30
|
}, [isOpen]);
|
|
32
|
-
|
|
33
31
|
_useUpdateEffect(function () {
|
|
34
32
|
return clear();
|
|
35
33
|
}, [renderKey]);
|
|
36
|
-
|
|
37
34
|
_useUpdateEffect(function () {
|
|
38
35
|
return onChange === null || onChange === void 0 ? void 0 : onChange(rio, areas);
|
|
39
36
|
}, [rio]);
|
|
40
|
-
|
|
41
37
|
return /*#__PURE__*/_jsxs("div", {
|
|
42
38
|
className: "rio-layout",
|
|
43
39
|
children: [children, debug && /*#__PURE__*/_jsx("div", {
|
|
@@ -58,9 +54,4 @@ function RIO(_ref) {
|
|
|
58
54
|
})]
|
|
59
55
|
});
|
|
60
56
|
}
|
|
61
|
-
|
|
62
|
-
RIO.defaultProps = {
|
|
63
|
-
row: 18,
|
|
64
|
-
rowItems: 32
|
|
65
|
-
};
|
|
66
57
|
export default RIO;
|