@cloud-app-dev/vidc 3.2.17 → 3.2.19
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/Sync.d.ts +0 -1
- 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.d.ts +3 -3
- package/es/Box/index.less +1 -1
- package/es/CheckGroupFixed/demo.d.ts +0 -1
- package/es/CheckGroupFixed/index.d.ts +0 -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/demo.d.ts +0 -1
- package/es/DomMove/index.js +5 -5
- package/es/Drag/DragAndDropItem.js +1 -2
- package/es/Drag/DropItem.js +2 -2
- package/es/Drawer/Footer.d.ts +0 -1
- package/es/Drawer/index.d.ts +1 -1
- package/es/Drawer/index.js +19 -20
- package/es/Drawer/index.less +8 -8
- package/es/Drawer/interface.d.ts +4 -3
- package/es/DynamicGridList/Demo.d.ts +0 -1
- package/es/DynamicList/demo.d.ts +0 -1
- package/es/DynamicList/index.d.ts +0 -1
- package/es/DynamicList/index.less +2 -0
- package/es/ErrorFallback/index.d.ts +0 -1
- package/es/FullScreen/index.d.ts +0 -1
- package/es/FullScreen/index.less +6 -4
- package/es/GridList/Demo.d.ts +0 -1
- package/es/GridList/index.js +1 -1
- package/es/GridList/index.less +1 -1
- package/es/ImageView/index.less +2 -1
- package/es/Input/demo.d.ts +0 -1
- package/es/Input/index.d.ts +0 -1
- package/es/Input/index.less +1 -1
- package/es/InstanceHistory/index.d.ts +0 -1
- package/es/LabelValue/index.less +5 -2
- package/es/List/demo.d.ts +0 -1
- package/es/List/index.d.ts +4 -4
- package/es/List/index.less +2 -2
- package/es/ListWithSizeAnimate/demo.d.ts +0 -1
- package/es/ListWithSizeAnimate/demo.js +0 -1
- package/es/ListWithSizeAnimate/index.d.ts +0 -1
- package/es/ListWithSizeAnimate/index.js +18 -28
- package/es/ListWithSizeAnimate/index.less +10 -6
- package/es/Map/BasicMap/LeafletInstance.d.ts +1 -1
- package/es/Map/BasicMap/index.less +8 -3
- package/es/Map/ClusterLayer/hook.d.ts +2 -2
- package/es/Map/ClusterLayer/index.d.ts +0 -1
- package/es/Map/ClusterLayer/index.less +8 -6
- package/es/Map/FindPio/index.d.ts +0 -1
- package/es/Map/FindPio/index.less +2 -2
- package/es/Map/InfoWindow/MakerLikeWindow.d.ts +0 -1
- package/es/Map/InfoWindow/demo.d.ts +0 -1
- package/es/Map/InfoWindow/index.d.ts +0 -1
- package/es/Map/LevelCenter/DragMarker/index.d.ts +0 -1
- package/es/Map/LevelCenter/demo.d.ts +0 -1
- package/es/Map/LevelCenter/index.d.ts +1 -2
- package/es/Map/LevelCenter/index.js +3 -4
- package/es/Map/MapDrawSelect/demo.d.ts +0 -1
- package/es/Map/MapDrawSelect/index.d.ts +1 -2
- package/es/Map/MapDrawSelect/index.js +2 -3
- package/es/Map/ResetTools/index.d.ts +0 -1
- package/es/Map/ResetTools/index.less +10 -6
- package/es/Map/SinglePoint/index.d.ts +1 -1
- package/es/Map/SinglePoint/index.less +3 -3
- package/es/Map/icon.d.ts +1 -1
- package/es/Map/index.d.ts +11 -21
- package/es/Map/useMarker/index.d.ts +0 -1
- package/es/Map/useMarker/index.js +1 -1
- package/es/Map/withMap/index.d.ts +0 -1
- package/es/Modal/demo.d.ts +0 -1
- package/es/Modal/index.d.ts +9 -9
- package/es/Modal/index.js +17 -17
- package/es/Modal/index.less +10 -11
- package/es/Picture/component/DefaultRects/RectInfo.d.ts +0 -1
- package/es/Picture/component/DefaultRects/index.d.ts +1 -2
- package/es/Picture/component/DefaultRects/index.js +3 -1
- package/es/Picture/component/DefaultRects/index.less +51 -28
- package/es/Picture/component/DrawRect/index.d.ts +2 -3
- package/es/Picture/component/DrawRect/index.js +3 -1
- package/es/Picture/component/DrawRect/index.less +2 -2
- package/es/Picture/component/RectMenu/index.d.ts +0 -1
- package/es/Picture/component/RectMenu/index.less +11 -6
- package/es/Picture/component/Tools/index.d.ts +1 -1
- package/es/Picture/component/Tools/index.js +1 -1
- package/es/Picture/component/Tools/index.less +12 -6
- package/es/Picture/component/WheelScale/index.d.ts +0 -1
- package/es/Picture/demo.d.ts +0 -1
- package/es/Picture/index.d.ts +0 -1
- package/es/Picture/index.js +50 -26
- package/es/Picture/index.less +3 -2
- package/es/Picture/useDraw.d.ts +1 -1
- package/es/Picture/useDraw.js +1 -1
- package/es/Picture/utils.d.ts +3 -3
- package/es/Picture/utils.js +35 -34
- package/es/Player/api/index.d.ts +8 -8
- package/es/Player/api/index.js +67 -35
- package/es/Player/context.d.ts +4 -4
- package/es/Player/contraller_bar/contraller_event.js +4 -4
- package/es/Player/contraller_bar/left_bar.js +12 -10
- package/es/Player/contraller_bar/time.d.ts +0 -1
- package/es/Player/demo.d.ts +0 -1
- package/es/Player/empty.d.ts +1 -0
- package/es/Player/empty.js +6 -0
- package/es/Player/event/errorEvent.d.ts +3 -5
- package/es/Player/event/errorEvent.js +7 -8
- package/es/Player/event/index.d.ts +3 -3
- package/es/Player/event/index.js +1 -1
- package/es/Player/fps_play.d.ts +2 -3
- package/es/Player/fps_play.js +10 -8
- package/es/Player/frontend_player.d.ts +0 -1
- package/es/Player/frontend_player.js +13 -10
- package/es/Player/frontend_timeline.d.ts +0 -1
- package/es/Player/frontend_timeline.js +41 -41
- package/es/Player/iconfont.d.ts +0 -1
- package/es/Player/live_heart.d.ts +3 -3
- package/es/Player/live_heart.js +15 -5
- package/es/Player/message.d.ts +0 -1
- package/es/Player/message.js +5 -5
- package/es/Player/segment_player.d.ts +0 -1
- package/es/Player/segment_player.js +31 -24
- package/es/Player/segment_timeline.d.ts +0 -1
- package/es/Player/segment_timeline.js +71 -71
- package/es/Player/single_player.d.ts +1 -1
- 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.d.ts +0 -1
- package/es/Player/timeline.js +16 -8
- package/es/Player/util.d.ts +21 -7
- package/es/Player/util.js +82 -58
- package/es/PlayerExt/demo.d.ts +0 -1
- package/es/PlayerExt/index.d.ts +0 -1
- package/es/PlayerExt/index.less +2 -2
- package/es/Progress/index.d.ts +0 -1
- package/es/Progress/index.less +5 -4
- package/es/ROI/demo.d.ts +0 -1
- package/es/ROI/index.less +8 -4
- package/es/ScreenPlayer/Live.d.ts +0 -1
- package/es/ScreenPlayer/RatePick.d.ts +0 -1
- package/es/ScreenPlayer/Record.d.ts +0 -1
- package/es/ScreenPlayer/ScreenSelect.d.ts +0 -1
- package/es/ScreenPlayer/SegmentTimeLine.d.ts +0 -1
- package/es/ScreenPlayer/TimeMode.d.ts +0 -1
- package/es/ScreenPlayer/TimeSelect.d.ts +0 -1
- package/es/ScreenPlayer/demo.d.ts +0 -1
- package/es/ScreenPlayer/demo2.d.ts +0 -1
- package/es/ScreenPlayer/index.d.ts +2 -3
- package/es/ScreenPlayer/index.less +49 -26
- package/es/ScreenPlayer/useTimeSlider.d.ts +0 -1
- package/es/ScreenPlayer/useVideoFit.d.ts +2 -2
- package/es/TableLayout/index.less +1 -1
- package/es/ThemeAntd/demo.d.ts +0 -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/Timeout/index.d.ts +0 -1
- package/es/Tree/demo.d.ts +0 -1
- package/es/Tree/index.d.ts +1 -1
- package/es/Tree/index.less +13 -12
- package/es/VList/index.d.ts +0 -1
- package/es/useDrawROI/index.d.ts +4 -4
- package/es/useFullscreen/demo.d.ts +0 -1
- package/es/useFullscreen/index.d.ts +4 -5
- package/es/useHistory/index.d.ts +0 -1
- package/es/useSimpleState/index.js +1 -1
- package/es/useVirtualList/index.d.ts +1 -1
- package/package.json +12 -6
- package/tsconfig.json +1 -0
- package/es/Drag/index.less +0 -0
- package/es/Map/LevelCenter/index.less +0 -2
- package/es/Map/MapDrawSelect/index.less +0 -2
- package/es/Map/useMarker/index.less +0 -0
|
@@ -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
|
})
|
package/es/Player/demo.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function Empty(): JSX.Element;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import type VideoEventInstance from '.';
|
|
2
|
-
import type Api from '../api';
|
|
3
1
|
import Flvjs from '@cloud-app-dev/flv.js';
|
|
4
2
|
import Hls from 'hls.js';
|
|
3
|
+
import type VideoEventInstance from '.';
|
|
5
4
|
interface IErrorEventProps {
|
|
6
|
-
event
|
|
7
|
-
api: Api;
|
|
5
|
+
event?: VideoEventInstance;
|
|
8
6
|
errorReloadTimer: number;
|
|
9
7
|
flv: Flvjs.Player;
|
|
10
8
|
hls: Hls;
|
|
@@ -12,5 +10,5 @@ interface IErrorEventProps {
|
|
|
12
10
|
unload: () => void;
|
|
13
11
|
errorHandleAdapter?: (errorInfo: any) => boolean;
|
|
14
12
|
}
|
|
15
|
-
declare function useErrorEvent({ event,
|
|
13
|
+
declare function useErrorEvent({ event, reload, unload, errorReloadTimer, flv, hls, errorHandleAdapter }: IErrorEventProps): void;
|
|
16
14
|
export default useErrorEvent;
|
|
@@ -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;
|
|
@@ -16,9 +16,9 @@ declare class VideoEventInstance {
|
|
|
16
16
|
destroy(): void;
|
|
17
17
|
}
|
|
18
18
|
declare type PlayEvent = VideoEventInstance;
|
|
19
|
-
export declare function usePlayerEvent(video
|
|
19
|
+
export declare function usePlayerEvent(video?: HTMLVideoElement): PlayEvent | undefined;
|
|
20
20
|
export declare function useVideoEvent(eventName: string, handle: (event: any) => void, context?: VideoEventInstance): void;
|
|
21
21
|
export declare function useRegisterPlayerEvent(eventName: string, handle: (event: any) => void, context?: VideoEventInstance): void;
|
|
22
|
-
export declare function useVideoEvents(event
|
|
23
|
-
export declare function useRegisterPlayerEvents(event
|
|
22
|
+
export declare function useVideoEvents(event?: VideoEventInstance, events?: CustomEvent[]): void;
|
|
23
|
+
export declare function useRegisterPlayerEvents(event?: VideoEventInstance, events?: CustomEvent[]): void;
|
|
24
24
|
export default VideoEventInstance;
|
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.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import type Api from './api';
|
|
3
2
|
import type VideoEventInstance from './event';
|
|
4
3
|
interface IFPSPlay {
|
|
5
|
-
api
|
|
6
|
-
event
|
|
4
|
+
api?: Api;
|
|
5
|
+
event?: VideoEventInstance;
|
|
7
6
|
fpsDelay?: number;
|
|
8
7
|
fps?: number;
|
|
9
8
|
}
|
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/iconfont.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type Api from './api';
|
|
2
2
|
import type VideoEventInstance from './event';
|
|
3
3
|
declare function useLiveHeart({ api, event, isLive }: {
|
|
4
|
-
api
|
|
5
|
-
event
|
|
6
|
-
isLive
|
|
4
|
+
api?: Api;
|
|
5
|
+
event?: VideoEventInstance;
|
|
6
|
+
isLive?: boolean;
|
|
7
7
|
}): void;
|
|
8
8
|
export default useLiveHeart;
|
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.d.ts
CHANGED
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);
|