@cloud-app-dev/vidc 3.2.17 → 3.2.18
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/.prettierrc.js +1 -1
- package/.stylelintrc.js +113 -0
- package/es/AppContext/index.js +3 -4
- package/es/Box/InfoBox/index.less +8 -6
- package/es/Box/TwoColumnBox/index.less +32 -22
- package/es/Box/index.less +1 -1
- package/es/CheckGroupFixed/index.less +17 -14
- package/es/CustomRenderSelect/index.less +7 -7
- package/es/DisableMark/index.less +3 -3
- package/es/DomMove/index.js +5 -5
- package/es/Drag/DragAndDropItem.js +1 -2
- package/es/Drag/DropItem.js +2 -2
- package/es/Drag/index.d.ts +9 -7
- package/es/Drawer/index.js +19 -20
- package/es/Drawer/index.less +8 -8
- package/es/Drawer/interface.d.ts +4 -3
- package/es/DynamicList/index.less +2 -0
- package/es/FullScreen/index.less +6 -4
- package/es/GridList/index.js +1 -1
- package/es/GridList/index.less +1 -1
- package/es/ImageView/index.less +2 -1
- package/es/Input/index.less +1 -1
- package/es/LabelValue/index.less +5 -2
- package/es/List/index.less +2 -2
- package/es/ListWithSizeAnimate/demo.js +0 -1
- package/es/ListWithSizeAnimate/index.js +18 -28
- package/es/ListWithSizeAnimate/index.less +10 -6
- package/es/Map/BasicMap/index.less +8 -3
- package/es/Map/ClusterLayer/index.less +8 -6
- package/es/Map/FindPio/index.less +2 -2
- package/es/Map/LevelCenter/index.js +3 -4
- package/es/Map/MapDrawSelect/index.js +2 -3
- package/es/Map/ResetTools/index.less +10 -6
- package/es/Map/SinglePoint/index.less +3 -3
- package/es/Map/useMarker/index.js +1 -1
- package/es/Modal/index.js +17 -17
- package/es/Modal/index.less +10 -11
- package/es/Picture/component/DefaultRects/index.js +3 -1
- package/es/Picture/component/DefaultRects/index.less +51 -28
- package/es/Picture/component/DrawRect/index.js +3 -1
- package/es/Picture/component/DrawRect/index.less +2 -2
- package/es/Picture/component/RectMenu/index.less +11 -6
- package/es/Picture/component/Tools/index.js +1 -1
- package/es/Picture/component/Tools/index.less +12 -6
- package/es/Picture/index.js +50 -26
- package/es/Picture/index.less +3 -2
- package/es/Picture/useDraw.js +1 -1
- package/es/Picture/utils.js +35 -34
- package/es/Player/api/index.js +67 -35
- package/es/Player/contraller_bar/contraller_event.js +4 -4
- package/es/Player/contraller_bar/left_bar.js +12 -10
- package/es/Player/empty.js +6 -0
- package/es/Player/event/errorEvent.js +7 -8
- package/es/Player/event/index.js +1 -1
- package/es/Player/fps_play.js +10 -8
- package/es/Player/frontend_player.js +13 -10
- package/es/Player/frontend_timeline.js +41 -41
- package/es/Player/live_heart.js +15 -5
- package/es/Player/message.js +5 -5
- package/es/Player/segment_player.js +31 -24
- package/es/Player/segment_timeline.js +71 -71
- package/es/Player/single_player.js +17 -21
- package/es/Player/style/bar.less +13 -9
- package/es/Player/style/index.less +8 -4
- package/es/Player/style/message.less +22 -16
- package/es/Player/style/slider.less +40 -37
- package/es/Player/style/timeline.less +43 -33
- package/es/Player/style/volume.less +7 -4
- package/es/Player/timeline.js +16 -8
- package/es/Player/util.js +82 -58
- package/es/PlayerExt/index.less +2 -2
- package/es/Progress/index.d.ts +8 -11
- package/es/Progress/index.less +5 -4
- package/es/ROI/index.less +8 -4
- package/es/ScreenPlayer/index.less +49 -26
- package/es/TableLayout/index.less +1 -1
- package/es/ThemeAntd/demo.less +4 -3
- package/es/ThemeAntd/index.less +12 -12
- package/es/ThemeAntd/style/button.less +4 -4
- package/es/ThemeAntd/style/checkbox.less +3 -3
- package/es/ThemeAntd/style/input.less +7 -7
- package/es/ThemeAntd/style/pagination.less +4 -4
- package/es/ThemeAntd/style/picker.less +5 -5
- package/es/ThemeAntd/style/radio.less +2 -2
- package/es/ThemeAntd/style/scrollbar.less +5 -3
- package/es/ThemeAntd/style/select.less +8 -8
- package/es/ThemeAntd/style/table.less +4 -4
- package/es/Tree/index.less +13 -12
- package/es/VList/index.d.ts +12 -18
- package/es/useSimpleState/index.js +1 -1
- package/package.json +12 -6
- package/tsconfig.json +12 -0
- package/es/Api/index.d.ts +0 -12
- package/es/AppContext/Sync.d.ts +0 -8
- package/es/AppContext/index.d.ts +0 -10
- package/es/AppContext/static.d.ts +0 -8
- package/es/Auth/index.d.ts +0 -8
- package/es/AutoExit/index.d.ts +0 -6
- package/es/Box/BetweenBox/index.d.ts +0 -12
- package/es/Box/InfoBox/index.d.ts +0 -12
- package/es/Box/TwoColumnBox/index.d.ts +0 -10
- package/es/Box/deps/content-grid.d.ts +0 -9
- package/es/Box/deps/grid-factory.d.ts +0 -10
- package/es/Box/deps/simple-grid.d.ts +0 -9
- package/es/Box/index.d.ts +0 -14
- package/es/CheckGroupFixed/demo.d.ts +0 -3
- package/es/CheckGroupFixed/index.d.ts +0 -18
- package/es/Config/index.d.ts +0 -4
- package/es/Config/utils.d.ts +0 -4
- package/es/ConfigContext/index.d.ts +0 -22
- package/es/CustomRenderSelect/index.d.ts +0 -12
- package/es/DisableMark/index.d.ts +0 -9
- package/es/DomMove/demo.d.ts +0 -2
- package/es/DomMove/index.d.ts +0 -16
- package/es/DomMove/utils.d.ts +0 -8
- package/es/Drag/DragAndDropItem.d.ts +0 -4
- package/es/Drag/DropItem.d.ts +0 -4
- package/es/Drag/index.less +0 -0
- package/es/Drawer/Footer.d.ts +0 -5
- package/es/Drawer/demo.d.ts +0 -3
- package/es/Drawer/index.d.ts +0 -38
- package/es/DynamicGridList/Demo.d.ts +0 -3
- package/es/DynamicGridList/index.d.ts +0 -27
- package/es/DynamicList/demo.d.ts +0 -2
- package/es/DynamicList/index.d.ts +0 -31
- package/es/DynamicList/utils.d.ts +0 -4
- package/es/ErrorFallback/index.d.ts +0 -9
- package/es/FrontendPlayer/index.d.ts +0 -2
- package/es/FullScreen/index.d.ts +0 -22
- package/es/GridList/Demo.d.ts +0 -3
- package/es/GridList/data.d.ts +0 -16
- package/es/GridList/hook.d.ts +0 -13
- package/es/GridList/index.d.ts +0 -15
- package/es/GridList/utils.d.ts +0 -9
- package/es/HightLevel/index.d.ts +0 -9
- package/es/IconFont/index.d.ts +0 -12
- package/es/ImageView/index.d.ts +0 -17
- package/es/Input/demo.d.ts +0 -3
- package/es/Input/index.d.ts +0 -19
- package/es/InstanceHistory/index.d.ts +0 -3
- package/es/LabelValue/index.d.ts +0 -23
- package/es/List/demo.d.ts +0 -3
- package/es/List/index.d.ts +0 -41
- package/es/ListWithSizeAnimate/demo.d.ts +0 -2
- package/es/ListWithSizeAnimate/index.d.ts +0 -15
- package/es/LoaderApp/index.d.ts +0 -31
- package/es/LoaderApp/loader.d.ts +0 -19
- package/es/LoaderApp/sandbox.back.d.ts +0 -18
- package/es/LoaderApp/sandbox.d.ts +0 -12
- package/es/LoaderApp/utils.d.ts +0 -19
- package/es/LoaderScript/index.d.ts +0 -26
- package/es/LoaderScript/utils.d.ts +0 -14
- package/es/Map/BasicMap/AMapInstance.d.ts +0 -19
- package/es/Map/BasicMap/LeafletInstance.d.ts +0 -18
- package/es/Map/BasicMap/index.d.ts +0 -9
- package/es/Map/ClusterLayer/hook.d.ts +0 -5
- package/es/Map/ClusterLayer/index.d.ts +0 -6
- package/es/Map/Config/index.d.ts +0 -7
- package/es/Map/Config/utils.d.ts +0 -2
- package/es/Map/Context/index.d.ts +0 -11
- package/es/Map/FindPio/index.d.ts +0 -4
- package/es/Map/InfoWindow/MakerLikeWindow.d.ts +0 -4
- package/es/Map/InfoWindow/demo.d.ts +0 -3
- package/es/Map/InfoWindow/index.d.ts +0 -10
- package/es/Map/LevelCenter/DragMarker/index.d.ts +0 -10
- package/es/Map/LevelCenter/demo.d.ts +0 -3
- package/es/Map/LevelCenter/index.d.ts +0 -16
- package/es/Map/LevelCenter/index.less +0 -2
- package/es/Map/LoaderMap/index.d.ts +0 -12
- package/es/Map/MapDrawSelect/demo.d.ts +0 -3
- package/es/Map/MapDrawSelect/index.d.ts +0 -16
- package/es/Map/MapDrawSelect/index.less +0 -2
- package/es/Map/MouseTool/index.d.ts +0 -10
- package/es/Map/MouseTool/useMouseTools.d.ts +0 -7
- package/es/Map/ResetTools/index.d.ts +0 -10
- package/es/Map/SinglePoint/index.d.ts +0 -27
- package/es/Map/hook/useMapEvent.d.ts +0 -2
- package/es/Map/hook/useMapType.d.ts +0 -4
- package/es/Map/icon.d.ts +0 -2
- package/es/Map/index.d.ts +0 -24
- package/es/Map/useMarker/index.d.ts +0 -11
- package/es/Map/useMarker/index.less +0 -0
- package/es/Map/withMap/index.d.ts +0 -3
- package/es/Modal/demo.d.ts +0 -3
- package/es/Modal/index.d.ts +0 -44
- package/es/Picture/component/DefaultRects/RectInfo.d.ts +0 -8
- package/es/Picture/component/DefaultRects/index.d.ts +0 -13
- package/es/Picture/component/DefaultRects/utils.d.ts +0 -2
- package/es/Picture/component/DrawRect/index.d.ts +0 -13
- package/es/Picture/component/RectMenu/index.d.ts +0 -12
- package/es/Picture/component/RectMenu/utils.d.ts +0 -12
- package/es/Picture/component/Tools/index.d.ts +0 -13
- package/es/Picture/component/WheelScale/index.d.ts +0 -7
- package/es/Picture/demo.d.ts +0 -2
- package/es/Picture/dragBound.d.ts +0 -5
- package/es/Picture/index.d.ts +0 -19
- package/es/Picture/loadCaptureRectImage.d.ts +0 -8
- package/es/Picture/useDraw.d.ts +0 -1
- package/es/Picture/utils.d.ts +0 -21
- package/es/Player/api/index.d.ts +0 -68
- package/es/Player/context.d.ts +0 -21
- package/es/Player/contraller_bar/bar.d.ts +0 -8
- package/es/Player/contraller_bar/contraller_event.d.ts +0 -6
- package/es/Player/contraller_bar/index.d.ts +0 -14
- package/es/Player/contraller_bar/left_bar.d.ts +0 -10
- package/es/Player/contraller_bar/right_bar.d.ts +0 -8
- package/es/Player/contraller_bar/time.d.ts +0 -3
- package/es/Player/contraller_bar/useBarStatus.d.ts +0 -2
- package/es/Player/contraller_bar/volume.d.ts +0 -9
- package/es/Player/demo.d.ts +0 -3
- package/es/Player/event/errorEvent.d.ts +0 -16
- package/es/Player/event/eventName.d.ts +0 -18
- package/es/Player/event/index.d.ts +0 -24
- package/es/Player/fps_play.d.ts +0 -11
- package/es/Player/frontend_player.d.ts +0 -8
- package/es/Player/frontend_timeline.d.ts +0 -10
- package/es/Player/iconfont.d.ts +0 -5
- package/es/Player/index.d.ts +0 -2
- package/es/Player/live_heart.d.ts +0 -8
- package/es/Player/message.d.ts +0 -5
- package/es/Player/segment_player.d.ts +0 -9
- package/es/Player/segment_timeline.d.ts +0 -12
- package/es/Player/single_player.d.ts +0 -5
- package/es/Player/timeline.d.ts +0 -5
- package/es/Player/util.d.ts +0 -28
- package/es/PlayerExt/demo.d.ts +0 -3
- package/es/PlayerExt/index.d.ts +0 -48
- package/es/ROI/demo.d.ts +0 -3
- package/es/ROI/index.d.ts +0 -39
- package/es/ROI/utils.d.ts +0 -1
- package/es/ScreenPlayer/Live.d.ts +0 -10
- package/es/ScreenPlayer/LiveTools.d.ts +0 -29
- package/es/ScreenPlayer/PlayerWithExt.d.ts +0 -34
- package/es/ScreenPlayer/RatePick.d.ts +0 -7
- package/es/ScreenPlayer/Record.d.ts +0 -10
- package/es/ScreenPlayer/RecordTools.d.ts +0 -37
- package/es/ScreenPlayer/ScreenSelect.d.ts +0 -7
- package/es/ScreenPlayer/SegmentTimeLine.d.ts +0 -17
- package/es/ScreenPlayer/TimeMode.d.ts +0 -7
- package/es/ScreenPlayer/TimeSelect.d.ts +0 -7
- package/es/ScreenPlayer/demo.d.ts +0 -2
- package/es/ScreenPlayer/demo2.d.ts +0 -2
- package/es/ScreenPlayer/index.d.ts +0 -6
- package/es/ScreenPlayer/useTimeSlider.d.ts +0 -25
- package/es/ScreenPlayer/useVideoFit.d.ts +0 -5
- package/es/ScreenPlayer/utils.d.ts +0 -19
- package/es/SegmentPlayer/index.d.ts +0 -2
- package/es/Service/fetch-adapter.d.ts +0 -12
- package/es/Service/http.d.ts +0 -6
- package/es/Service/index.d.ts +0 -3
- package/es/Service/middleware.d.ts +0 -5
- package/es/TableLayout/index.d.ts +0 -13
- package/es/ThemeAntd/demo.d.ts +0 -4
- package/es/ThemeAntd/index.d.ts +0 -7
- package/es/Timeout/index.d.ts +0 -32
- package/es/Tree/demo.d.ts +0 -3
- package/es/Tree/index.d.ts +0 -24
- package/es/VList/utils.d.ts +0 -14
- package/es/index.d.ts +0 -52
- package/es/useDrawROI/index.d.ts +0 -16
- package/es/useEventEmitterHandle/index.d.ts +0 -2
- package/es/useFullscreen/demo.d.ts +0 -2
- package/es/useFullscreen/index.d.ts +0 -12
- package/es/useHistory/index.d.ts +0 -3
- package/es/useInfiniteScroll/index.d.ts +0 -16
- package/es/useRafInterval/index.d.ts +0 -5
- package/es/useSimpleState/index.d.ts +0 -3
- package/es/useVirtualList/index.d.ts +0 -13
- package/es/utils.d.ts +0 -25
|
@@ -10,13 +10,13 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
10
10
|
|
|
11
11
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
12
|
|
|
13
|
-
import React, {
|
|
14
|
-
import IconFont from "../iconfont";
|
|
15
|
-
import Bar from "./bar";
|
|
13
|
+
import React, { useCallback, useContext, useMemo, useState } from 'react';
|
|
16
14
|
import { Context } from "../context";
|
|
17
15
|
import { useVideoEvent } from "../event";
|
|
18
|
-
import
|
|
16
|
+
import IconFont from "../iconfont";
|
|
17
|
+
import Bar from "./bar";
|
|
19
18
|
import Time from "./time";
|
|
19
|
+
import Volume from "./volume";
|
|
20
20
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
21
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
22
|
|
|
@@ -45,7 +45,7 @@ function LeftBar(_ref) {
|
|
|
45
45
|
useVideoEvent('play', updateRender);
|
|
46
46
|
useVideoEvent('pause', updateRender);
|
|
47
47
|
useVideoEvent('volumechange', updateRender);
|
|
48
|
-
var video = container.querySelector('video'); //缓存值
|
|
48
|
+
var video = container === null || container === void 0 ? void 0 : container.querySelector('video'); //缓存值
|
|
49
49
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
50
50
|
|
|
51
51
|
var paused = useMemo(function () {
|
|
@@ -60,11 +60,13 @@ function LeftBar(_ref) {
|
|
|
60
60
|
|
|
61
61
|
var changePlayStatus = useCallback(function () {
|
|
62
62
|
if (video !== null && video !== void 0 && video.paused) {
|
|
63
|
-
var
|
|
64
|
-
|
|
65
|
-
api.
|
|
63
|
+
var _api$getSecondsLoaded;
|
|
64
|
+
|
|
65
|
+
var buffered = (_api$getSecondsLoaded = api === null || api === void 0 ? void 0 : api.getSecondsLoaded()) !== null && _api$getSecondsLoaded !== void 0 ? _api$getSecondsLoaded : 1;
|
|
66
|
+
api === null || api === void 0 ? void 0 : api.seekTo(buffered - 1);
|
|
67
|
+
api === null || api === void 0 ? void 0 : api.play();
|
|
66
68
|
} else {
|
|
67
|
-
api.pause();
|
|
69
|
+
api === null || api === void 0 ? void 0 : api.pause();
|
|
68
70
|
}
|
|
69
71
|
}, [video, api]);
|
|
70
72
|
return /*#__PURE__*/_jsxs("div", {
|
|
@@ -87,7 +89,7 @@ function LeftBar(_ref) {
|
|
|
87
89
|
})
|
|
88
90
|
}), !isLive && oneFpsPlay && /*#__PURE__*/_jsx(Bar, {
|
|
89
91
|
children: /*#__PURE__*/_jsx(IconFont, {
|
|
90
|
-
onClick: isFpsPlay ? api.closeFpsPlay : api.openFpsPlay,
|
|
92
|
+
onClick: isFpsPlay ? api === null || api === void 0 ? void 0 : api.closeFpsPlay : api === null || api === void 0 ? void 0 : api.openFpsPlay,
|
|
91
93
|
type: "lm-player-zhuzhenplay",
|
|
92
94
|
title: "\u9010\u5E27\u64AD\u653E"
|
|
93
95
|
})
|
|
@@ -18,15 +18,14 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
18
18
|
|
|
19
19
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
20
20
|
|
|
21
|
-
import { useState, useEffect, useRef } from 'react';
|
|
22
|
-
import EventName from "./eventName";
|
|
23
21
|
import Flvjs from '@cloud-app-dev/flv.js';
|
|
24
22
|
import Hls from 'hls.js';
|
|
23
|
+
import { useEffect, useRef, useState } from 'react';
|
|
25
24
|
import { useRegisterPlayerEvent, useVideoEvent } from '.';
|
|
25
|
+
import EventName from "./eventName";
|
|
26
26
|
|
|
27
27
|
function useErrorEvent(_ref) {
|
|
28
28
|
var event = _ref.event,
|
|
29
|
-
api = _ref.api,
|
|
30
29
|
reload = _ref.reload,
|
|
31
30
|
unload = _ref.unload,
|
|
32
31
|
errorReloadTimer = _ref.errorReloadTimer,
|
|
@@ -40,7 +39,7 @@ function useErrorEvent(_ref) {
|
|
|
40
39
|
setErrorTime = _useState2[1];
|
|
41
40
|
|
|
42
41
|
var errorInfo = useRef(null);
|
|
43
|
-
var reloadTimer = useRef(
|
|
42
|
+
var reloadTimer = useRef();
|
|
44
43
|
|
|
45
44
|
var errorHandle = function errorHandle() {
|
|
46
45
|
var _console;
|
|
@@ -69,7 +68,7 @@ function useErrorEvent(_ref) {
|
|
|
69
68
|
var reloadSuccess = function reloadSuccess() {
|
|
70
69
|
if (errorTimer > 0) {
|
|
71
70
|
console.warn('视频重连成功!');
|
|
72
|
-
event.emit(EventName.RELOAD_SUCCESS);
|
|
71
|
+
event === null || event === void 0 ? void 0 : event.emit(EventName.RELOAD_SUCCESS);
|
|
73
72
|
clearErrorTimer();
|
|
74
73
|
}
|
|
75
74
|
};
|
|
@@ -96,19 +95,19 @@ function useErrorEvent(_ref) {
|
|
|
96
95
|
|
|
97
96
|
if (errorTimer > errorReloadTimer) {
|
|
98
97
|
unload();
|
|
99
|
-
event.emit(EventName.RELOAD_FAIL);
|
|
98
|
+
event === null || event === void 0 ? void 0 : event.emit(EventName.RELOAD_FAIL);
|
|
100
99
|
return undefined;
|
|
101
100
|
}
|
|
102
101
|
|
|
103
102
|
console.warn("\u89C6\u9891\u64AD\u653E\u51FA\u9519\uFF0C\u6B63\u5728\u8FDB\u884C\u91CD\u8FDE".concat(errorTimer));
|
|
104
103
|
reloadTimer.current = setTimeout(function () {
|
|
105
|
-
event.emit.apply(event, [EventName.ERROR_RELOAD, errorTimer].concat(_toConsumableArray(errorInfo.current)));
|
|
104
|
+
event === null || event === void 0 ? void 0 : event.emit.apply(event, [EventName.ERROR_RELOAD, errorTimer].concat(_toConsumableArray(errorInfo.current)));
|
|
106
105
|
reload();
|
|
107
106
|
}, 2 * 1000);
|
|
108
107
|
return function () {
|
|
109
108
|
clearTimeout(reloadTimer.current);
|
|
110
109
|
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
111
|
-
}, [errorTimer,
|
|
110
|
+
}, [errorTimer, event, flv, hls]);
|
|
112
111
|
}
|
|
113
112
|
|
|
114
113
|
export default useErrorEvent;
|
package/es/Player/event/index.js
CHANGED
|
@@ -117,7 +117,7 @@ var VideoEventInstance = /*#__PURE__*/function () {
|
|
|
117
117
|
}();
|
|
118
118
|
|
|
119
119
|
export function usePlayerEvent(video) {
|
|
120
|
-
var _useState = useState(
|
|
120
|
+
var _useState = useState(undefined),
|
|
121
121
|
_useState2 = _slicedToArray(_useState, 2),
|
|
122
122
|
event = _useState2[0],
|
|
123
123
|
setEvent = _useState2[1];
|
package/es/Player/fps_play.js
CHANGED
|
@@ -11,9 +11,9 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
11
11
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
12
|
|
|
13
13
|
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
14
|
-
import Events from "./event/eventName";
|
|
15
14
|
import useRafInterval from "../useRafInterval";
|
|
16
15
|
import { useRegisterPlayerEvent } from "./event";
|
|
16
|
+
import Events from "./event/eventName";
|
|
17
17
|
import { getDomStyleValue } from "./util";
|
|
18
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
19
|
var oneFps = 1 / 30;
|
|
@@ -30,21 +30,23 @@ function FPSPlay(_ref) {
|
|
|
30
30
|
update = _useState2[1];
|
|
31
31
|
|
|
32
32
|
var ref = useRef(null);
|
|
33
|
-
var timerRef = useRef(
|
|
33
|
+
var timerRef = useRef();
|
|
34
34
|
var fps_second = useMemo(function () {
|
|
35
35
|
return fps ? 1 / fps : oneFps;
|
|
36
36
|
}, [fps]);
|
|
37
37
|
useEffect(function () {
|
|
38
38
|
var fpsCapture = function fpsCapture() {
|
|
39
|
-
|
|
39
|
+
var _api$getCurrentTime, _api$getDuration;
|
|
40
|
+
|
|
41
|
+
if (!ref.current || !(event !== null && event !== void 0 && event.video)) {
|
|
40
42
|
return;
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
var video = event.video;
|
|
44
|
-
var fpsTime = api.getCurrentTime() + fps_second;
|
|
46
|
+
var fpsTime = (_api$getCurrentTime = api === null || api === void 0 ? void 0 : api.getCurrentTime()) !== null && _api$getCurrentTime !== void 0 ? _api$getCurrentTime : 0 + fps_second;
|
|
45
47
|
video.currentTime = fpsTime;
|
|
46
48
|
|
|
47
|
-
if (video.currentTime >= api.getDuration()) {
|
|
49
|
+
if (video.currentTime >= ((_api$getDuration = api === null || api === void 0 ? void 0 : api.getDuration()) !== null && _api$getDuration !== void 0 ? _api$getDuration : 0)) {
|
|
48
50
|
clearInterval(timerRef.current);
|
|
49
51
|
video.currentTime = 0;
|
|
50
52
|
event.emit(Events.PLAY_ENDED);
|
|
@@ -63,7 +65,7 @@ function FPSPlay(_ref) {
|
|
|
63
65
|
|
|
64
66
|
if (fit === 'fill') {
|
|
65
67
|
//全画面绘制,存在拉伸
|
|
66
|
-
ctx.drawImage(video, 0, 0, width, height);
|
|
68
|
+
ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, width, height);
|
|
67
69
|
} else {
|
|
68
70
|
// 自适应绘制
|
|
69
71
|
var videoWidth = video.videoWidth;
|
|
@@ -71,7 +73,7 @@ function FPSPlay(_ref) {
|
|
|
71
73
|
var scale = height / videoHeight;
|
|
72
74
|
var s_vw = scale * videoWidth;
|
|
73
75
|
var paddingSize = (width - s_vw) / 2;
|
|
74
|
-
ctx.drawImage(video, paddingSize, 0, s_vw, height);
|
|
76
|
+
ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, paddingSize, 0, s_vw, height);
|
|
75
77
|
}
|
|
76
78
|
};
|
|
77
79
|
|
|
@@ -89,7 +91,7 @@ function FPSPlay(_ref) {
|
|
|
89
91
|
}); // TODO: 未知情况,video会自动播放,轮训检测并暂停零时解决
|
|
90
92
|
|
|
91
93
|
useRafInterval(function () {
|
|
92
|
-
return !api.paused ? api.pause() : null;
|
|
94
|
+
return !(api !== null && api !== void 0 && api.paused) ? api === null || api === void 0 ? void 0 : api.pause() : null;
|
|
93
95
|
}, 10);
|
|
94
96
|
return /*#__PURE__*/_jsx("canvas", {
|
|
95
97
|
className: "fps-play-canvas",
|
|
@@ -13,16 +13,17 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
13
13
|
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; }
|
|
14
14
|
|
|
15
15
|
import React, { useMemo, useRef } from 'react';
|
|
16
|
-
import SinglePlayer from "./single_player";
|
|
17
|
-
import FrontendTimeLine from "./frontend_timeline";
|
|
18
16
|
import Events from "./event/eventName";
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
|
|
17
|
+
import FrontendTimeLine from "./frontend_timeline";
|
|
18
|
+
import SinglePlayer from "./single_player";
|
|
22
19
|
/**
|
|
23
20
|
* @desc 主组件,负责片段整体逻辑控制
|
|
24
21
|
* @return JSX.Element
|
|
25
22
|
*/
|
|
23
|
+
|
|
24
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
25
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
26
|
+
|
|
26
27
|
function FrontendPlayer(_ref) {
|
|
27
28
|
var url = _ref.url,
|
|
28
29
|
begin = _ref.begin,
|
|
@@ -44,14 +45,16 @@ function FrontendPlayer(_ref) {
|
|
|
44
45
|
|
|
45
46
|
|
|
46
47
|
var duration = useMemo(function () {
|
|
47
|
-
return (end - begin) / 1000;
|
|
48
|
+
return (end !== null && end !== void 0 ? end : 0 - (begin !== null && begin !== void 0 ? begin : 0)) / 1000;
|
|
48
49
|
}, [begin, end]); //单位s 秒
|
|
49
50
|
// 重置reload
|
|
50
51
|
|
|
51
52
|
var reload = _useMemoizedFn(function () {
|
|
52
|
-
|
|
53
|
+
var _playRef$current, _playRef$current2;
|
|
54
|
+
|
|
55
|
+
(_playRef$current = playRef.current) === null || _playRef$current === void 0 ? void 0 : _playRef$current.event.emit(Events.RELOAD);
|
|
53
56
|
onSeek === null || onSeek === void 0 ? void 0 : onSeek(begin);
|
|
54
|
-
playRef.current.api.reload();
|
|
57
|
+
(_playRef$current2 = playRef.current) === null || _playRef$current2 === void 0 ? void 0 : _playRef$current2.api.reload();
|
|
55
58
|
});
|
|
56
59
|
|
|
57
60
|
var onInit = _useMemoizedFn(function () {
|
|
@@ -61,9 +64,9 @@ function FrontendPlayer(_ref) {
|
|
|
61
64
|
|
|
62
65
|
var hasReady = api && event;
|
|
63
66
|
var timeline = customTimeLine !== null && customTimeLine !== void 0 ? customTimeLine : /*#__PURE__*/_jsx(FrontendTimeLine, {
|
|
64
|
-
end: end,
|
|
67
|
+
end: end !== null && end !== void 0 ? end : 0,
|
|
65
68
|
onSeek: onSeek,
|
|
66
|
-
begin: begin,
|
|
69
|
+
begin: begin !== null && begin !== void 0 ? begin : 0,
|
|
67
70
|
duration: duration
|
|
68
71
|
});
|
|
69
72
|
return /*#__PURE__*/_jsx(SinglePlayer, _objectSpread({
|
|
@@ -18,20 +18,53 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
18
18
|
|
|
19
19
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
20
20
|
|
|
21
|
-
import
|
|
21
|
+
import moment from 'moment';
|
|
22
|
+
import React, { startTransition, useMemo, useState } from 'react';
|
|
22
23
|
import useBarStatus from "./contraller_bar/useBarStatus";
|
|
24
|
+
import "./style/timeline.less";
|
|
23
25
|
import { useTimes } from "./timeline";
|
|
24
26
|
import { FMT } from "./util";
|
|
25
|
-
import moment from 'moment';
|
|
26
|
-
import "./style/timeline.less";
|
|
27
27
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
28
28
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
29
29
|
|
|
30
|
-
function
|
|
31
|
-
var
|
|
30
|
+
function TipTitle(_ref) {
|
|
31
|
+
var end = _ref.end,
|
|
32
32
|
begin = _ref.begin,
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
left = _ref.left,
|
|
34
|
+
current = _ref.current,
|
|
35
|
+
markTime = _ref.markTime;
|
|
36
|
+
|
|
37
|
+
if (left === -1) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
42
|
+
className: "frontend-line-tip-box",
|
|
43
|
+
style: {
|
|
44
|
+
left: left
|
|
45
|
+
},
|
|
46
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
47
|
+
style: {
|
|
48
|
+
fontWeight: 600
|
|
49
|
+
},
|
|
50
|
+
children: "\u5F55\u50CF\u4FE1\u606F"
|
|
51
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
52
|
+
children: ["\u5F00\u59CB\uFF1A", moment(begin).format(FMT)]
|
|
53
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
54
|
+
children: ["\u7ED3\u675F\uFF1A", moment(end).format(FMT)]
|
|
55
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
56
|
+
children: ["\u523B\u5EA6\uFF1A", moment(markTime).format(FMT)]
|
|
57
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
58
|
+
children: ["\u5F53\u524D\uFF1A", moment(current).format(FMT)]
|
|
59
|
+
})]
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function FrontendTimeLine(_ref2) {
|
|
64
|
+
var duration = _ref2.duration,
|
|
65
|
+
begin = _ref2.begin,
|
|
66
|
+
end = _ref2.end,
|
|
67
|
+
onSeek = _ref2.onSeek;
|
|
35
68
|
|
|
36
69
|
// time 是记录seek时跳了多少
|
|
37
70
|
var _useState = useState({
|
|
@@ -94,7 +127,7 @@ function FrontendTimeLine(_ref) {
|
|
|
94
127
|
});
|
|
95
128
|
};
|
|
96
129
|
|
|
97
|
-
var onLineMouseOut = function onLineMouseOut(
|
|
130
|
+
var onLineMouseOut = function onLineMouseOut() {
|
|
98
131
|
return startTransition(function () {
|
|
99
132
|
return setState(function (old) {
|
|
100
133
|
return _objectSpread(_objectSpread({}, old), {}, {
|
|
@@ -129,37 +162,4 @@ function FrontendTimeLine(_ref) {
|
|
|
129
162
|
});
|
|
130
163
|
}
|
|
131
164
|
|
|
132
|
-
function TipTitle(_ref2) {
|
|
133
|
-
var end = _ref2.end,
|
|
134
|
-
begin = _ref2.begin,
|
|
135
|
-
left = _ref2.left,
|
|
136
|
-
current = _ref2.current,
|
|
137
|
-
markTime = _ref2.markTime;
|
|
138
|
-
|
|
139
|
-
if (left === -1) {
|
|
140
|
-
return null;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
return /*#__PURE__*/_jsxs("div", {
|
|
144
|
-
className: "frontend-line-tip-box",
|
|
145
|
-
style: {
|
|
146
|
-
left: left
|
|
147
|
-
},
|
|
148
|
-
children: [/*#__PURE__*/_jsx("div", {
|
|
149
|
-
style: {
|
|
150
|
-
fontWeight: 600
|
|
151
|
-
},
|
|
152
|
-
children: "\u5F55\u50CF\u4FE1\u606F"
|
|
153
|
-
}), /*#__PURE__*/_jsxs("div", {
|
|
154
|
-
children: ["\u5F00\u59CB\uFF1A", moment(begin).format(FMT)]
|
|
155
|
-
}), /*#__PURE__*/_jsxs("div", {
|
|
156
|
-
children: ["\u7ED3\u675F\uFF1A", moment(end).format(FMT)]
|
|
157
|
-
}), /*#__PURE__*/_jsxs("div", {
|
|
158
|
-
children: ["\u523B\u5EA6\uFF1A", moment(markTime).format(FMT)]
|
|
159
|
-
}), /*#__PURE__*/_jsxs("div", {
|
|
160
|
-
children: ["\u5F53\u524D\uFF1A", moment(current).format(FMT)]
|
|
161
|
-
})]
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
|
|
165
165
|
export default FrontendTimeLine;
|
package/es/Player/live_heart.js
CHANGED
|
@@ -11,14 +11,16 @@ function useLiveHeart(_ref) {
|
|
|
11
11
|
|
|
12
12
|
var documentVisibility = _useDocumentVisibility();
|
|
13
13
|
|
|
14
|
-
var cTimeRef = useRef(
|
|
14
|
+
var cTimeRef = useRef(0);
|
|
15
15
|
|
|
16
16
|
var run = function run() {
|
|
17
|
-
|
|
17
|
+
var _api$getCurrentTime;
|
|
18
|
+
|
|
19
|
+
if (!isLive || documentVisibility !== 'visible' || !api) {
|
|
18
20
|
return;
|
|
19
21
|
}
|
|
20
22
|
|
|
21
|
-
var current = api.getCurrentTime();
|
|
23
|
+
var current = (_api$getCurrentTime = api.getCurrentTime()) !== null && _api$getCurrentTime !== void 0 ? _api$getCurrentTime : 0;
|
|
22
24
|
var buffered = api.getSecondsLoaded();
|
|
23
25
|
|
|
24
26
|
if (buffered - current > 5) {
|
|
@@ -33,7 +35,9 @@ function useLiveHeart(_ref) {
|
|
|
33
35
|
}, [documentVisibility]);
|
|
34
36
|
|
|
35
37
|
_useRafInterval(function () {
|
|
36
|
-
|
|
38
|
+
var _api$getCurrentTime2;
|
|
39
|
+
|
|
40
|
+
return cTimeRef.current = (_api$getCurrentTime2 = api === null || api === void 0 ? void 0 : api.getCurrentTime()) !== null && _api$getCurrentTime2 !== void 0 ? _api$getCurrentTime2 : 0;
|
|
37
41
|
}, 1 * 1000);
|
|
38
42
|
|
|
39
43
|
_useRafInterval(function () {
|
|
@@ -41,9 +45,15 @@ function useLiveHeart(_ref) {
|
|
|
41
45
|
}, 30 * 1000);
|
|
42
46
|
|
|
43
47
|
_useRafInterval(function () {
|
|
48
|
+
var _api$video;
|
|
49
|
+
|
|
50
|
+
if (!api || !event) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
44
54
|
var cuurentTime = api.getCurrentTime();
|
|
45
55
|
|
|
46
|
-
if (!!isLive && !api.video.paused && cuurentTime === cTimeRef.current) {
|
|
56
|
+
if (!!isLive && !((_api$video = api.video) !== null && _api$video !== void 0 && _api$video.paused) && cuurentTime === cTimeRef.current) {
|
|
47
57
|
event.emit(Events.ERROR);
|
|
48
58
|
}
|
|
49
59
|
}, 20 * 1000);
|
package/es/Player/message.js
CHANGED
|
@@ -16,11 +16,11 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
16
16
|
|
|
17
17
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
18
18
|
|
|
19
|
-
import React, {
|
|
20
|
-
import
|
|
19
|
+
import React, { useContext, useMemo, useRef, useState } from 'react';
|
|
20
|
+
import { Context } from "./context";
|
|
21
21
|
import { useRegisterPlayerEvent, useVideoEvent } from "./event";
|
|
22
22
|
import EventName from "./event/eventName";
|
|
23
|
-
import
|
|
23
|
+
import IconFont from "./iconfont";
|
|
24
24
|
import "./style/message.less";
|
|
25
25
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
26
26
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -38,7 +38,7 @@ function VideoMessage() {
|
|
|
38
38
|
state = _useState2[0],
|
|
39
39
|
setState = _useState2[1];
|
|
40
40
|
|
|
41
|
-
var timeRef = useRef(
|
|
41
|
+
var timeRef = useRef();
|
|
42
42
|
var message = useMemo(function () {
|
|
43
43
|
if (state.status === 'fail') {
|
|
44
44
|
console.warn("\u89C6\u9891\u9519\u8BEF\uFF0C\u8BF7\u624B\u52A8\u5237\u65B0\u91CD\u8BD5\uFF01");
|
|
@@ -117,7 +117,7 @@ function VideoMessage() {
|
|
|
117
117
|
loading: false
|
|
118
118
|
});
|
|
119
119
|
});
|
|
120
|
-
api.pause();
|
|
120
|
+
api === null || api === void 0 ? void 0 : api.pause();
|
|
121
121
|
};
|
|
122
122
|
|
|
123
123
|
useVideoEvent('loadstart', openLoading);
|
|
@@ -25,10 +25,10 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
25
25
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
26
26
|
|
|
27
27
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
28
|
-
import SinglePlayer from "./single_player";
|
|
29
|
-
import SegmentTimeLine from "./segment_timeline";
|
|
30
|
-
import Events from "./event/eventName";
|
|
31
28
|
import { useRegisterPlayerEvent, useVideoEvent } from "./event";
|
|
29
|
+
import Events from "./event/eventName";
|
|
30
|
+
import SegmentTimeLine from "./segment_timeline";
|
|
31
|
+
import SinglePlayer from "./single_player";
|
|
32
32
|
/**
|
|
33
33
|
* @desc 计算第一个url
|
|
34
34
|
* @param segments
|
|
@@ -62,17 +62,15 @@ function getFirstUrlIndex(segments) {
|
|
|
62
62
|
* @desc 片段索引控制
|
|
63
63
|
* @param event
|
|
64
64
|
* @param segments
|
|
65
|
-
* @param deps
|
|
66
65
|
* @returns
|
|
67
66
|
*/
|
|
68
67
|
|
|
69
68
|
|
|
70
69
|
function usePlayIndex(event, segments) {
|
|
71
70
|
var defaultIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
72
|
-
var deps = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
73
71
|
|
|
74
72
|
var _useState = useState({
|
|
75
|
-
index: getFirstUrlIndex(segments, defaultIndex)
|
|
73
|
+
index: getFirstUrlIndex(segments !== null && segments !== void 0 ? segments : [], defaultIndex)
|
|
76
74
|
}),
|
|
77
75
|
_useState2 = _slicedToArray(_useState, 2),
|
|
78
76
|
state = _useState2[0],
|
|
@@ -80,7 +78,7 @@ function usePlayIndex(event, segments) {
|
|
|
80
78
|
|
|
81
79
|
|
|
82
80
|
useEffect(function () {
|
|
83
|
-
var index = getFirstUrlIndex(segments, 0);
|
|
81
|
+
var index = getFirstUrlIndex(segments !== null && segments !== void 0 ? segments : [], 0);
|
|
84
82
|
setState(function (old) {
|
|
85
83
|
return _objectSpread(_objectSpread({}, old), {}, {
|
|
86
84
|
index: index
|
|
@@ -89,9 +87,9 @@ function usePlayIndex(event, segments) {
|
|
|
89
87
|
}, [segments]); // 索引不存在播放地址,自动跳转下一段
|
|
90
88
|
|
|
91
89
|
useEffect(function () {
|
|
92
|
-
var _segments$state$index;
|
|
90
|
+
var _segments$state$index, _segments$length;
|
|
93
91
|
|
|
94
|
-
if (!((_segments$state$index = segments[state.index]) !== null && _segments$state$index !== void 0 && _segments$state$index.url) && state.index < segments.length - 1) {
|
|
92
|
+
if (!(segments !== null && segments !== void 0 && (_segments$state$index = segments[state.index]) !== null && _segments$state$index !== void 0 && _segments$state$index.url) && state.index < ((_segments$length = segments === null || segments === void 0 ? void 0 : segments.length) !== null && _segments$length !== void 0 ? _segments$length : 0) - 1) {
|
|
95
93
|
setState(function (old) {
|
|
96
94
|
return _objectSpread(_objectSpread({}, old), {}, {
|
|
97
95
|
index: old.index + 1
|
|
@@ -102,8 +100,10 @@ function usePlayIndex(event, segments) {
|
|
|
102
100
|
|
|
103
101
|
var endHandle = function endHandle() {
|
|
104
102
|
return setState(function (old) {
|
|
103
|
+
var _segments$length2;
|
|
104
|
+
|
|
105
105
|
return _objectSpread(_objectSpread({}, old), {}, {
|
|
106
|
-
index: old.index + 1 < segments.length ? old.index + 1 : old.index
|
|
106
|
+
index: old.index + 1 < ((_segments$length2 = segments === null || segments === void 0 ? void 0 : segments.length) !== null && _segments$length2 !== void 0 ? _segments$length2 : 0) ? old.index + 1 : old.index
|
|
107
107
|
});
|
|
108
108
|
});
|
|
109
109
|
};
|
|
@@ -163,16 +163,16 @@ function SegmentPlayer(_ref) {
|
|
|
163
163
|
}, 0);
|
|
164
164
|
}, [segments]);
|
|
165
165
|
|
|
166
|
-
var _usePlayIndex = usePlayIndex(event, segments, defaultIndex
|
|
166
|
+
var _usePlayIndex = usePlayIndex(event, segments, defaultIndex),
|
|
167
167
|
index = _usePlayIndex.index,
|
|
168
168
|
setIndex = _usePlayIndex.setIndex;
|
|
169
169
|
|
|
170
170
|
var url = useMemo(function () {
|
|
171
|
-
return segments[index] ? segments[index].url : undefined;
|
|
171
|
+
return segments !== null && segments !== void 0 && segments[index] ? segments[index].url : undefined;
|
|
172
172
|
}, [segments, index]); // 重置reload
|
|
173
173
|
|
|
174
174
|
var reload = function reload() {
|
|
175
|
-
var _playRef$current$plug, _playRef$current;
|
|
175
|
+
var _playRef$current$plug, _playRef$current, _playRef$current2, _playRef$current3, _playRef$current4;
|
|
176
176
|
|
|
177
177
|
var _ref3 = (_playRef$current$plug = (_playRef$current = playRef.current) === null || _playRef$current === void 0 ? void 0 : _playRef$current.plugins) !== null && _playRef$current$plug !== void 0 ? _playRef$current$plug : [],
|
|
178
178
|
_ref4 = _slicedToArray(_ref3, 2),
|
|
@@ -183,17 +183,18 @@ function SegmentPlayer(_ref) {
|
|
|
183
183
|
hls.recoverMediaError();
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
-
playRef.current.event.emit(Events.RELOAD);
|
|
187
|
-
playRef.current.event.emit(Events.CLEAR_ERROR_TIMER);
|
|
186
|
+
(_playRef$current2 = playRef.current) === null || _playRef$current2 === void 0 ? void 0 : _playRef$current2.event.emit(Events.RELOAD);
|
|
187
|
+
(_playRef$current3 = playRef.current) === null || _playRef$current3 === void 0 ? void 0 : _playRef$current3.event.emit(Events.CLEAR_ERROR_TIMER);
|
|
188
188
|
setIndex(0);
|
|
189
|
-
playRef.current.api.reload();
|
|
189
|
+
(_playRef$current4 = playRef.current) === null || _playRef$current4 === void 0 ? void 0 : _playRef$current4.api.reload();
|
|
190
190
|
}; // time 毫秒的时间戳
|
|
191
191
|
|
|
192
192
|
|
|
193
193
|
var seekTo = function seekTo(time) {
|
|
194
|
-
var _playRef$current$plug2, _playRef$
|
|
194
|
+
var _latestSegmentsRef$cu, _playRef$current$plug2, _playRef$current5, _cSegments$index;
|
|
195
195
|
|
|
196
|
-
var
|
|
196
|
+
var cSegments = (_latestSegmentsRef$cu = latestSegmentsRef.current) !== null && _latestSegmentsRef$cu !== void 0 ? _latestSegmentsRef$cu : [];
|
|
197
|
+
var index = cSegments.findIndex(function (v) {
|
|
197
198
|
return time >= v.beginTime && time < v.endTime;
|
|
198
199
|
});
|
|
199
200
|
|
|
@@ -201,7 +202,7 @@ function SegmentPlayer(_ref) {
|
|
|
201
202
|
return;
|
|
202
203
|
}
|
|
203
204
|
|
|
204
|
-
var _ref5 = (_playRef$current$plug2 = (_playRef$
|
|
205
|
+
var _ref5 = (_playRef$current$plug2 = (_playRef$current5 = playRef.current) === null || _playRef$current5 === void 0 ? void 0 : _playRef$current5.plugins) !== null && _playRef$current$plug2 !== void 0 ? _playRef$current$plug2 : [],
|
|
205
206
|
_ref6 = _slicedToArray(_ref5, 2),
|
|
206
207
|
hls = _ref6[1];
|
|
207
208
|
|
|
@@ -210,7 +211,7 @@ function SegmentPlayer(_ref) {
|
|
|
210
211
|
hls.recoverMediaError();
|
|
211
212
|
}
|
|
212
213
|
|
|
213
|
-
var currentTime = time -
|
|
214
|
+
var currentTime = time - ((_cSegments$index = cSegments[index]) === null || _cSegments$index === void 0 ? void 0 : _cSegments$index.beginTime);
|
|
214
215
|
setIndex(index);
|
|
215
216
|
setState(function (old) {
|
|
216
217
|
return _objectSpread(_objectSpread({}, old), {}, {
|
|
@@ -221,6 +222,8 @@ function SegmentPlayer(_ref) {
|
|
|
221
222
|
|
|
222
223
|
|
|
223
224
|
useEffect(function () {
|
|
225
|
+
var _playRef$current6;
|
|
226
|
+
|
|
224
227
|
if (state.seekTime === 0) {
|
|
225
228
|
return;
|
|
226
229
|
}
|
|
@@ -230,15 +233,19 @@ function SegmentPlayer(_ref) {
|
|
|
230
233
|
seekTime: 0
|
|
231
234
|
});
|
|
232
235
|
});
|
|
233
|
-
|
|
236
|
+
|
|
237
|
+
if ((_playRef$current6 = playRef.current) !== null && _playRef$current6 !== void 0 && _playRef$current6.video) {
|
|
238
|
+
playRef.current.video.currentTime = state.seekTime;
|
|
239
|
+
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
240
|
+
|
|
234
241
|
}, [state.seekTime]);
|
|
235
242
|
var hasReady = api && event;
|
|
236
243
|
var timeline = customTimeLine !== null && customTimeLine !== void 0 ? customTimeLine : /*#__PURE__*/_jsx(SegmentTimeLine, {
|
|
237
|
-
begin: begin,
|
|
244
|
+
begin: begin !== null && begin !== void 0 ? begin : 0,
|
|
238
245
|
seekTo: seekTo,
|
|
239
246
|
index: index,
|
|
240
|
-
segments: segments,
|
|
241
|
-
duration: duration
|
|
247
|
+
segments: segments !== null && segments !== void 0 ? segments : [],
|
|
248
|
+
duration: duration !== null && duration !== void 0 ? duration : 0
|
|
242
249
|
});
|
|
243
250
|
var onInit = useCallback(function () {
|
|
244
251
|
update();
|