@cloud-app-dev/vidc 2.3.0 → 3.0.0
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/.umirc.ts +2 -2
- package/es/Config/interface.d.ts +2 -1
- package/es/DomMove/demo.d.ts +2 -0
- package/es/DomMove/demo.js +16 -0
- package/es/DomMove/index.d.ts +16 -0
- package/es/DomMove/index.js +145 -0
- package/es/DomMove/utils.d.ts +8 -0
- package/es/{Picture/component/MoveContent → DomMove}/utils.js +19 -0
- package/es/Drawer/index.d.ts +2 -2
- package/es/Drawer/interface.d.ts +4 -174
- package/es/ErrorBoundary/index.d.ts +18 -0
- package/es/ErrorBoundary/index.js +84 -0
- package/es/List/DynamicGridList/Demo.js +40 -27
- package/es/List/DynamicGridList/index.d.ts +20 -29
- package/es/List/DynamicGridList/index.js +40 -63
- package/es/List/DynamicList/index.css +15 -0
- package/es/List/DynamicList/index.d.ts +14 -0
- package/es/List/DynamicList/index.js +105 -0
- package/es/List/DynamicList/interface.d.ts +19 -0
- package/es/List/DynamicList/utils.d.ts +4 -0
- package/es/List/DynamicList/utils.js +6 -0
- package/es/List/GridList/Demo.js +27 -4
- package/es/List/GridList/index.css +1 -0
- package/es/List/GridList/index.d.ts +2 -2
- package/es/List/GridList/index.js +8 -12
- package/es/List/GridList/interface.d.ts +1 -1
- package/es/List/VList/index.js +2 -3
- package/es/List/index.css +2 -54
- package/es/List/index.d.ts +6 -7
- package/es/List/index.js +14 -153
- package/es/List/interface.d.ts +3 -61
- package/es/LoaderApp/index.d.ts +1 -1
- package/es/LoaderApp/index.js +27 -46
- package/es/LoaderApp/interface.d.ts +3 -0
- package/es/LoaderApp/loader.d.ts +6 -7
- package/es/LoaderApp/loader.js +20 -30
- package/es/LoaderApp/sandbox.back.d.ts +18 -0
- package/es/LoaderApp/sandbox.back.js +356 -0
- package/es/LoaderApp/sandbox.d.ts +12 -0
- package/es/LoaderApp/sandbox.js +110 -0
- package/es/LoaderApp/utils.d.ts +5 -1
- package/es/LoaderApp/utils.js +98 -2
- package/es/Map/AMap.d.ts +1572 -0
- package/es/Map/BasicMap/AMapInstance.d.ts +15 -0
- package/es/Map/BasicMap/AMapInstance.js +66 -0
- package/es/Map/BasicMap/LeafletInstance.d.ts +15 -0
- package/es/Map/BasicMap/LeafletInstance.js +98 -0
- package/es/Map/BasicMap/index.css +24 -0
- package/es/Map/BasicMap/index.d.ts +9 -0
- package/es/Map/BasicMap/index.js +108 -0
- package/es/Map/ClusterLayer/hook.d.ts +5 -0
- package/es/Map/ClusterLayer/hook.js +144 -0
- package/es/Map/ClusterLayer/index.css +26 -0
- package/es/Map/ClusterLayer/index.d.ts +5 -0
- package/es/Map/ClusterLayer/index.js +31 -0
- package/es/Map/ClusterLayer/props.d.ts +8 -0
- package/es/Map/Config/index.d.ts +7 -0
- package/es/{InitialConfig → Map/Config}/index.js +35 -36
- package/es/Map/Config/utils.d.ts +2 -0
- package/es/{List/DynamicDeviceList → Map/Config}/utils.js +48 -45
- package/es/Map/Context/index.d.ts +11 -0
- package/es/Map/Context/index.js +66 -0
- package/es/Map/FindPio/index.css +7 -0
- package/es/Map/FindPio/index.d.ts +4 -0
- package/es/Map/FindPio/index.js +16 -0
- package/es/{WorkerFlow/Demo.d.ts → Map/InfoWindow/demo.d.ts} +0 -0
- package/es/{List/DynamicDeviceList/Demo.js → Map/InfoWindow/demo.js} +27 -25
- package/es/Map/InfoWindow/index.d.ts +8 -0
- package/es/Map/InfoWindow/index.js +74 -0
- package/es/Map/LevelCenter/DragMarker/index.d.ts +12 -0
- package/es/Map/LevelCenter/DragMarker/index.js +48 -0
- package/es/{List/DeviceList → Map/LevelCenter}/index.css +0 -0
- package/es/Map/LevelCenter/index.d.ts +13 -0
- package/es/Map/LevelCenter/index.js +42 -0
- package/es/Map/LoaderMap/index.d.ts +12 -0
- package/es/Map/LoaderMap/index.js +58 -0
- package/es/Map/ResetTools/index.css +32 -0
- package/es/Map/ResetTools/index.d.ts +9 -0
- package/es/Map/ResetTools/index.js +61 -0
- package/es/Map/SinglePoint/Marker/index.d.ts +7 -0
- package/es/Map/SinglePoint/Marker/index.js +29 -0
- package/es/Map/SinglePoint/icon/Place_icon_OnLine_Hover.svg +15 -0
- package/es/Map/SinglePoint/icon/Place_icon_OnLine_Normal.svg +15 -0
- package/es/Map/SinglePoint/icon/Place_icon_OutLine_Hover.svg +15 -0
- package/es/Map/SinglePoint/icon/Place_icon_OutLine_Normal.svg +15 -0
- package/es/Map/SinglePoint/index.css +29 -0
- package/es/Map/SinglePoint/index.d.ts +7 -0
- package/es/Map/SinglePoint/index.js +32 -0
- package/es/Map/hook/useMapType.d.ts +4 -0
- package/es/Map/hook/useMapType.js +13 -0
- package/es/Map/icon.d.ts +2 -0
- package/es/Map/icon.js +10 -0
- package/es/Map/index.d.ts +23 -0
- package/es/Map/index.js +25 -0
- package/es/Map/interface.d.ts +55 -0
- package/es/Map/points.json +61247 -0
- package/es/{Picture/component/MoveContent → Map/useMarker}/index.css +0 -0
- package/es/Map/useMarker/index.d.ts +11 -0
- package/es/{WorkerFlow/Form/FormAuth.js → Map/useMarker/index.js} +57 -80
- package/es/Map/withMap/index.d.ts +2 -0
- package/es/Map/withMap/index.js +12 -0
- package/es/Picture/index.d.ts +1 -1
- package/es/Picture/index.js +2 -2
- package/es/Player/api/index.d.ts +1 -0
- package/es/Player/api/index.js +7 -1
- package/es/Player/demo.js +13 -21
- package/es/Player/event/index.js +5 -1
- package/es/Player/frontend_player.d.ts +1 -1
- package/es/Player/frontend_player.js +20 -13
- package/es/Player/frontend_timeline.d.ts +1 -1
- package/es/Player/live_heart.js +45 -12
- package/es/Player/message.js +23 -12
- package/es/Player/player.d.ts +31 -7
- package/es/Player/segment_player.d.ts +1 -1
- package/es/Player/segment_player.js +30 -18
- package/es/Player/segment_timeline.js +6 -6
- package/es/Player/single_player.js +50 -9
- package/es/Player/timeline.js +8 -6
- package/es/Player/util.d.ts +2 -1
- package/es/Player/util.js +4 -1
- package/es/PlayerExt/index.css +2 -2
- package/es/PlayerExt/index.d.ts +3 -1
- package/es/PlayerExt/index.js +19 -5
- package/es/ScreenPlayer/Live.d.ts +5 -0
- package/es/ScreenPlayer/Live.js +109 -0
- package/es/ScreenPlayer/LiveTools.d.ts +15 -0
- package/es/ScreenPlayer/LiveTools.js +95 -0
- package/es/ScreenPlayer/PlayerWithExt.d.ts +22 -0
- package/es/ScreenPlayer/PlayerWithExt.js +169 -0
- package/es/ScreenPlayer/Record.d.ts +5 -0
- package/es/{WorkerFlow/index.js → ScreenPlayer/Record.js} +290 -273
- package/es/ScreenPlayer/RecordTools.d.ts +17 -0
- package/es/ScreenPlayer/RecordTools.js +102 -0
- package/es/ScreenPlayer/SegmentTimeLine.d.ts +10 -0
- package/es/ScreenPlayer/SegmentTimeLine.js +40 -0
- package/es/ScreenPlayer/TimeSlider.d.ts +127 -0
- package/es/ScreenPlayer/TimeSlider.js +528 -0
- package/es/ScreenPlayer/demo.d.ts +2 -0
- package/es/ScreenPlayer/demo.js +25 -0
- package/es/ScreenPlayer/demo2.d.ts +2 -0
- package/es/ScreenPlayer/demo2.js +153 -0
- package/es/ScreenPlayer/index.css +50 -0
- package/es/ScreenPlayer/index.d.ts +6 -0
- package/es/ScreenPlayer/index.js +7 -0
- package/es/ScreenPlayer/interface.d.ts +81 -0
- package/es/ScreenPlayer/useRecordList.d.ts +3 -0
- package/es/{WorkerFlow/Form/UserAndGroupSelect.js → ScreenPlayer/useRecordList.js} +173 -176
- package/es/ScreenPlayer/useVideoFit.d.ts +5 -0
- package/es/ScreenPlayer/useVideoFit.js +46 -0
- package/es/ScreenPlayer/utils.d.ts +25 -0
- package/es/ScreenPlayer/utils.js +84 -0
- package/es/Tree/demo.js +9 -12
- package/es/Tree/index.css +55 -29
- package/es/Tree/index.d.ts +20 -19
- package/es/Tree/index.js +70 -185
- package/es/index.d.ts +7 -9
- package/es/index.js +7 -9
- package/es/useInfiniteScroll/index.d.ts +16 -0
- package/es/{useHttp → useInfiniteScroll}/index.js +79 -43
- package/es/useVirtualList/index.d.ts +13 -0
- package/es/useVirtualList/index.js +175 -0
- package/es/withErrorBoundary/index.d.ts +8 -0
- package/es/withErrorBoundary/index.js +43 -0
- package/package.json +18 -21
- package/test.js +48 -0
- package/es/DeviceIcon/icon.d.ts +0 -9
- package/es/DeviceIcon/icon.js +0 -138
- package/es/DeviceIcon/index.css +0 -8
- package/es/DeviceIcon/index.d.ts +0 -14
- package/es/DeviceIcon/index.js +0 -37
- package/es/DeviceSelect/TreeType.d.ts +0 -7
- package/es/DeviceSelect/TreeType.js +0 -36
- package/es/DeviceSelect/demo.d.ts +0 -3
- package/es/DeviceSelect/demo.js +0 -22
- package/es/DeviceSelect/index.css +0 -11
- package/es/DeviceSelect/index.d.ts +0 -13
- package/es/DeviceSelect/index.js +0 -191
- package/es/Dict/cache.d.ts +0 -3
- package/es/Dict/cache.js +0 -21
- package/es/Dict/device.d.ts +0 -28
- package/es/Dict/device.js +0 -117
- package/es/Dict/hook.d.ts +0 -3
- package/es/Dict/hook.js +0 -98
- package/es/Dict/index.d.ts +0 -9
- package/es/Dict/index.js +0 -10
- package/es/Dict/interface.d.ts +0 -16
- package/es/Dict/utils.d.ts +0 -10
- package/es/Dict/utils.js +0 -44
- package/es/InitialConfig/index.d.ts +0 -8
- package/es/InitialConfig/utils.d.ts +0 -20
- package/es/InitialConfig/utils.js +0 -110
- package/es/InitialRequest/index.d.ts +0 -9
- package/es/InitialRequest/index.js +0 -97
- package/es/InitialRequest/utils.d.ts +0 -10
- package/es/InitialRequest/utils.js +0 -116
- package/es/List/CheckExt.d.ts +0 -9
- package/es/List/CheckExt.js +0 -36
- package/es/List/DeviceList/index.d.ts +0 -11
- package/es/List/DeviceList/index.js +0 -50
- package/es/List/DynamicDeviceList/Demo.d.ts +0 -3
- package/es/List/DynamicDeviceList/index.css +0 -39
- package/es/List/DynamicDeviceList/index.d.ts +0 -12
- package/es/List/DynamicDeviceList/index.js +0 -205
- package/es/List/DynamicDeviceList/interface.d.ts +0 -37
- package/es/List/DynamicDeviceList/utils.d.ts +0 -16
- package/es/List/ListExt/index.css +0 -3
- package/es/List/ListExt/index.d.ts +0 -19
- package/es/List/ListExt/index.js +0 -44
- package/es/Picture/component/MoveContent/index.d.ts +0 -39
- package/es/Picture/component/MoveContent/index.js +0 -244
- package/es/Picture/component/MoveContent/utils.d.ts +0 -4
- package/es/Title/index.css +0 -25
- package/es/Title/index.d.ts +0 -12
- package/es/Title/index.js +0 -30
- package/es/Tree/BaseTree/index.css +0 -64
- package/es/Tree/BaseTree/index.d.ts +0 -24
- package/es/Tree/BaseTree/index.js +0 -83
- package/es/UserSelect/demo.d.ts +0 -3
- package/es/UserSelect/demo.js +0 -21
- package/es/UserSelect/index.css +0 -16
- package/es/UserSelect/index.d.ts +0 -18
- package/es/UserSelect/index.js +0 -194
- package/es/WorkerFlow/Demo.js +0 -57
- package/es/WorkerFlow/Form/Approver.d.ts +0 -10
- package/es/WorkerFlow/Form/Approver.js +0 -33
- package/es/WorkerFlow/Form/Condition.d.ts +0 -11
- package/es/WorkerFlow/Form/Condition.js +0 -235
- package/es/WorkerFlow/Form/EmptyUserSet.d.ts +0 -8
- package/es/WorkerFlow/Form/EmptyUserSet.js +0 -137
- package/es/WorkerFlow/Form/FormAuth.d.ts +0 -8
- package/es/WorkerFlow/Form/GroupList.d.ts +0 -12
- package/es/WorkerFlow/Form/GroupList.js +0 -44
- package/es/WorkerFlow/Form/GroupSelect.d.ts +0 -8
- package/es/WorkerFlow/Form/GroupSelect.js +0 -167
- package/es/WorkerFlow/Form/GroupSelectModalContent.d.ts +0 -6
- package/es/WorkerFlow/Form/GroupSelectModalContent.js +0 -177
- package/es/WorkerFlow/Form/Handle.d.ts +0 -10
- package/es/WorkerFlow/Form/Handle.js +0 -33
- package/es/WorkerFlow/Form/LevelGroupSelect.d.ts +0 -12
- package/es/WorkerFlow/Form/LevelGroupSelect.js +0 -208
- package/es/WorkerFlow/Form/Notifier.d.ts +0 -8
- package/es/WorkerFlow/Form/Notifier.js +0 -16
- package/es/WorkerFlow/Form/UserAndGroupSelect.d.ts +0 -8
- package/es/WorkerFlow/Form/UserSelect.d.ts +0 -8
- package/es/WorkerFlow/Form/UserSelect.js +0 -150
- package/es/WorkerFlow/Form/UserSelectModalContent.d.ts +0 -6
- package/es/WorkerFlow/Form/UserSelectModalContent.js +0 -166
- package/es/WorkerFlow/Form/UserSet.d.ts +0 -14
- package/es/WorkerFlow/Form/UserSet.js +0 -308
- package/es/WorkerFlow/Form/UsersHandleType.d.ts +0 -7
- package/es/WorkerFlow/Form/UsersHandleType.js +0 -32
- package/es/WorkerFlow/Form/utils.d.ts +0 -3
- package/es/WorkerFlow/Form/utils.js +0 -47
- package/es/WorkerFlow/Nodes/Add.d.ts +0 -7
- package/es/WorkerFlow/Nodes/Add.js +0 -98
- package/es/WorkerFlow/Nodes/AddOption.d.ts +0 -10
- package/es/WorkerFlow/Nodes/AddOption.js +0 -23
- package/es/WorkerFlow/Nodes/AddOptionList.d.ts +0 -8
- package/es/WorkerFlow/Nodes/AddOptionList.js +0 -46
- package/es/WorkerFlow/Nodes/Approver.d.ts +0 -11
- package/es/WorkerFlow/Nodes/Approver.js +0 -53
- package/es/WorkerFlow/Nodes/Condition.d.ts +0 -10
- package/es/WorkerFlow/Nodes/Condition.js +0 -140
- package/es/WorkerFlow/Nodes/Constants.d.ts +0 -35
- package/es/WorkerFlow/Nodes/Constants.js +0 -150
- package/es/WorkerFlow/Nodes/End.d.ts +0 -7
- package/es/WorkerFlow/Nodes/End.js +0 -16
- package/es/WorkerFlow/Nodes/Handle.d.ts +0 -11
- package/es/WorkerFlow/Nodes/Handle.js +0 -52
- package/es/WorkerFlow/Nodes/Node.d.ts +0 -8
- package/es/WorkerFlow/Nodes/Node.js +0 -26
- package/es/WorkerFlow/Nodes/Notifier.d.ts +0 -11
- package/es/WorkerFlow/Nodes/Notifier.js +0 -52
- package/es/WorkerFlow/Nodes/Render.d.ts +0 -8
- package/es/WorkerFlow/Nodes/Render.js +0 -16
- package/es/WorkerFlow/Nodes/Start.d.ts +0 -12
- package/es/WorkerFlow/Nodes/Start.js +0 -26
- package/es/WorkerFlow/Nodes/TitleElement.d.ts +0 -10
- package/es/WorkerFlow/Nodes/TitleElement.js +0 -127
- package/es/WorkerFlow/Nodes/Wrap.d.ts +0 -13
- package/es/WorkerFlow/Nodes/Wrap.js +0 -35
- package/es/WorkerFlow/OperatorContext.d.ts +0 -4
- package/es/WorkerFlow/OperatorContext.js +0 -3
- package/es/WorkerFlow/Tools.d.ts +0 -8
- package/es/WorkerFlow/Tools.js +0 -78
- package/es/WorkerFlow/XML/CanvasTag.d.ts +0 -3
- package/es/WorkerFlow/XML/CanvasTag.js +0 -142
- package/es/WorkerFlow/XML/EndEvent.d.ts +0 -1
- package/es/WorkerFlow/XML/EndEvent.js +0 -14
- package/es/WorkerFlow/XML/ExclusiveGateway.d.ts +0 -9
- package/es/WorkerFlow/XML/ExclusiveGateway.js +0 -101
- package/es/WorkerFlow/XML/Root.d.ts +0 -1
- package/es/WorkerFlow/XML/Root.js +0 -5
- package/es/WorkerFlow/XML/StartEvent.d.ts +0 -5
- package/es/WorkerFlow/XML/StartEvent.js +0 -28
- package/es/WorkerFlow/XML/UserTask.d.ts +0 -5
- package/es/WorkerFlow/XML/UserTask.js +0 -93
- package/es/WorkerFlow/XML/index.d.ts +0 -4
- package/es/WorkerFlow/XML/index.js +0 -100
- package/es/WorkerFlow/XML/utils.d.ts +0 -6
- package/es/WorkerFlow/XML/utils.js +0 -97
- package/es/WorkerFlow/data.json +0 -83
- package/es/WorkerFlow/index.css +0 -779
- package/es/WorkerFlow/index.d.ts +0 -13
- package/es/WorkerFlow/interface.d.ts +0 -93
- package/es/WorkerFlow/template.d.ts +0 -2
- package/es/WorkerFlow/template.js +0 -17
- package/es/WorkerFlow/utils.d.ts +0 -14
- package/es/WorkerFlow/utils.js +0 -212
- package/es/useHttp/index.d.ts +0 -8
|
@@ -5,5 +5,5 @@ import type { ISegmentPlayerProps } from './player';
|
|
|
5
5
|
* @param param0
|
|
6
6
|
* @returns
|
|
7
7
|
*/
|
|
8
|
-
declare function SegmentPlayer({ segments, begin, ...props }: ISegmentPlayerProps): JSX.Element;
|
|
8
|
+
declare function SegmentPlayer({ segments, begin, forwordRef, onCanPlayerInit, defaultIndex, customTimeLine, ...props }: ISegmentPlayerProps): JSX.Element;
|
|
9
9
|
export default SegmentPlayer;
|
|
@@ -22,6 +22,7 @@ import { __rest } from "tslib";
|
|
|
22
22
|
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
23
23
|
import SinglePlayer from './single_player';
|
|
24
24
|
import SegmentTimeLine from './segment_timeline';
|
|
25
|
+
import Events from './event/eventName';
|
|
25
26
|
/**
|
|
26
27
|
* @desc 计算第一个url
|
|
27
28
|
* @param segments
|
|
@@ -57,9 +58,12 @@ function getFirstUrlIndex(segments) {
|
|
|
57
58
|
*/
|
|
58
59
|
|
|
59
60
|
|
|
60
|
-
function usePlayIndex(event, segments
|
|
61
|
+
function usePlayIndex(event, segments) {
|
|
62
|
+
var defaultIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
63
|
+
var deps = arguments.length > 3 ? arguments[3] : undefined;
|
|
64
|
+
|
|
61
65
|
var _useState = useState({
|
|
62
|
-
index: getFirstUrlIndex(segments,
|
|
66
|
+
index: getFirstUrlIndex(segments, defaultIndex)
|
|
63
67
|
}),
|
|
64
68
|
_useState2 = _slicedToArray(_useState, 2),
|
|
65
69
|
state = _useState2[0],
|
|
@@ -124,11 +128,20 @@ function usePlayIndex(event, segments, deps) {
|
|
|
124
128
|
|
|
125
129
|
|
|
126
130
|
function SegmentPlayer(_a) {
|
|
127
|
-
var _b;
|
|
128
|
-
|
|
129
131
|
var segments = _a.segments,
|
|
130
132
|
begin = _a.begin,
|
|
131
|
-
|
|
133
|
+
forwordRef = _a.forwordRef,
|
|
134
|
+
_onCanPlayerInit = _a.onCanPlayerInit,
|
|
135
|
+
defaultIndex = _a.defaultIndex,
|
|
136
|
+
customTimeLine = _a.customTimeLine,
|
|
137
|
+
props = __rest(_a, ["segments", "begin", "forwordRef", "onCanPlayerInit", "defaultIndex", "customTimeLine"]);
|
|
138
|
+
|
|
139
|
+
var ref = useRef(null);
|
|
140
|
+
var playRef = forwordRef ? forwordRef : ref;
|
|
141
|
+
|
|
142
|
+
var _ref = playRef.current || {},
|
|
143
|
+
api = _ref.api,
|
|
144
|
+
event = _ref.event;
|
|
132
145
|
|
|
133
146
|
var _useState3 = useState({
|
|
134
147
|
forceKey: Date.now()
|
|
@@ -139,14 +152,13 @@ function SegmentPlayer(_a) {
|
|
|
139
152
|
|
|
140
153
|
var duration = useMemo(function () {
|
|
141
154
|
return segments === null || segments === void 0 ? void 0 : segments.map(function (v) {
|
|
142
|
-
return v.
|
|
155
|
+
return (v.endTime - v.beginTime) / 1000;
|
|
143
156
|
}).reduce(function (a, b) {
|
|
144
157
|
return a + b;
|
|
145
158
|
}, 0);
|
|
146
159
|
}, [segments]);
|
|
147
|
-
var playerRef = useRef(null);
|
|
148
160
|
|
|
149
|
-
var _usePlayIndex = usePlayIndex(
|
|
161
|
+
var _usePlayIndex = usePlayIndex(event, segments, defaultIndex, [state.forceKey]),
|
|
150
162
|
index = _usePlayIndex.index,
|
|
151
163
|
setIndex = _usePlayIndex.setIndex;
|
|
152
164
|
|
|
@@ -155,28 +167,28 @@ function SegmentPlayer(_a) {
|
|
|
155
167
|
}, [segments, index]); // 重置reload
|
|
156
168
|
|
|
157
169
|
var reload = function reload() {
|
|
170
|
+
playRef.current.event.emit(Events.RELOAD);
|
|
158
171
|
setIndex(0);
|
|
159
|
-
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
var _ref = playerRef.current || {},
|
|
163
|
-
api = _ref.api,
|
|
164
|
-
event = _ref.event; // 秒级别转换
|
|
172
|
+
playRef.current.api.reload();
|
|
173
|
+
}; // 秒级别转换
|
|
165
174
|
|
|
166
175
|
|
|
167
176
|
var beginTemp = useMemo(function () {
|
|
168
177
|
return begin ? String(begin).length === 10 ? Math.floor(begin * 1000) : begin : begin;
|
|
169
178
|
}, []);
|
|
170
179
|
return /*#__PURE__*/React.createElement(SinglePlayer, Object.assign({
|
|
171
|
-
ref:
|
|
180
|
+
ref: playRef,
|
|
172
181
|
url: url,
|
|
173
182
|
reload: reload,
|
|
174
183
|
onCanPlayerInit: function onCanPlayerInit() {
|
|
175
|
-
|
|
184
|
+
setState({
|
|
176
185
|
forceKey: Date.now()
|
|
177
186
|
});
|
|
187
|
+
_onCanPlayerInit && _onCanPlayerInit({
|
|
188
|
+
setIndex: setIndex
|
|
189
|
+
});
|
|
178
190
|
},
|
|
179
|
-
customTimeLine: api && event
|
|
191
|
+
customTimeLine: api && event && (customTimeLine || /*#__PURE__*/React.createElement(SegmentTimeLine, {
|
|
180
192
|
begin: beginTemp,
|
|
181
193
|
api: api,
|
|
182
194
|
event: event,
|
|
@@ -184,7 +196,7 @@ function SegmentPlayer(_a) {
|
|
|
184
196
|
segments: segments,
|
|
185
197
|
duration: duration,
|
|
186
198
|
setIndex: setIndex
|
|
187
|
-
})
|
|
199
|
+
}))
|
|
188
200
|
}, props));
|
|
189
201
|
}
|
|
190
202
|
|
|
@@ -36,7 +36,7 @@ function SegmentTimeLine(_ref) {
|
|
|
36
36
|
|
|
37
37
|
var indexDuration = useMemo(function () {
|
|
38
38
|
return segments.map(function (v) {
|
|
39
|
-
return v.
|
|
39
|
+
return (v.endTime - v.beginTime) / 1000;
|
|
40
40
|
}).reduce(function (a, b, i) {
|
|
41
41
|
return i >= index ? a : a + b;
|
|
42
42
|
}, 0);
|
|
@@ -85,7 +85,7 @@ function SegmentTimeLine(_ref) {
|
|
|
85
85
|
return seekWithLine(e, i);
|
|
86
86
|
},
|
|
87
87
|
style: {
|
|
88
|
-
width: "".concat(v.
|
|
88
|
+
width: "".concat((v.endTime / 1000 - v.beginTime / 1000) / duration * 100, "%")
|
|
89
89
|
}
|
|
90
90
|
}));
|
|
91
91
|
}), /*#__PURE__*/React.createElement("div", {
|
|
@@ -110,7 +110,7 @@ function TipTitle(_ref2) {
|
|
|
110
110
|
if (index === 0) {
|
|
111
111
|
var _start = begin;
|
|
112
112
|
|
|
113
|
-
var _end = begin + segments[0].
|
|
113
|
+
var _end = begin + (segments[0].endTime - segments[0].beginTime);
|
|
114
114
|
|
|
115
115
|
return {
|
|
116
116
|
start: dateFormat(_start),
|
|
@@ -119,12 +119,12 @@ function TipTitle(_ref2) {
|
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
var indexDuration = segments.map(function (v) {
|
|
122
|
-
return v.
|
|
122
|
+
return v.endTime - v.beginTime;
|
|
123
123
|
}).reduce(function (a, b, i) {
|
|
124
124
|
return i >= index ? a : a + b;
|
|
125
125
|
}, 0);
|
|
126
|
-
var start = begin + indexDuration
|
|
127
|
-
var end = start + segments[index].
|
|
126
|
+
var start = begin + indexDuration;
|
|
127
|
+
var end = start + (segments[index].endTime - segments[index].beginTime);
|
|
128
128
|
return {
|
|
129
129
|
start: dateFormat(start),
|
|
130
130
|
end: dateFormat(end)
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import _useToggle3 from "ahooks/es/useToggle";
|
|
2
|
+
|
|
1
3
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
4
|
|
|
3
5
|
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."); }
|
|
@@ -55,7 +57,12 @@ var SinglePlayer = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
55
57
|
}),
|
|
56
58
|
_useState2 = _slicedToArray(_useState, 2),
|
|
57
59
|
state = _useState2[0],
|
|
58
|
-
setState = _useState2[1];
|
|
60
|
+
setState = _useState2[1];
|
|
61
|
+
|
|
62
|
+
var _useToggle = _useToggle3('contain', 'fill'),
|
|
63
|
+
_useToggle2 = _slicedToArray(_useToggle, 2),
|
|
64
|
+
fit = _useToggle2[0],
|
|
65
|
+
toggle = _useToggle2[1].toggle; // 视频格式判断,外部可以强制指定,也可以通过url自动判断
|
|
59
66
|
|
|
60
67
|
|
|
61
68
|
var vType = useMemo(function () {
|
|
@@ -93,30 +100,61 @@ var SinglePlayer = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
93
100
|
}, []); // 特殊接口实现 reload是可能被重写的,但是API只暴露原生的方法
|
|
94
101
|
|
|
95
102
|
var reload = function reload() {
|
|
96
|
-
return playReload(video, flv, hls, url);
|
|
103
|
+
return playReload(video, event, flv, hls, url);
|
|
97
104
|
};
|
|
98
105
|
|
|
99
106
|
var unload = function unload() {
|
|
100
107
|
return playUnload(video, flv, hls);
|
|
101
|
-
}; // 合并api
|
|
108
|
+
}; // 合并api,加上代理
|
|
102
109
|
|
|
103
110
|
|
|
104
111
|
var playApi = useMemo(function () {
|
|
105
|
-
|
|
112
|
+
if (!api) {
|
|
113
|
+
return undefined;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
var map = {
|
|
106
117
|
reload: reload,
|
|
107
|
-
unload: unload
|
|
118
|
+
unload: unload,
|
|
119
|
+
toggleFit: toggle
|
|
120
|
+
};
|
|
121
|
+
return new Proxy(api, {
|
|
122
|
+
get: function get(target, key) {
|
|
123
|
+
var _a;
|
|
124
|
+
|
|
125
|
+
return (_a = map[key]) !== null && _a !== void 0 ? _a : target[key];
|
|
126
|
+
},
|
|
127
|
+
set: function set() {
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
108
130
|
});
|
|
109
|
-
}, [api]); //
|
|
131
|
+
}, [api]); // 代理Event
|
|
132
|
+
|
|
133
|
+
var playEvent = useMemo(function () {
|
|
134
|
+
if (!event) {
|
|
135
|
+
return undefined;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return new Proxy(event, {
|
|
139
|
+
get: function get(target, key) {
|
|
140
|
+
return target[key];
|
|
141
|
+
},
|
|
142
|
+
set: function set() {
|
|
143
|
+
return true;
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
}, [event]); // ref暴露接口
|
|
110
147
|
|
|
111
148
|
useImperativeHandle(ref, function () {
|
|
112
149
|
return {
|
|
113
150
|
video: video,
|
|
114
151
|
container: state.container,
|
|
115
152
|
api: playApi,
|
|
116
|
-
event:
|
|
117
|
-
plugins: [flv, hls]
|
|
153
|
+
event: playEvent,
|
|
154
|
+
plugins: [flv, hls],
|
|
155
|
+
fit: fit
|
|
118
156
|
};
|
|
119
|
-
}, [api, event, video]);
|
|
157
|
+
}, [api, event, video, fit]);
|
|
120
158
|
useEffect(function () {
|
|
121
159
|
if (api && event && video) {
|
|
122
160
|
props.onCanPlayerInit && props.onCanPlayerInit();
|
|
@@ -128,6 +166,9 @@ var SinglePlayer = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
128
166
|
}, /*#__PURE__*/React.createElement("div", {
|
|
129
167
|
className: "player-mask-layout"
|
|
130
168
|
}, /*#__PURE__*/React.createElement("video", {
|
|
169
|
+
style: {
|
|
170
|
+
objectFit: fit
|
|
171
|
+
},
|
|
131
172
|
autoPlay: autoPlay,
|
|
132
173
|
preload: preload,
|
|
133
174
|
muted: muted,
|
package/es/Player/timeline.js
CHANGED
|
@@ -22,11 +22,11 @@ export function useTimes(api, event, isHide) {
|
|
|
22
22
|
state = _useState2[0],
|
|
23
23
|
setState = _useState2[1];
|
|
24
24
|
|
|
25
|
-
if (isHide) {
|
|
26
|
-
return [0, 0, 0];
|
|
27
|
-
}
|
|
28
|
-
|
|
29
25
|
useEffect(function () {
|
|
26
|
+
if (isHide) {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
30
|
var getCurrentTime = function getCurrentTime() {
|
|
31
31
|
return setState(function (old) {
|
|
32
32
|
return Object.assign(Object.assign({}, old), {
|
|
@@ -58,8 +58,10 @@ export function useTimes(api, event, isHide) {
|
|
|
58
58
|
event.removeEventListener('suspend', getBuffered);
|
|
59
59
|
event.removeEventListener('seeked', seekendPlay);
|
|
60
60
|
};
|
|
61
|
-
}, [event, api]);
|
|
62
|
-
return
|
|
61
|
+
}, [event, api, isHide]);
|
|
62
|
+
return useMemo(function () {
|
|
63
|
+
return [state.currentTime, state.buffered, api.getDuration()];
|
|
64
|
+
}, [state.currentTime, state.buffered]);
|
|
63
65
|
}
|
|
64
66
|
|
|
65
67
|
function TimeLine(_ref) {
|
package/es/Player/util.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Flvjs from 'flv.zv.js';
|
|
2
2
|
import Hls, { HlsConfig } from 'hls.js';
|
|
3
|
+
import type VideoEventInstance from './event';
|
|
3
4
|
import type { FlvPlayerConfig } from './player';
|
|
4
5
|
/**
|
|
5
6
|
* 创建HLS对象
|
|
@@ -13,7 +14,7 @@ export declare function createHlsPlayer(video: HTMLVideoElement, url: string, hl
|
|
|
13
14
|
* @param {*} options
|
|
14
15
|
*/
|
|
15
16
|
export declare function createFlvPlayer(video: HTMLVideoElement, url: string, isLive?: boolean, flvConfig?: FlvPlayerConfig): Flvjs.Player;
|
|
16
|
-
export declare const playReload: (video: HTMLVideoElement, flv?: Flvjs.Player, hls?: Hls, url?: string) => void;
|
|
17
|
+
export declare const playReload: (video: HTMLVideoElement, event: VideoEventInstance, flv?: Flvjs.Player, hls?: Hls, url?: string) => void;
|
|
17
18
|
export declare const playUnload: (video: HTMLVideoElement, flv?: Flvjs.Player, hls?: Hls) => void;
|
|
18
19
|
/**
|
|
19
20
|
* 获取播放文件类型
|
package/es/Player/util.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Flvjs from 'flv.zv.js';
|
|
2
2
|
import Hls from 'hls.js';
|
|
3
|
+
import Events from './event/eventName';
|
|
3
4
|
/**
|
|
4
5
|
* 创建HLS对象
|
|
5
6
|
* @param {*} video
|
|
@@ -54,7 +55,7 @@ export function createFlvPlayer(video, url, isLive, flvConfig) {
|
|
|
54
55
|
player.load();
|
|
55
56
|
return player;
|
|
56
57
|
}
|
|
57
|
-
export var playReload = function playReload(video, flv, hls, url) {
|
|
58
|
+
export var playReload = function playReload(video, event, flv, hls, url) {
|
|
58
59
|
video.pause();
|
|
59
60
|
video.removeAttribute('src');
|
|
60
61
|
|
|
@@ -77,6 +78,8 @@ export var playReload = function playReload(video, flv, hls, url) {
|
|
|
77
78
|
video.setAttribute('src', url);
|
|
78
79
|
video.play();
|
|
79
80
|
}
|
|
81
|
+
|
|
82
|
+
event.emit(Events.RELOAD);
|
|
80
83
|
};
|
|
81
84
|
export var playUnload = function playUnload(video, flv, hls) {
|
|
82
85
|
video.pause();
|
package/es/PlayerExt/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.lm-player-ext-
|
|
1
|
+
.lm-player-ext-layout {
|
|
2
2
|
background-color: #000;
|
|
3
3
|
width: 100%;
|
|
4
4
|
height: 100%;
|
|
@@ -8,6 +8,6 @@
|
|
|
8
8
|
align-items: center;
|
|
9
9
|
justify-content: center;
|
|
10
10
|
}
|
|
11
|
-
.lm-player-ext-
|
|
11
|
+
.lm-player-ext-layout .lm-player-PlaySource {
|
|
12
12
|
font-size: 66px;
|
|
13
13
|
}
|
package/es/PlayerExt/index.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { ISegmentType } from 'src/Player/player';
|
|
2
3
|
import './index.less';
|
|
3
4
|
export declare type PlayModeType = 1 | 2;
|
|
4
5
|
export interface IPluginProps {
|
|
5
6
|
url?: string;
|
|
7
|
+
segments?: ISegmentType[];
|
|
6
8
|
children: JSX.Element;
|
|
7
9
|
/**
|
|
8
10
|
* @description 模式1浏览器模式,2插件模式
|
|
@@ -38,5 +40,5 @@ export declare function getLocalPlayPath(url: string, params?: string): string;
|
|
|
38
40
|
export declare function usePlugin(mode: PlayModeType, key: any): {
|
|
39
41
|
needInstall: boolean;
|
|
40
42
|
};
|
|
41
|
-
export declare function ExtModel({ url, children, mode, pluginDownloadUrl, pluginParams }: IPluginProps): JSX.Element;
|
|
43
|
+
export declare function ExtModel({ url, children, mode, pluginDownloadUrl, segments, pluginParams }: IPluginProps): JSX.Element;
|
|
42
44
|
export { ExtModel as default };
|
package/es/PlayerExt/index.js
CHANGED
|
@@ -77,6 +77,7 @@ export function ExtModel(_ref) {
|
|
|
77
77
|
children = _ref.children,
|
|
78
78
|
mode = _ref.mode,
|
|
79
79
|
pluginDownloadUrl = _ref.pluginDownloadUrl,
|
|
80
|
+
segments = _ref.segments,
|
|
80
81
|
pluginParams = _ref.pluginParams;
|
|
81
82
|
|
|
82
83
|
var _useState3 = useState({
|
|
@@ -87,8 +88,10 @@ export function ExtModel(_ref) {
|
|
|
87
88
|
setState = _useState4[1];
|
|
88
89
|
|
|
89
90
|
var hasUrl = useMemo(function () {
|
|
90
|
-
return !!url
|
|
91
|
-
|
|
91
|
+
return !!url || Array.isArray(segments) && segments.find(function (v) {
|
|
92
|
+
return v.url;
|
|
93
|
+
});
|
|
94
|
+
}, [url, segments]);
|
|
92
95
|
|
|
93
96
|
var _usePlugin = usePlugin(mode, state.forceKey),
|
|
94
97
|
needInstall = _usePlugin.needInstall;
|
|
@@ -96,10 +99,17 @@ export function ExtModel(_ref) {
|
|
|
96
99
|
var playUrl = useMemo(function () {
|
|
97
100
|
return mode === 2 && url ? getLocalPlayPath(url, pluginParams) : url;
|
|
98
101
|
}, [url, mode]);
|
|
102
|
+
var playSegments = useMemo(function () {
|
|
103
|
+
return mode === 2 && segments ? segments.map(function (v) {
|
|
104
|
+
return Object.assign(Object.assign({}, v), {
|
|
105
|
+
url: v.url ? getLocalPlayPath(v.url, pluginParams) : v.url
|
|
106
|
+
});
|
|
107
|
+
}) : segments;
|
|
108
|
+
}, [segments, mode]);
|
|
99
109
|
|
|
100
110
|
if (needInstall) {
|
|
101
111
|
return /*#__PURE__*/React.createElement("div", {
|
|
102
|
-
className: "lm-player-ext-
|
|
112
|
+
className: "lm-player-ext-layout"
|
|
103
113
|
}, /*#__PURE__*/React.createElement("div", {
|
|
104
114
|
style: {
|
|
105
115
|
marginTop: -60,
|
|
@@ -132,14 +142,18 @@ export function ExtModel(_ref) {
|
|
|
132
142
|
|
|
133
143
|
if (!hasUrl) {
|
|
134
144
|
return /*#__PURE__*/React.createElement("div", {
|
|
135
|
-
className: "lm-player-ext-
|
|
145
|
+
className: "lm-player-ext-layout"
|
|
136
146
|
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
137
147
|
type: "lm-player-PlaySource"
|
|
138
148
|
}));
|
|
139
149
|
}
|
|
140
150
|
|
|
141
|
-
return /*#__PURE__*/React.createElement(
|
|
151
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
152
|
+
className: "lm-player-ext-layout"
|
|
153
|
+
}, /*#__PURE__*/React.cloneElement(children, url ? {
|
|
142
154
|
url: playUrl
|
|
155
|
+
} : {
|
|
156
|
+
segments: playSegments
|
|
143
157
|
}));
|
|
144
158
|
}
|
|
145
159
|
export { ExtModel as default };
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
|
|
3
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
|
|
5
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
+
|
|
7
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
8
|
+
|
|
9
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
10
|
+
|
|
11
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
+
|
|
13
|
+
import React, { useMemo, useRef, useState } from 'react';
|
|
14
|
+
import { ScreenType, mergeFill } from './utils';
|
|
15
|
+
import { LivePlayerWithExt } from './PlayerWithExt';
|
|
16
|
+
import Tools from './LiveTools';
|
|
17
|
+
import "./index.css";
|
|
18
|
+
|
|
19
|
+
function LivePlayer(_ref) {
|
|
20
|
+
var _ref$list = _ref.list,
|
|
21
|
+
list = _ref$list === void 0 ? [] : _ref$list,
|
|
22
|
+
children = _ref.children;
|
|
23
|
+
|
|
24
|
+
var _useState = useState({
|
|
25
|
+
screenNum: 4,
|
|
26
|
+
selectIndex: 0,
|
|
27
|
+
mode: 1
|
|
28
|
+
}),
|
|
29
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
30
|
+
state = _useState2[0],
|
|
31
|
+
setState = _useState2[1];
|
|
32
|
+
|
|
33
|
+
var domRef = useRef(null); // 缓存所有player对象
|
|
34
|
+
|
|
35
|
+
var playerRef = useRef([]);
|
|
36
|
+
var screenType = useMemo(function () {
|
|
37
|
+
return ScreenType.find(function (v) {
|
|
38
|
+
return v.name === state.screenNum;
|
|
39
|
+
});
|
|
40
|
+
}, [state.screenNum]);
|
|
41
|
+
var screenList = useMemo(function () {
|
|
42
|
+
return mergeFill(state.screenNum, list, {});
|
|
43
|
+
}, [list, state.screenNum]); // 获取选中player对象
|
|
44
|
+
|
|
45
|
+
var getPlayerItem = function getPlayerItem() {
|
|
46
|
+
var _a;
|
|
47
|
+
|
|
48
|
+
return (_a = playerRef.current[state.selectIndex]) === null || _a === void 0 ? void 0 : _a.current;
|
|
49
|
+
}; // 更新状态
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
var updateState = function updateState(newState) {
|
|
53
|
+
var obj = {};
|
|
54
|
+
|
|
55
|
+
if (newState.hasOwnProperty('screenNum')) {
|
|
56
|
+
obj.screenNum = newState.screenNum;
|
|
57
|
+
|
|
58
|
+
if (obj.screenNum < state.selectIndex) {
|
|
59
|
+
obj.selectIndex = 0;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (newState.hasOwnProperty('mode')) {
|
|
64
|
+
obj.mode = newState.mode;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
setState(function (old) {
|
|
68
|
+
return Object.assign(Object.assign({}, old), obj);
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
73
|
+
className: "split-screen-player-wrapper",
|
|
74
|
+
ref: domRef
|
|
75
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
76
|
+
className: "player-layout"
|
|
77
|
+
}, screenList.map(function (item, index) {
|
|
78
|
+
return /*#__PURE__*/React.createElement(LivePlayerWithExt, Object.assign({}, item, {
|
|
79
|
+
mode: state.mode,
|
|
80
|
+
isLive: true,
|
|
81
|
+
key: "".concat(item.url, "-").concat(index),
|
|
82
|
+
updatePlayer: function updatePlayer(player) {
|
|
83
|
+
return playerRef.current[index] = player;
|
|
84
|
+
},
|
|
85
|
+
className: state.selectIndex === index ? 'player-current-index' : '',
|
|
86
|
+
onClick: function onClick() {
|
|
87
|
+
return setState(function (old) {
|
|
88
|
+
return Object.assign(Object.assign({}, old), {
|
|
89
|
+
selectIndex: index
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
},
|
|
93
|
+
style: {
|
|
94
|
+
width: screenType.width,
|
|
95
|
+
height: screenType.height
|
|
96
|
+
}
|
|
97
|
+
}));
|
|
98
|
+
})), /*#__PURE__*/React.createElement(Tools, {
|
|
99
|
+
getPlayerItem: getPlayerItem,
|
|
100
|
+
screenNum: state.screenNum,
|
|
101
|
+
mode: state.mode,
|
|
102
|
+
containerRef: domRef,
|
|
103
|
+
updateState: updateState
|
|
104
|
+
}), children && /*#__PURE__*/React.cloneElement(children, {
|
|
105
|
+
selectIndex: state.selectIndex
|
|
106
|
+
}));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export default LivePlayer;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ExportPlayerType } from '../Player/player';
|
|
3
|
+
import { PlayModeType } from '../PlayerExt';
|
|
4
|
+
interface IToolsProps {
|
|
5
|
+
containerRef: React.MutableRefObject<HTMLDivElement>;
|
|
6
|
+
updateState: (state: {
|
|
7
|
+
screenNum?: number;
|
|
8
|
+
mode?: PlayModeType;
|
|
9
|
+
}) => void;
|
|
10
|
+
screenNum: number;
|
|
11
|
+
mode: PlayModeType;
|
|
12
|
+
getPlayerItem: () => ExportPlayerType | undefined;
|
|
13
|
+
}
|
|
14
|
+
declare function LiveTools({ containerRef, updateState, screenNum, getPlayerItem, mode }: IToolsProps): JSX.Element;
|
|
15
|
+
export default LiveTools;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import _useFullscreen3 from "ahooks/es/useFullscreen";
|
|
2
|
+
|
|
3
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
+
|
|
5
|
+
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
|
+
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 _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
10
|
+
|
|
11
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
12
|
+
|
|
13
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
|
+
|
|
15
|
+
import React from 'react';
|
|
16
|
+
import { ScreenType } from './utils';
|
|
17
|
+
|
|
18
|
+
function LiveTools(_ref) {
|
|
19
|
+
var containerRef = _ref.containerRef,
|
|
20
|
+
updateState = _ref.updateState,
|
|
21
|
+
screenNum = _ref.screenNum,
|
|
22
|
+
getPlayerItem = _ref.getPlayerItem,
|
|
23
|
+
mode = _ref.mode;
|
|
24
|
+
|
|
25
|
+
var _useFullscreen = _useFullscreen3(containerRef),
|
|
26
|
+
_useFullscreen2 = _slicedToArray(_useFullscreen, 2),
|
|
27
|
+
isFullscreen = _useFullscreen2[0],
|
|
28
|
+
toggleFullscreen = _useFullscreen2[1].toggleFullscreen; // 播放状态控制
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
var playToggle = function playToggle() {
|
|
32
|
+
var player = getPlayerItem();
|
|
33
|
+
player ? player.video.paused ? player.api.play() : player.api.pause() : undefined;
|
|
34
|
+
}; // 重连
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
var reload = function reload() {
|
|
38
|
+
var player = getPlayerItem();
|
|
39
|
+
player ? player.reload ? player.reload() : player.api.reload() : undefined;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
var snapshot = function snapshot() {
|
|
43
|
+
var player = getPlayerItem();
|
|
44
|
+
return player ? player.api.snapshot() : undefined;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
48
|
+
className: "player-tools"
|
|
49
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
50
|
+
className: "split-num"
|
|
51
|
+
}, ScreenType.map(function (item) {
|
|
52
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
53
|
+
key: "".concat(item.name),
|
|
54
|
+
style: {
|
|
55
|
+
padding: 6
|
|
56
|
+
},
|
|
57
|
+
onClick: function onClick() {
|
|
58
|
+
return updateState({
|
|
59
|
+
screenNum: item.name
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}, item.name);
|
|
63
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
64
|
+
style: {
|
|
65
|
+
padding: 6
|
|
66
|
+
},
|
|
67
|
+
onClick: toggleFullscreen
|
|
68
|
+
}, isFullscreen ? '退出' : '全屏'), /*#__PURE__*/React.createElement("span", {
|
|
69
|
+
style: {
|
|
70
|
+
padding: 6
|
|
71
|
+
},
|
|
72
|
+
onClick: function onClick() {
|
|
73
|
+
return updateState({
|
|
74
|
+
mode: mode === 1 ? 2 : 1
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}, "\u5207\u6362", mode === 1 ? '插件' : '浏览器', "\u6A21\u5F0F"), /*#__PURE__*/React.createElement("span", {
|
|
78
|
+
style: {
|
|
79
|
+
padding: 6
|
|
80
|
+
},
|
|
81
|
+
onClick: playToggle
|
|
82
|
+
}, "\u64AD\u653E/\u6682\u505C"), /*#__PURE__*/React.createElement("span", {
|
|
83
|
+
style: {
|
|
84
|
+
padding: 6
|
|
85
|
+
},
|
|
86
|
+
onClick: reload
|
|
87
|
+
}, "\u91CD\u8FDE"), /*#__PURE__*/React.createElement("span", {
|
|
88
|
+
style: {
|
|
89
|
+
padding: 6
|
|
90
|
+
},
|
|
91
|
+
onClick: snapshot
|
|
92
|
+
}, "\u622A\u56FE")));
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export default LiveTools;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ExportPlayerType, ISegmentType, ISinglePlayerProps } from 'src/Player/player';
|
|
3
|
+
import type { PlayModeType } from 'src/PlayerExt';
|
|
4
|
+
interface ILivePlayerWithExtProps extends ISinglePlayerProps {
|
|
5
|
+
mode?: PlayModeType;
|
|
6
|
+
style: React.CSSProperties;
|
|
7
|
+
onClick: () => void;
|
|
8
|
+
updatePlayer: (obj: React.MutableRefObject<ExportPlayerType>) => void;
|
|
9
|
+
pluginDownloadUrl?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function LivePlayerWithExt({ mode, isLive, url, type, style, className, updatePlayer, onClick, pluginDownloadUrl, ...props }: ILivePlayerWithExtProps): JSX.Element;
|
|
12
|
+
interface ISegmentPlayerWithExtProps extends Omit<ILivePlayerWithExtProps, 'url' | 'mode'> {
|
|
13
|
+
segments?: ISegmentType[];
|
|
14
|
+
begin?: number;
|
|
15
|
+
}
|
|
16
|
+
export declare function SegmentPlayerWithExt({ begin, style, className, segments, updatePlayer, onClick, ...props }: ISegmentPlayerWithExtProps): JSX.Element;
|
|
17
|
+
interface IFrontendPlayerWithExtProps extends Omit<ILivePlayerWithExtProps, 'url'> {
|
|
18
|
+
segments?: ISegmentType[];
|
|
19
|
+
begin?: number;
|
|
20
|
+
}
|
|
21
|
+
export declare function FrontendPlayerWithExt({ mode, style, className, segments, updatePlayer, onClick, pluginDownloadUrl }: IFrontendPlayerWithExtProps): JSX.Element;
|
|
22
|
+
export {};
|