@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
|
@@ -1,30 +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";
|
|
3
|
+
import _useMemoizedFn from "ahooks/es/useMemoizedFn";
|
|
2
4
|
import _useLatest from "ahooks/es/useLatest";
|
|
3
5
|
import _useToggle3 from "ahooks/es/useToggle";
|
|
6
|
+
import _cache from "@cloud-app-dev/utils/es/cache";
|
|
4
7
|
var _excluded = ["className", "url", "type", "hideContrallerBar", "isLive", "errorReloadTimer", "children", "onCanPlayerInit", "extActions"];
|
|
5
|
-
|
|
6
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; }
|
|
7
|
-
|
|
8
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; }
|
|
9
|
-
|
|
10
|
-
function
|
|
11
|
-
|
|
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); }
|
|
12
13
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
13
|
-
|
|
14
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."); }
|
|
15
|
-
|
|
16
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); }
|
|
17
|
-
|
|
18
|
-
function
|
|
19
|
-
|
|
20
|
-
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; }
|
|
21
|
-
|
|
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; } }
|
|
22
18
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
23
|
-
|
|
24
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; }
|
|
25
|
-
|
|
26
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; }
|
|
27
|
-
|
|
21
|
+
import { Watermark } from 'antd';
|
|
28
22
|
import React, { useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
29
23
|
import { usePlayerApi } from "./api";
|
|
30
24
|
import { Provider } from "./context";
|
|
@@ -38,133 +32,130 @@ import FPSPlay from "./fps_play";
|
|
|
38
32
|
import useLiveHeart from "./live_heart";
|
|
39
33
|
import VideoMessage from "./message";
|
|
40
34
|
import Timeline from "./timeline";
|
|
41
|
-
import { getVideoType,
|
|
35
|
+
import { getVideoType, playUnload } from "./util";
|
|
42
36
|
import "./style/index.less";
|
|
43
37
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
44
38
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
39
|
+
var WatermarkConfig = _cache.getCache('WatermarkConfig', 'session');
|
|
45
40
|
var SinglePlayer = /*#__PURE__*/React.forwardRef(function SinglePlayer(_ref, ref) {
|
|
46
41
|
var _props$reload;
|
|
47
|
-
|
|
48
42
|
var className = _ref.className,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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);
|
|
59
52
|
var autoPlay = props.autoPlay,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
53
|
+
preload = props.preload,
|
|
54
|
+
muted = props.muted,
|
|
55
|
+
poster = props.poster,
|
|
56
|
+
playsInline = props.playsInline,
|
|
57
|
+
loop = props.loop;
|
|
65
58
|
var rightExtContents = props.rightExtContents,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
59
|
+
rightMidExtContents = props.rightMidExtContents,
|
|
60
|
+
leftExtContents = props.leftExtContents,
|
|
61
|
+
leftMidExtContents = props.leftMidExtContents,
|
|
62
|
+
customTimeLine = props.customTimeLine;
|
|
70
63
|
var flvConfig = props.flvConfig,
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
64
|
+
hlsConfig = props.hlsConfig,
|
|
65
|
+
videoEvents = props.videoEvents,
|
|
66
|
+
playerEvents = props.playerEvents,
|
|
67
|
+
oneFpsPlay = props.oneFpsPlay,
|
|
68
|
+
fpsDelay = props.fpsDelay,
|
|
69
|
+
fps = props.fps;
|
|
78
70
|
var _useState = useState({
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
71
|
+
container: undefined,
|
|
72
|
+
isFpsPlay: false
|
|
73
|
+
}),
|
|
74
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
75
|
+
state = _useState2[0],
|
|
76
|
+
setState = _useState2[1];
|
|
86
77
|
var _useToggle = _useToggle3('contain', 'fill'),
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
78
|
+
_useToggle2 = _slicedToArray(_useToggle, 2),
|
|
79
|
+
fit = _useToggle2[0],
|
|
80
|
+
toggle = _useToggle2[1].toggle;
|
|
91
81
|
|
|
82
|
+
// 视频格式判断,外部可以强制指定,也可以通过url自动判断
|
|
92
83
|
var vType = useMemo(function () {
|
|
93
84
|
return type || getVideoType(url);
|
|
94
85
|
}, [url, type]);
|
|
95
86
|
var domRef = useRef(null);
|
|
96
87
|
var video = useMemo(function () {
|
|
97
88
|
var _state$container$quer;
|
|
98
|
-
|
|
99
89
|
return state.container ? (_state$container$quer = state.container.querySelector('video')) !== null && _state$container$quer !== void 0 ? _state$container$quer : undefined : undefined;
|
|
100
|
-
}, [state.container]);
|
|
90
|
+
}, [state.container]);
|
|
101
91
|
|
|
102
|
-
|
|
92
|
+
// 生成事件对象
|
|
93
|
+
var event = usePlayerEvent(video);
|
|
103
94
|
|
|
95
|
+
// 注册外部自定义事件
|
|
104
96
|
useVideoEvents(event, videoEvents);
|
|
105
97
|
useRegisterPlayerEvents(event, playerEvents);
|
|
106
|
-
|
|
107
98
|
var _usePlayerApi = usePlayerApi(url, vType, isLive, state.container, flvConfig === null || flvConfig === void 0 ? void 0 : flvConfig.mediaDataSource.segments, flvConfig, hlsConfig),
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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
|
+
// 判断是否有链接传入
|
|
115
107
|
var hasLink = useMemo(function () {
|
|
116
108
|
return !!url || !!(flvConfig !== null && flvConfig !== void 0 && flvConfig.mediaDataSource.segments) && vType === 'flv';
|
|
117
109
|
}, [url, flvConfig === null || flvConfig === void 0 ? void 0 : flvConfig.mediaDataSource.segments, vType]);
|
|
118
|
-
|
|
119
110
|
var hlsRef = _useLatest(hls);
|
|
111
|
+
var flvRef = _useLatest(flv);
|
|
120
112
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
113
|
+
// 存储容器
|
|
124
114
|
useEffect(function () {
|
|
125
115
|
setState(function (old) {
|
|
126
116
|
return _objectSpread(_objectSpread({}, old), {}, {
|
|
127
117
|
container: domRef.current
|
|
128
118
|
});
|
|
129
119
|
});
|
|
130
|
-
}, []);
|
|
120
|
+
}, []);
|
|
131
121
|
|
|
122
|
+
// url 变化清理错误次数
|
|
132
123
|
useEffect(function () {
|
|
133
|
-
event === null || event === void 0 ? void 0 : event.emit(EventName.CLEAR_ERROR_TIMER);
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
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]);
|
|
127
|
+
|
|
128
|
+
// 特殊接口实现 reload是可能被重写的,但是API只暴露原生的方法
|
|
129
|
+
var reload = _useMemoizedFn(function () {
|
|
130
|
+
rePlay();
|
|
131
|
+
// playReload(video, event, flvRef.current, hlsRef.current, url);
|
|
132
|
+
});
|
|
139
133
|
|
|
140
|
-
var unload = function
|
|
134
|
+
var unload = _useMemoizedFn(function () {
|
|
141
135
|
return playUnload(video, flvRef.current, hlsRef.current);
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
var openFpsPlay = function openFpsPlay() {
|
|
136
|
+
});
|
|
137
|
+
var openFpsPlay = _useMemoizedFn(function () {
|
|
145
138
|
setState(function (old) {
|
|
146
139
|
return _objectSpread(_objectSpread({}, old), {}, {
|
|
147
140
|
isFpsPlay: true
|
|
148
141
|
});
|
|
149
142
|
});
|
|
150
143
|
api === null || api === void 0 ? void 0 : api.pause();
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
var closeFpsPlay = function closeFpsPlay() {
|
|
144
|
+
});
|
|
145
|
+
var closeFpsPlay = _useMemoizedFn(function () {
|
|
154
146
|
setState(function (old) {
|
|
155
147
|
return _objectSpread(_objectSpread({}, old), {}, {
|
|
156
148
|
isFpsPlay: false
|
|
157
149
|
});
|
|
158
150
|
});
|
|
159
151
|
api === null || api === void 0 ? void 0 : api.play();
|
|
160
|
-
};
|
|
161
|
-
|
|
152
|
+
});
|
|
162
153
|
|
|
154
|
+
// 合并api,加上代理
|
|
163
155
|
var playApi = useMemo(function () {
|
|
164
156
|
if (!api) {
|
|
165
157
|
return undefined;
|
|
166
158
|
}
|
|
167
|
-
|
|
168
159
|
var map = _objectSpread({
|
|
169
160
|
reload: reload,
|
|
170
161
|
unload: unload,
|
|
@@ -172,24 +163,23 @@ var SinglePlayer = /*#__PURE__*/React.forwardRef(function SinglePlayer(_ref, ref
|
|
|
172
163
|
openFpsPlay: openFpsPlay,
|
|
173
164
|
closeFpsPlay: closeFpsPlay
|
|
174
165
|
}, extActions);
|
|
175
|
-
|
|
176
166
|
return new Proxy(api, {
|
|
177
167
|
get: function get(target, key) {
|
|
178
168
|
var _map$key;
|
|
179
|
-
|
|
180
169
|
return (_map$key = map[key]) !== null && _map$key !== void 0 ? _map$key : target[key];
|
|
181
170
|
},
|
|
182
171
|
set: function set() {
|
|
183
172
|
return true;
|
|
184
173
|
}
|
|
185
|
-
});
|
|
186
|
-
|
|
174
|
+
});
|
|
175
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
176
|
+
}, [api]);
|
|
187
177
|
|
|
178
|
+
// 代理Event
|
|
188
179
|
var playEvent = useMemo(function () {
|
|
189
180
|
if (!event) {
|
|
190
181
|
return undefined;
|
|
191
182
|
}
|
|
192
|
-
|
|
193
183
|
return new Proxy(event, {
|
|
194
184
|
get: function get(target, key) {
|
|
195
185
|
return target[key];
|
|
@@ -198,8 +188,9 @@ var SinglePlayer = /*#__PURE__*/React.forwardRef(function SinglePlayer(_ref, ref
|
|
|
198
188
|
return true;
|
|
199
189
|
}
|
|
200
190
|
});
|
|
201
|
-
}, [event]);
|
|
191
|
+
}, [event]);
|
|
202
192
|
|
|
193
|
+
// ref暴露接口
|
|
203
194
|
useImperativeHandle(ref, function () {
|
|
204
195
|
return {
|
|
205
196
|
video: video,
|
|
@@ -209,14 +200,14 @@ var SinglePlayer = /*#__PURE__*/React.forwardRef(function SinglePlayer(_ref, ref
|
|
|
209
200
|
plugins: [flvRef.current, hlsRef.current],
|
|
210
201
|
fit: fit
|
|
211
202
|
};
|
|
212
|
-
},
|
|
203
|
+
},
|
|
204
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
213
205
|
[video, state.container, playApi, playEvent, fit]);
|
|
214
|
-
|
|
215
206
|
_useUpdateEffect(function () {
|
|
216
207
|
return api && event && video ? onCanPlayerInit === null || onCanPlayerInit === void 0 ? void 0 : onCanPlayerInit() : undefined;
|
|
217
|
-
}, [api, event, video]);
|
|
218
|
-
|
|
208
|
+
}, [api, event, video]);
|
|
219
209
|
|
|
210
|
+
// 补货视频错误,自定义处理
|
|
220
211
|
useErrorEvent({
|
|
221
212
|
unload: unload,
|
|
222
213
|
flv: flvRef.current,
|
|
@@ -224,8 +215,9 @@ var SinglePlayer = /*#__PURE__*/React.forwardRef(function SinglePlayer(_ref, ref
|
|
|
224
215
|
event: event,
|
|
225
216
|
reload: reload,
|
|
226
217
|
errorReloadTimer: errorReloadTimer
|
|
227
|
-
});
|
|
218
|
+
});
|
|
228
219
|
|
|
220
|
+
// 直播缓冲追回
|
|
229
221
|
useLiveHeart({
|
|
230
222
|
api: api,
|
|
231
223
|
event: event,
|
|
@@ -256,26 +248,28 @@ var SinglePlayer = /*#__PURE__*/React.forwardRef(function SinglePlayer(_ref, ref
|
|
|
256
248
|
container: state.container,
|
|
257
249
|
isLive: isLive,
|
|
258
250
|
isFpsPlay: state.isFpsPlay,
|
|
259
|
-
children: /*#__PURE__*/
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
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
|
+
}))
|
|
279
273
|
});
|
|
280
274
|
});
|
|
281
275
|
SinglePlayer.defaultProps = {
|
package/es/Player/util.d.ts
CHANGED
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
|
-
|
|
7
|
-
import Flvjs from '@cloud-app-dev/
|
|
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
|
+
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;
|