@cloud-app-dev/vidc 3.0.18 → 3.0.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/es/CustomRenderSelect/index.d.ts +1 -1
- package/es/CustomRenderSelect/index.js +3 -3
- package/es/LoaderScript/utils.js +1 -0
- package/es/Map/LevelCenter/DragMarker/index.d.ts +1 -4
- package/es/Map/LevelCenter/DragMarker/index.js +2 -5
- package/es/Map/LevelCenter/index.js +13 -2
- package/es/Map/SinglePoint/index.d.ts +10 -3
- package/es/Map/SinglePoint/index.js +37 -15
- package/es/Map/index.d.ts +1 -1
- package/es/Player/api/index.d.ts +2 -0
- package/es/Player/api/index.js +9 -0
- package/es/Player/contraller_bar/left_bar.js +7 -14
- package/es/Player/contraller_bar/time.d.ts +3 -0
- package/es/Player/contraller_bar/time.js +34 -0
- package/es/Player/contraller_bar/volume.d.ts +9 -0
- package/es/Player/contraller_bar/volume.js +86 -0
- package/es/Player/fps_play.d.ts +2 -1
- package/es/Player/fps_play.js +25 -6
- package/es/Player/frontend_timeline.js +6 -7
- package/es/Player/player.d.ts +5 -0
- package/es/Player/segment_player.js +0 -1
- package/es/Player/segment_timeline.js +46 -5
- package/es/Player/single_player.js +7 -3
- package/es/Player/style/bar.css +1 -1
- package/es/Player/style/iconfont.js +15 -16
- package/es/Player/style/timeline.css +7 -0
- package/es/Player/style/volume.css +19 -0
- package/es/Player/util.d.ts +1 -0
- package/es/Player/util.js +8 -1
- package/es/ScreenPlayer/LiveTools.js +7 -27
- package/es/ScreenPlayer/RecordTools.js +31 -16
- package/es/ScreenPlayer/ScreenSelect.js +2 -2
- package/es/ScreenPlayer/TimeMode.js +1 -1
- package/es/ScreenPlayer/index.css +17 -8
- package/es/ScreenPlayer/utils.js +4 -4
- package/icon-fix.js +31 -0
- package/package.json +1 -1
- package/es/Map/SinglePoint/Marker/index.d.ts +0 -7
- package/es/Map/SinglePoint/Marker/index.js +0 -29
- package/es/ScreenPlayer/TimeSlider.d.ts +0 -129
- package/es/ScreenPlayer/TimeSlider.js +0 -556
|
@@ -6,5 +6,5 @@ interface ICustomRenderSelectProps extends SelectProps {
|
|
|
6
6
|
value: any;
|
|
7
7
|
customRender: (value: any) => JSX.Element;
|
|
8
8
|
}
|
|
9
|
-
declare function CustomRenderSelect({ children, value, customRender,
|
|
9
|
+
declare function CustomRenderSelect({ children, value, customRender, popupClassName, getPopupContainer, ...props }: ICustomRenderSelectProps): JSX.Element;
|
|
10
10
|
export default CustomRenderSelect;
|
|
@@ -24,9 +24,9 @@ function CustomRenderSelect(_a) {
|
|
|
24
24
|
var children = _a.children,
|
|
25
25
|
value = _a.value,
|
|
26
26
|
customRender = _a.customRender,
|
|
27
|
-
|
|
27
|
+
popupClassName = _a.popupClassName,
|
|
28
28
|
getPopupContainer = _a.getPopupContainer,
|
|
29
|
-
props = __rest(_a, ["children", "value", "customRender", "
|
|
29
|
+
props = __rest(_a, ["children", "value", "customRender", "popupClassName", "getPopupContainer"]);
|
|
30
30
|
|
|
31
31
|
var classname = useMemo(function () {
|
|
32
32
|
return "custom-render-select-dropdown-".concat(_uuid());
|
|
@@ -57,7 +57,7 @@ function CustomRenderSelect(_a) {
|
|
|
57
57
|
ref: domRef
|
|
58
58
|
}, /*#__PURE__*/React.createElement(_Select, Object.assign({}, props, {
|
|
59
59
|
value: value,
|
|
60
|
-
|
|
60
|
+
popupClassName: "custom-render-select-dropdown ".concat(classname, " ").concat(popupClassName),
|
|
61
61
|
getPopupContainer: getPopupContainer ? getPopupContainer : function () {
|
|
62
62
|
return domRef.current.parentElement.parentElement;
|
|
63
63
|
},
|
package/es/LoaderScript/utils.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { LatLng } from '../../interface';
|
|
3
2
|
export interface IDragMarkerProps {
|
|
4
3
|
center?: [number, number];
|
|
5
|
-
zoom?: number;
|
|
6
4
|
onChange?: (options: {
|
|
7
|
-
center: [number, number]
|
|
8
|
-
zoom: number;
|
|
5
|
+
center: [number, number];
|
|
9
6
|
}) => void;
|
|
10
7
|
}
|
|
11
8
|
declare function DragMarker({ center, onChange }: IDragMarkerProps): JSX.Element;
|
|
@@ -29,16 +29,13 @@ function DragMarker(_ref) {
|
|
|
29
29
|
var latlng = type.leaflet ? e.target.getLatLng() : e.target.getPosition();
|
|
30
30
|
instance.setCenter(latlng);
|
|
31
31
|
onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
32
|
-
center: latlng
|
|
33
|
-
zoom: instance.getZoom()
|
|
32
|
+
center: latlng
|
|
34
33
|
});
|
|
35
34
|
});
|
|
36
35
|
instance.map.on('zoomend', function (e) {
|
|
37
|
-
var zoom = e.target.getZoom();
|
|
38
36
|
var latlng = type.leaflet ? marker.getLatLng() : marker.getPosition();
|
|
39
37
|
onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
40
|
-
center: latlng,
|
|
41
|
-
zoom: zoom
|
|
38
|
+
center: [latlng.getLng(), latlng.getLat()]
|
|
42
39
|
});
|
|
43
40
|
}); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
44
41
|
}, [marker]);
|
|
@@ -48,14 +48,25 @@ function LevelCenter(_ref) {
|
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
});
|
|
51
|
+
useMapEvent('zoomed', function (event) {
|
|
52
|
+
onLevelCenterChange === null || onLevelCenterChange === void 0 ? void 0 : onLevelCenterChange({
|
|
53
|
+
center: defaultCenter,
|
|
54
|
+
zoom: event.target.getZoom()
|
|
55
|
+
});
|
|
56
|
+
});
|
|
51
57
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ClusterLayer, {
|
|
52
58
|
points: points
|
|
53
59
|
}), /*#__PURE__*/React.createElement(ResetTools, {
|
|
54
60
|
onMapReset: mapRest
|
|
55
61
|
}), /*#__PURE__*/React.createElement(DragMarker, {
|
|
56
62
|
center: defaultCenter,
|
|
57
|
-
|
|
58
|
-
|
|
63
|
+
onChange: function onChange(_ref2) {
|
|
64
|
+
var center = _ref2.center;
|
|
65
|
+
return onLevelCenterChange === null || onLevelCenterChange === void 0 ? void 0 : onLevelCenterChange({
|
|
66
|
+
center: center,
|
|
67
|
+
zoom: defaultZoom
|
|
68
|
+
});
|
|
69
|
+
}
|
|
59
70
|
}), children);
|
|
60
71
|
}
|
|
61
72
|
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { MapPoint } from '../interface';
|
|
2
3
|
import './index.less';
|
|
3
|
-
export interface
|
|
4
|
-
|
|
4
|
+
export interface ISinglePlayerProps {
|
|
5
|
+
center?: [number, number];
|
|
6
|
+
points: MapPoint[];
|
|
7
|
+
enableClick?: boolean;
|
|
8
|
+
onCenterChange?: (options: {
|
|
9
|
+
center: [number, number];
|
|
10
|
+
}) => void;
|
|
11
|
+
children?: React.ReactNode;
|
|
5
12
|
}
|
|
6
|
-
declare const _default: (props:
|
|
13
|
+
declare const _default: (props: ISinglePlayerProps) => JSX.Element;
|
|
7
14
|
export default _default;
|
|
@@ -1,35 +1,57 @@
|
|
|
1
1
|
import _useMount from "ahooks/es/useMount";
|
|
2
|
-
import React, { useCallback, useContext
|
|
2
|
+
import React, { useCallback, useContext } from 'react';
|
|
3
|
+
import ClusterLayer from '../ClusterLayer';
|
|
3
4
|
import ResetTools from '../ResetTools';
|
|
4
|
-
import
|
|
5
|
+
import DragMarker from '../LevelCenter/DragMarker';
|
|
5
6
|
import withMap from '../withMap';
|
|
6
7
|
import { mapContext } from '../Context';
|
|
7
|
-
import
|
|
8
|
+
import useMapEvent from '../hook/useMapEvent';
|
|
8
9
|
import "./index.css";
|
|
9
10
|
|
|
10
11
|
function SinglePoint(_ref) {
|
|
11
|
-
var
|
|
12
|
+
var center = _ref.center,
|
|
13
|
+
points = _ref.points,
|
|
14
|
+
onCenterChange = _ref.onCenterChange,
|
|
15
|
+
enableClick = _ref.enableClick,
|
|
16
|
+
children = _ref.children;
|
|
12
17
|
|
|
13
18
|
var _useContext = useContext(mapContext),
|
|
14
19
|
instance = _useContext.instance;
|
|
15
20
|
|
|
16
|
-
var type = useMapType();
|
|
17
|
-
var defaultCenter = useMemo(function () {
|
|
18
|
-
return type.AMap ? [point.longitude, point.latitude] : [point.latitude, point.longitude];
|
|
19
|
-
}, [type.AMap, point.longitude, point.latitude]);
|
|
20
21
|
var mapRest = useCallback(function () {
|
|
21
|
-
return instance.setZoomAndCenter(instance.config.zoom,
|
|
22
|
-
}, [
|
|
22
|
+
return instance.setZoomAndCenter(instance.config.zoom, instance.config.center);
|
|
23
|
+
}, [instance]);
|
|
23
24
|
|
|
24
25
|
_useMount(function () {
|
|
25
|
-
|
|
26
|
+
if (enableClick) {
|
|
27
|
+
instance.setCursor('pointer');
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
mapRest();
|
|
26
31
|
});
|
|
27
32
|
|
|
28
|
-
|
|
33
|
+
useMapEvent('click', function (event) {
|
|
34
|
+
if (enableClick) {
|
|
35
|
+
var _center = [event.lnglat.lng, event.lnglat.lat];
|
|
36
|
+
instance.setCenter(_center);
|
|
37
|
+
onCenterChange === null || onCenterChange === void 0 ? void 0 : onCenterChange({
|
|
38
|
+
center: _center
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ClusterLayer, {
|
|
43
|
+
points: points
|
|
44
|
+
}), /*#__PURE__*/React.createElement(ResetTools, {
|
|
29
45
|
onMapReset: mapRest
|
|
30
|
-
}), /*#__PURE__*/React.createElement(
|
|
31
|
-
|
|
32
|
-
|
|
46
|
+
}), /*#__PURE__*/React.createElement(DragMarker, {
|
|
47
|
+
center: center,
|
|
48
|
+
onChange: function onChange(_ref2) {
|
|
49
|
+
var center = _ref2.center;
|
|
50
|
+
return onCenterChange === null || onCenterChange === void 0 ? void 0 : onCenterChange({
|
|
51
|
+
center: center
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}), children);
|
|
33
55
|
}
|
|
34
56
|
|
|
35
57
|
export default withMap(SinglePoint, 'single-point-map-container');
|
package/es/Map/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ declare const Map: {
|
|
|
16
16
|
LoaderMap: typeof LoaderMap;
|
|
17
17
|
BasicMap: typeof BasicMap;
|
|
18
18
|
ResetTools: typeof ResetTools;
|
|
19
|
-
SinglePoint: (props: import("./SinglePoint").
|
|
19
|
+
SinglePoint: (props: import("./SinglePoint").ISinglePlayerProps) => JSX.Element;
|
|
20
20
|
useMarker: typeof useMarker;
|
|
21
21
|
withMap: typeof withMap;
|
|
22
22
|
};
|
package/es/Player/api/index.d.ts
CHANGED
|
@@ -8,12 +8,14 @@ declare class Api {
|
|
|
8
8
|
play: () => void;
|
|
9
9
|
pause: () => void;
|
|
10
10
|
get paused(): boolean;
|
|
11
|
+
get muted(): boolean;
|
|
11
12
|
/**
|
|
12
13
|
* 设置currentTime实现seek
|
|
13
14
|
* @param {*} seconds
|
|
14
15
|
*/
|
|
15
16
|
seekTo: (seconds: number) => void;
|
|
16
17
|
setVolume: (fraction: number) => void;
|
|
18
|
+
getVolume: () => number;
|
|
17
19
|
mute: () => void;
|
|
18
20
|
unmute: () => void;
|
|
19
21
|
/**
|
package/es/Player/api/index.js
CHANGED
|
@@ -50,6 +50,10 @@ var Api = /*#__PURE__*/function () {
|
|
|
50
50
|
_this.video.volume = fraction;
|
|
51
51
|
};
|
|
52
52
|
|
|
53
|
+
this.getVolume = function () {
|
|
54
|
+
return _this.video.volume;
|
|
55
|
+
};
|
|
56
|
+
|
|
53
57
|
this.mute = function () {
|
|
54
58
|
_this.video.muted = true;
|
|
55
59
|
};
|
|
@@ -185,6 +189,11 @@ var Api = /*#__PURE__*/function () {
|
|
|
185
189
|
get: function get() {
|
|
186
190
|
return this.video.paused;
|
|
187
191
|
}
|
|
192
|
+
}, {
|
|
193
|
+
key: "muted",
|
|
194
|
+
get: function get() {
|
|
195
|
+
return this.video.muted;
|
|
196
|
+
}
|
|
188
197
|
}]);
|
|
189
198
|
|
|
190
199
|
return Api;
|
|
@@ -13,10 +13,10 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
13
13
|
import React, { useState, useCallback, useMemo, useContext } from 'react';
|
|
14
14
|
import IconFont from '../iconfont';
|
|
15
15
|
import Bar from './bar';
|
|
16
|
-
import { useTimes } from '../timeline';
|
|
17
|
-
import { timeStamp } from '../util';
|
|
18
16
|
import { Context } from '../context';
|
|
19
17
|
import { useVideoEvent } from '../event';
|
|
18
|
+
import Volume from './volume';
|
|
19
|
+
import Time from './time';
|
|
20
20
|
|
|
21
21
|
function LeftBar(_ref) {
|
|
22
22
|
var reload = _ref.reload,
|
|
@@ -27,7 +27,6 @@ function LeftBar(_ref) {
|
|
|
27
27
|
|
|
28
28
|
var _useContext = useContext(Context),
|
|
29
29
|
api = _useContext.api,
|
|
30
|
-
event = _useContext.event,
|
|
31
30
|
container = _useContext.container,
|
|
32
31
|
isLive = _useContext.isLive,
|
|
33
32
|
isFpsPlay = _useContext.isFpsPlay;
|
|
@@ -55,13 +54,7 @@ function LeftBar(_ref) {
|
|
|
55
54
|
}, [paused]);
|
|
56
55
|
var statusText = useMemo(function () {
|
|
57
56
|
return paused ? '播放' : '暂停';
|
|
58
|
-
}, [paused]);
|
|
59
|
-
|
|
60
|
-
var _useTimes = useTimes(api, event, isFpsPlay),
|
|
61
|
-
_useTimes2 = _slicedToArray(_useTimes, 3),
|
|
62
|
-
current = _useTimes2[0],
|
|
63
|
-
duration = _useTimes2[2]; //TODO 方法
|
|
64
|
-
|
|
57
|
+
}, [paused]); //TODO 方法
|
|
65
58
|
|
|
66
59
|
var changePlayStatus = useCallback(function () {
|
|
67
60
|
if (video === null || video === void 0 ? void 0 : video.paused) {
|
|
@@ -78,15 +71,15 @@ function LeftBar(_ref) {
|
|
|
78
71
|
onClick: changePlayStatus,
|
|
79
72
|
type: statusIconClassName,
|
|
80
73
|
title: statusText
|
|
81
|
-
})),
|
|
82
|
-
|
|
83
|
-
}
|
|
74
|
+
})), /*#__PURE__*/React.createElement(Bar, null, /*#__PURE__*/React.createElement(Volume, {
|
|
75
|
+
api: api
|
|
76
|
+
})), !isLive && !hideTimeProgress && /*#__PURE__*/React.createElement(Time, null), /*#__PURE__*/React.createElement(Bar, null, /*#__PURE__*/React.createElement(IconFont, {
|
|
84
77
|
onClick: reload,
|
|
85
78
|
type: "lm-player-Refresh_Main",
|
|
86
79
|
title: "\u91CD\u8F7D"
|
|
87
80
|
})), !isLive && oneFpsPlay && /*#__PURE__*/React.createElement(Bar, null, /*#__PURE__*/React.createElement(IconFont, {
|
|
88
81
|
onClick: isFpsPlay ? api.closeFpsPlay : api.openFpsPlay,
|
|
89
|
-
type: "lm-player-
|
|
82
|
+
type: "lm-player-zhuzhenplay",
|
|
90
83
|
title: "\u9010\u5E27\u64AD\u653E"
|
|
91
84
|
})), leftMidExtContents);
|
|
92
85
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
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, { useContext } from 'react';
|
|
14
|
+
import { Context } from '../context';
|
|
15
|
+
import { useTimes } from '../timeline';
|
|
16
|
+
import { timeStamp } from '../util';
|
|
17
|
+
|
|
18
|
+
function Time() {
|
|
19
|
+
var _useContext = useContext(Context),
|
|
20
|
+
api = _useContext.api,
|
|
21
|
+
event = _useContext.event,
|
|
22
|
+
isFpsPlay = _useContext.isFpsPlay;
|
|
23
|
+
|
|
24
|
+
var _useTimes = useTimes(api, event, isFpsPlay),
|
|
25
|
+
_useTimes2 = _slicedToArray(_useTimes, 3),
|
|
26
|
+
current = _useTimes2[0],
|
|
27
|
+
duration = _useTimes2[2];
|
|
28
|
+
|
|
29
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
30
|
+
className: "video-time-progress"
|
|
31
|
+
}, timeStamp(current), "/", timeStamp(duration || 0));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export default Time;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type Api from '../api';
|
|
3
|
+
import '../style/volume.less';
|
|
4
|
+
declare function Volume({ api, style }: {
|
|
5
|
+
api: Api;
|
|
6
|
+
style?: React.CSSProperties;
|
|
7
|
+
}): JSX.Element;
|
|
8
|
+
declare const _default: React.MemoExoticComponent<typeof Volume>;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import "antd/lib/slider/style";
|
|
2
|
+
import _Slider from "antd/lib/slider";
|
|
3
|
+
import "antd/lib/tooltip/style";
|
|
4
|
+
import _Tooltip from "antd/lib/tooltip";
|
|
5
|
+
import _useUpdateEffect from "ahooks/es/useUpdateEffect";
|
|
6
|
+
import _useUpdate from "ahooks/es/useUpdate";
|
|
7
|
+
|
|
8
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
9
|
+
|
|
10
|
+
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."); }
|
|
11
|
+
|
|
12
|
+
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); }
|
|
13
|
+
|
|
14
|
+
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; }
|
|
15
|
+
|
|
16
|
+
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; }
|
|
17
|
+
|
|
18
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
19
|
+
|
|
20
|
+
import React, { useMemo, useState } from 'react';
|
|
21
|
+
import IconFont from '../iconfont';
|
|
22
|
+
import "../style/volume.css";
|
|
23
|
+
|
|
24
|
+
function Volume(_ref) {
|
|
25
|
+
var api = _ref.api,
|
|
26
|
+
style = _ref.style;
|
|
27
|
+
|
|
28
|
+
var _a;
|
|
29
|
+
|
|
30
|
+
var _useState = useState(Math.round((_a = api === null || api === void 0 ? void 0 : api.getVolume()) !== null && _a !== void 0 ? _a : 0 * 100)),
|
|
31
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
32
|
+
val = _useState2[0],
|
|
33
|
+
setVal = _useState2[1];
|
|
34
|
+
|
|
35
|
+
var update = _useUpdate(); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
var volume = useMemo(function () {
|
|
39
|
+
return (api === null || api === void 0 ? void 0 : api.muted) ? 0 : val;
|
|
40
|
+
}, undefined);
|
|
41
|
+
|
|
42
|
+
var onChange = function onChange(num) {
|
|
43
|
+
if (api === null || api === void 0 ? void 0 : api.muted) {
|
|
44
|
+
api === null || api === void 0 ? void 0 : api.unmute();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
setVal(num);
|
|
48
|
+
update();
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
var toggleMuted = function toggleMuted() {
|
|
52
|
+
if (!api) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (api.muted) {
|
|
57
|
+
api.unmute();
|
|
58
|
+
setVal(100);
|
|
59
|
+
} else {
|
|
60
|
+
api.mute();
|
|
61
|
+
setVal(0);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
update();
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
_useUpdateEffect(function () {
|
|
68
|
+
return api === null || api === void 0 ? void 0 : api.setVolume(val / 100);
|
|
69
|
+
}, [val]);
|
|
70
|
+
|
|
71
|
+
return /*#__PURE__*/React.createElement(_Tooltip, {
|
|
72
|
+
showArrow: false,
|
|
73
|
+
overlayClassName: "lm-player-volume-popup",
|
|
74
|
+
title: /*#__PURE__*/React.createElement(_Slider, {
|
|
75
|
+
onChange: onChange,
|
|
76
|
+
vertical: true,
|
|
77
|
+
value: val
|
|
78
|
+
})
|
|
79
|
+
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
80
|
+
style: style,
|
|
81
|
+
type: volume !== 0 ? 'lm-player-volume-open' : 'lm-player-volume-close',
|
|
82
|
+
onClick: toggleMuted
|
|
83
|
+
}));
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export default /*#__PURE__*/React.memo(Volume);
|
package/es/Player/fps_play.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ interface IFPSPlay {
|
|
|
5
5
|
api: Api;
|
|
6
6
|
event: VideoEventInstance;
|
|
7
7
|
fpsDelay?: number;
|
|
8
|
+
fps?: number;
|
|
8
9
|
}
|
|
9
|
-
declare function FPSPlay({ api, event, fpsDelay }: IFPSPlay): JSX.Element;
|
|
10
|
+
declare function FPSPlay({ api, event, fpsDelay, fps }: IFPSPlay): JSX.Element;
|
|
10
11
|
export default FPSPlay;
|
package/es/Player/fps_play.js
CHANGED
|
@@ -10,16 +10,18 @@ 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, { useEffect, useRef, useState } from 'react';
|
|
13
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
14
14
|
import Events from './event/eventName';
|
|
15
15
|
import useRafInterval from '../useRafInterval';
|
|
16
16
|
import { useRegisterPlayerEvent } from './event';
|
|
17
|
+
import { getDomStyleValue } from './util';
|
|
17
18
|
var oneFps = 1 / 30;
|
|
18
19
|
|
|
19
20
|
function FPSPlay(_ref) {
|
|
20
21
|
var api = _ref.api,
|
|
21
22
|
event = _ref.event,
|
|
22
|
-
fpsDelay = _ref.fpsDelay
|
|
23
|
+
fpsDelay = _ref.fpsDelay,
|
|
24
|
+
fps = _ref.fps;
|
|
23
25
|
|
|
24
26
|
var _useState = useState(Date.now()),
|
|
25
27
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -28,6 +30,9 @@ function FPSPlay(_ref) {
|
|
|
28
30
|
|
|
29
31
|
var ref = useRef(null);
|
|
30
32
|
var timerRef = useRef(null);
|
|
33
|
+
var fps_second = useMemo(function () {
|
|
34
|
+
return fps ? 1 / fps : oneFps;
|
|
35
|
+
}, [fps]);
|
|
31
36
|
useEffect(function () {
|
|
32
37
|
var fpsCapture = function fpsCapture() {
|
|
33
38
|
if (!ref.current || !event.video) {
|
|
@@ -35,7 +40,7 @@ function FPSPlay(_ref) {
|
|
|
35
40
|
}
|
|
36
41
|
|
|
37
42
|
var video = event.video;
|
|
38
|
-
var fpsTime = api.getCurrentTime() +
|
|
43
|
+
var fpsTime = api.getCurrentTime() + fps_second;
|
|
39
44
|
video.currentTime = fpsTime;
|
|
40
45
|
|
|
41
46
|
if (video.currentTime >= api.getDuration()) {
|
|
@@ -53,7 +58,20 @@ function FPSPlay(_ref) {
|
|
|
53
58
|
|
|
54
59
|
canvas.width = width;
|
|
55
60
|
canvas.height = height;
|
|
56
|
-
|
|
61
|
+
var fit = getDomStyleValue(video, 'object-fit');
|
|
62
|
+
|
|
63
|
+
if (fit === 'fill') {
|
|
64
|
+
//全画面绘制,存在拉伸
|
|
65
|
+
ctx.drawImage(video, 0, 0, width, height);
|
|
66
|
+
} else {
|
|
67
|
+
// 自适应绘制
|
|
68
|
+
var videoWidth = video.videoWidth;
|
|
69
|
+
var videoHeight = video.videoHeight;
|
|
70
|
+
var scale = height / videoHeight;
|
|
71
|
+
var s_vw = scale * videoWidth;
|
|
72
|
+
var paddingSize = (width - s_vw) / 2;
|
|
73
|
+
ctx.drawImage(video, paddingSize, 0, s_vw, height);
|
|
74
|
+
}
|
|
57
75
|
};
|
|
58
76
|
|
|
59
77
|
fpsCapture();
|
|
@@ -61,13 +79,14 @@ function FPSPlay(_ref) {
|
|
|
61
79
|
return function () {
|
|
62
80
|
clearInterval(timerRef.current);
|
|
63
81
|
};
|
|
64
|
-
}, [api, event, fpsDelay, forceKey]);
|
|
82
|
+
}, [api, event, fpsDelay, forceKey, fps_second]);
|
|
65
83
|
useRegisterPlayerEvent(Events.CANVAS_PAUSE, function () {
|
|
66
84
|
clearInterval(timerRef.current);
|
|
67
85
|
});
|
|
68
86
|
useRegisterPlayerEvent(Events.CANVAS_PLAY, function () {
|
|
69
87
|
update(Date.now());
|
|
70
|
-
});
|
|
88
|
+
}); // TODO: 未知情况,video会自动播放,轮训检测并暂停零时解决
|
|
89
|
+
|
|
71
90
|
useRafInterval(function () {
|
|
72
91
|
return !api.paused ? api.pause() : null;
|
|
73
92
|
}, 10);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _useUpdateEffect from "ahooks/es/useUpdateEffect";
|
|
2
2
|
|
|
3
3
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
4
|
|
|
@@ -47,13 +47,12 @@ function FrontendTimeLine(_ref) {
|
|
|
47
47
|
|
|
48
48
|
var _useTimes = useTimes(api, event),
|
|
49
49
|
_useTimes2 = _slicedToArray(_useTimes, 1),
|
|
50
|
-
currentTime = _useTimes2[0];
|
|
50
|
+
currentTime = _useTimes2[0]; // eslint-disable-next-line no-sequences
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}, [currentTime, url]);
|
|
52
|
+
|
|
53
|
+
_useUpdateEffect(function () {
|
|
54
|
+
return lastSeekCTimeRef.current = currentTime, undefined;
|
|
55
|
+
}, [currentTime]);
|
|
57
56
|
|
|
58
57
|
var rTime = useMemo(function () {
|
|
59
58
|
return state.time + currentTime + lastSeekCTimeRef.current;
|
package/es/Player/player.d.ts
CHANGED
|
@@ -142,6 +142,11 @@ export interface ISinglePlayerProps {
|
|
|
142
142
|
* 获取视频针的频次 (ms)
|
|
143
143
|
*/
|
|
144
144
|
fpsDelay?: number;
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* 视频每秒多少帧,用于控制逐帧播放
|
|
148
|
+
*/
|
|
149
|
+
fps?: number;
|
|
145
150
|
}
|
|
146
151
|
|
|
147
152
|
export interface IFrontendPlayerProps extends Omit<ISinglePlayerProps, 'isLive' | 'reload'> {
|
|
@@ -208,7 +208,6 @@ function SegmentPlayer(_a) {
|
|
|
208
208
|
update();
|
|
209
209
|
onCanPlayerInit === null || onCanPlayerInit === void 0 ? void 0 : onCanPlayerInit(); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
210
210
|
}, []);
|
|
211
|
-
console.log(playRef);
|
|
212
211
|
return /*#__PURE__*/React.createElement(SinglePlayer, Object.assign({
|
|
213
212
|
ref: playRef,
|
|
214
213
|
url: url,
|