@ray-js/ipc-player-integration 0.0.1-beta-32 → 0.0.1-beta-34
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/lib/ctx/ctx.composition.d.ts +9 -0
- package/lib/ctx/ctx.composition.js +10 -9
- package/lib/ctx/ctx.js +57 -16
- package/lib/hooks/index.d.ts +1 -0
- package/lib/hooks/index.js +2 -1
- package/lib/hooks/useDpState/useDpState.d.ts +6 -1
- package/lib/hooks/useDpState/useDpState.js +33 -5
- package/lib/hooks/useMemoizedFn/index.d.ts +1 -0
- package/lib/hooks/useMemoizedFn/index.js +1 -0
- package/lib/iconfont/iconfont.css +67 -8
- package/lib/iconfont/iconfont.js +13 -13
- package/lib/iconfont/iconfont.json +112 -7
- package/lib/iconfont/iconfont.ttf +0 -0
- package/lib/iconfont/iconfont.woff +0 -0
- package/lib/iconfont/iconfont.woff2 +0 -0
- package/lib/interface.d.ts +9 -9
- package/lib/plugins/battery/battery.composition.d.ts +14 -18
- package/lib/plugins/battery/battery.js +2 -2
- package/lib/plugins/battery/battery.less +3 -3
- package/lib/plugins/fullScreen/constant.d.ts +1 -0
- package/lib/plugins/fullScreen/constant.js +1 -0
- package/lib/plugins/fullScreen/fullScreen.d.ts +3 -1
- package/lib/plugins/fullScreen/fullScreen.js +49 -32
- package/lib/plugins/fullScreen/fullScreen.less +6 -1
- package/lib/plugins/fullScreen/fullTravelRouteControl.d.ts +8 -0
- package/lib/plugins/fullScreen/fullTravelRouteControl.js +73 -0
- package/lib/plugins/fullScreen/fullVoiceIntercom.d.ts +3 -0
- package/lib/plugins/fullScreen/fullVoiceIntercom.js +22 -13
- package/lib/plugins/fullScreen/verticalScreen.d.ts +1 -0
- package/lib/plugins/fullSmallIntercom/fullSmallIntercom.d.ts +3 -1
- package/lib/plugins/fullSmallIntercom/fullSmallIntercom.js +2 -4
- package/lib/plugins/index.d.ts +1 -0
- package/lib/plugins/index.js +2 -1
- package/lib/plugins/moveInteractiveControl/controlButton.d.ts +8 -0
- package/lib/plugins/moveInteractiveControl/controlButton.js +44 -0
- package/lib/plugins/moveInteractiveControl/controlButton.less +4 -0
- package/lib/plugins/moveInteractiveControl/index.d.ts +2 -0
- package/lib/plugins/moveInteractiveControl/index.js +2 -0
- package/lib/plugins/moveInteractiveControl/moveInteractiveControl.d.ts +6 -0
- package/lib/plugins/moveInteractiveControl/moveInteractiveControl.js +50 -0
- package/lib/plugins/moveInteractiveControl/moveInteractiveControl.less +38 -0
- package/lib/plugins/moveInteractiveControl/moveInteractiveControlUI.d.ts +28 -0
- package/lib/plugins/moveInteractiveControl/moveInteractiveControlUI.js +103 -0
- package/lib/plugins/moveInteractiveControl/moveInteractiveControlUI.less +71 -0
- package/lib/plugins/ptz/ptz.d.ts +5 -1
- package/lib/plugins/ptz/ptz.js +21 -7
- package/lib/plugins/ptz/ptz.less +26 -6
- package/lib/plugins/ptz/ptzControl.js +16 -7
- package/lib/plugins/resolution/fullResolutionControl.js +26 -12
- package/lib/plugins/resolution/resolution.d.ts +8 -2
- package/lib/plugins/resolution/resolution.js +25 -23
- package/lib/plugins/resolution/resolution.less +13 -2
- package/lib/plugins/verticalSmallIntercom/verticalSmallIntercom.d.ts +3 -1
- package/lib/plugins/verticalSmallIntercom/verticalSmallIntercom.js +0 -1
- package/lib/plugins/videoBitKBP/videoBitKBP.d.ts +3 -1
- package/lib/ui/bottomLeftContent.js +5 -7
- package/lib/ui/bottomRightContent.js +5 -7
- package/lib/ui/constant.d.ts +1 -0
- package/lib/ui/constant.js +1 -0
- package/lib/ui/context.d.ts +1 -0
- package/lib/ui/context.js +2 -1
- package/lib/ui/hooks.d.ts +1 -1
- package/lib/ui/hooks.js +3 -21
- package/lib/ui/index.d.ts +1 -0
- package/lib/ui/topLeftContent.d.ts +2 -2
- package/lib/ui/topLeftContent.js +6 -8
- package/lib/ui/topRightContent.js +5 -7
- package/lib/ui/ui.d.ts +2 -0
- package/lib/ui/ui.js +57 -40
- package/lib/ui/ui.less +49 -12
- package/lib/utils/device/index.d.ts +4 -0
- package/lib/utils/device/index.js +27 -1
- package/lib/utils/plugins/index.d.ts +4 -0
- package/lib/utils/plugins/index.js +20 -0
- package/package.json +7 -2
- package/lib/iconfont/demo.css +0 -539
- package/lib/iconfont/demo_index.html +0 -1062
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
.ipc-player-plugin-active-control-wrap {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
overflow: hidden;
|
|
5
|
+
background: var(--bgColor);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.ipc-player-plugin-active-control {
|
|
9
|
+
display: grid;
|
|
10
|
+
grid-template-columns: 1fr 1fr;
|
|
11
|
+
gap: calc(8px * var(--ipc-player-size-scale, 1));
|
|
12
|
+
padding: calc(16px * var(--ipc-player-size-scale, 1));
|
|
13
|
+
padding-top: 0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.ipc-player-plugin-active-control-title {
|
|
17
|
+
position: relative;
|
|
18
|
+
text-align: center;
|
|
19
|
+
font-size: calc(16px * var(--ipc-player-size-scale, 1));
|
|
20
|
+
font-weight: 600;
|
|
21
|
+
padding: calc(16px * var(--ipc-player-size-scale, 1));
|
|
22
|
+
color: var(--titleColor);
|
|
23
|
+
}
|
|
24
|
+
.ipc-player-plugin-active-control-item {
|
|
25
|
+
border-radius: calc(16px * var(--ipc-player-size-scale, 1));
|
|
26
|
+
background: var(--itemBgColor);
|
|
27
|
+
padding: calc(18px * var(--ipc-player-size-scale, 1)) calc(16px * var(--ipc-player-size-scale, 1));
|
|
28
|
+
font-size: calc(var(--itemFontSize) * var(--ipc-player-size-scale, 1));
|
|
29
|
+
display: flex;
|
|
30
|
+
flex-direction: column;
|
|
31
|
+
align-items: center;
|
|
32
|
+
color: var(--color);
|
|
33
|
+
&.ipc-player-plugin-active-control-item-active {
|
|
34
|
+
color: var(--activeColor);
|
|
35
|
+
.ipc-player-plugin-active-control-item-icon {
|
|
36
|
+
color: var(--activeColor);
|
|
37
|
+
.ipc-player-plugin-active-control-item-icon-mask {
|
|
38
|
+
background: var(--activeColor);
|
|
39
|
+
opacity: 0.05;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
.ipc-player-plugin-active-control-item-icon {
|
|
45
|
+
position: relative;
|
|
46
|
+
z-index: 1;
|
|
47
|
+
width: calc(42px * var(--ipc-player-size-scale, 1));
|
|
48
|
+
height: calc(42px * var(--ipc-player-size-scale, 1));
|
|
49
|
+
border-radius: calc(42px * var(--ipc-player-size-scale, 1));
|
|
50
|
+
margin-bottom: calc(11px * var(--ipc-player-size-scale, 1));
|
|
51
|
+
display: flex;
|
|
52
|
+
align-items: center;
|
|
53
|
+
justify-content: center;
|
|
54
|
+
font-size: calc(16px * var(--ipc-player-size-scale, 1));
|
|
55
|
+
color: var(--color);
|
|
56
|
+
overflow: hidden;
|
|
57
|
+
.ipc-player-plugin-active-control-item-icon-mask {
|
|
58
|
+
position: absolute;
|
|
59
|
+
width: 100%;
|
|
60
|
+
top: 0;
|
|
61
|
+
bottom: 0;
|
|
62
|
+
background: var(--iconBgColor);
|
|
63
|
+
opacity: 1;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
.ipc-player-plugin-active-control-item-title {
|
|
67
|
+
width: calc(70px * var(--ipc-player-size-scale, 1));
|
|
68
|
+
white-space: nowrap; /* 防止文本换行 */
|
|
69
|
+
overflow: hidden; /* 隐藏溢出文本 */
|
|
70
|
+
text-overflow: ellipsis; /* 使用省略号表示溢出文本 */
|
|
71
|
+
}
|
package/lib/plugins/ptz/ptz.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ComponentConfigProps } from '../../interface';
|
|
3
3
|
import './ptz.less';
|
|
4
|
-
|
|
4
|
+
type Props = ComponentConfigProps & {
|
|
5
|
+
className?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const Ptz: (props: Props) => React.JSX.Element | null;
|
|
8
|
+
export {};
|
package/lib/plugins/ptz/ptz.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
import { View, Text } from '@ray-js/ray';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import {
|
|
4
|
+
import React, { useEffect, useState, useContext } from 'react';
|
|
5
|
+
import { UIEventContext } from '../../ui/context';
|
|
6
|
+
import { useStore } from '../../ctx/store';
|
|
6
7
|
import { ptzControlId } from '../../ui/constant';
|
|
7
8
|
import './ptz.less';
|
|
8
9
|
import { PtzControl } from './ptzControl';
|
|
@@ -10,20 +11,29 @@ export const Ptz = props => {
|
|
|
10
11
|
const {
|
|
11
12
|
IPCPlayerContext,
|
|
12
13
|
screenType: screenTypeAtom,
|
|
13
|
-
ptzActive,
|
|
14
14
|
addContent,
|
|
15
15
|
deleteContent,
|
|
16
|
+
showContent,
|
|
17
|
+
hideContent,
|
|
16
18
|
className
|
|
17
19
|
} = props;
|
|
18
20
|
const {
|
|
19
21
|
screenType,
|
|
20
|
-
isPtzActive,
|
|
21
22
|
brandColor
|
|
22
23
|
} = useStore({
|
|
23
24
|
screenType: screenTypeAtom,
|
|
24
|
-
isPtzActive: ptzActive,
|
|
25
25
|
brandColor: props.brandColor
|
|
26
26
|
});
|
|
27
|
+
const [isPtzActive, setIsPtzActive] = useState(false);
|
|
28
|
+
const {
|
|
29
|
+
event
|
|
30
|
+
} = useContext(UIEventContext);
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (screenType === 'vertical') {
|
|
33
|
+
event.emit('ptzControlHide');
|
|
34
|
+
setIsPtzActive(false);
|
|
35
|
+
}
|
|
36
|
+
}, [screenType]);
|
|
27
37
|
if (screenType === 'vertical') {
|
|
28
38
|
return null;
|
|
29
39
|
}
|
|
@@ -31,6 +41,7 @@ export const Ptz = props => {
|
|
|
31
41
|
className: clsx(className),
|
|
32
42
|
onClick: () => {
|
|
33
43
|
if (!isPtzActive) {
|
|
44
|
+
showContent('bottomLeft', 'FullSmallIntercom');
|
|
34
45
|
// 添加ptz空间
|
|
35
46
|
addContent('absolute', {
|
|
36
47
|
id: ptzControlId,
|
|
@@ -40,10 +51,13 @@ export const Ptz = props => {
|
|
|
40
51
|
absoluteContentClassName: 'ipc-player-plugin-full-screen-ptz-control-wrap',
|
|
41
52
|
initProps: _objectSpread({}, props)
|
|
42
53
|
});
|
|
54
|
+
event.emit('ptzControlShow');
|
|
43
55
|
} else {
|
|
44
|
-
deleteContent('absolute', ptzControlId);
|
|
56
|
+
// deleteContent('absolute', ptzControlId);
|
|
57
|
+
hideContent('bottomLeft', 'FullSmallIntercom');
|
|
58
|
+
event.emit('ptzControlHide');
|
|
45
59
|
}
|
|
46
|
-
|
|
60
|
+
setIsPtzActive(!isPtzActive);
|
|
47
61
|
}
|
|
48
62
|
}, /*#__PURE__*/React.createElement(Text, {
|
|
49
63
|
className: clsx('icon-panel', 'icon-panel-ptz', 'ipc-player-plugin-ptz-text-icon'),
|
package/lib/plugins/ptz/ptz.less
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
@animation-time: 0.3s;
|
|
2
|
+
|
|
1
3
|
.ipc-player-plugin-ptz-text-icon {
|
|
2
4
|
color: var(--iconColor);
|
|
3
5
|
font-size: calc(var(--iconPlayerSize) * var(--ipc-player-size-scale, 1)) !important;
|
|
@@ -13,20 +15,38 @@
|
|
|
13
15
|
|
|
14
16
|
.ipc-player-plugin-full-screen-ptz-control-wrap {
|
|
15
17
|
position: absolute;
|
|
16
|
-
bottom:
|
|
18
|
+
bottom: 32px;
|
|
17
19
|
// transform: translate(0, -20%);
|
|
18
|
-
right: calc(
|
|
20
|
+
right: calc(32px * var(--ipc-player-size-scale, 1));;
|
|
19
21
|
z-index: 3;
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
|
|
25
|
+
@keyframes ipc-player-plugin-full-screen-ptz-control-move-in {
|
|
26
|
+
0% {
|
|
27
|
+
transform: translate(0, 200%); /* 从下方滑入 */
|
|
28
|
+
}
|
|
29
|
+
100% {
|
|
30
|
+
transform: translate(0, 0); /* 移动到目标位置 */
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@keyframes ipc-player-plugin-full-screen-ptz-control-move-out {
|
|
35
|
+
0% {
|
|
36
|
+
transform: translate(0, 0); /* 从当前位置开始 */
|
|
37
|
+
}
|
|
38
|
+
100% {
|
|
39
|
+
transform: translate(0, 200%); /* 向下滑出,隐藏 */
|
|
40
|
+
}
|
|
41
|
+
}
|
|
23
42
|
|
|
24
43
|
.ipc-player-plugin-full-screen-ptz-control {
|
|
25
44
|
transform: translate(0, 0);
|
|
26
|
-
transition:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
45
|
+
transition: @animation-time ease-in;
|
|
46
|
+
animation: ipc-player-plugin-full-screen-ptz-control-move-in @animation-time ease-in-out forwards;
|
|
47
|
+
&.ipc-player-plugin-full-screen-ptz-control-hide {
|
|
48
|
+
animation: ipc-player-plugin-full-screen-ptz-control-move-out @animation-time ease-in-out forwards;
|
|
49
|
+
}
|
|
30
50
|
}
|
|
31
51
|
|
|
32
52
|
.arrow-icon-wrapper {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import React, { useContext, useEffect, useRef } from 'react';
|
|
1
|
+
import React, { useContext, useEffect, useRef, useState } from 'react';
|
|
2
2
|
import { CoverView } from '@ray-js/ray';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import _find from 'lodash/find';
|
|
5
5
|
import _get from 'lodash/get';
|
|
6
6
|
import IpcPtzZoom from '@ray-js/ipc-ptz-zoom';
|
|
7
7
|
import IpcUtils from '@ray-js/ray-ipc-utils';
|
|
8
|
+
import { useMemoizedFn } from '../../hooks';
|
|
8
9
|
import { useComponentHideState } from '../../ui/hooks';
|
|
9
10
|
import { UIEventContext } from '../../ui/context';
|
|
10
11
|
import { useStore } from '../../ctx/store';
|
|
@@ -40,19 +41,27 @@ export const PtzControl = props => {
|
|
|
40
41
|
} = props;
|
|
41
42
|
const {
|
|
42
43
|
screenType,
|
|
43
|
-
brandColor
|
|
44
|
-
fullResolutionActive
|
|
44
|
+
brandColor
|
|
45
45
|
} = useStore({
|
|
46
46
|
screenType: props.screenType,
|
|
47
|
-
brandColor: props.brandColor
|
|
48
|
-
fullResolutionActive: props.fullResolutionActive
|
|
47
|
+
brandColor: props.brandColor
|
|
49
48
|
});
|
|
50
|
-
const [shouldHide] = useComponentHideState(
|
|
49
|
+
const [shouldHide] = useComponentHideState();
|
|
50
|
+
const [isPtzActive, setIsPtzActive] = useState(true);
|
|
51
51
|
const {
|
|
52
52
|
event
|
|
53
53
|
} = useContext(UIEventContext);
|
|
54
54
|
const ptzTimeId = useRef(null);
|
|
55
55
|
const ptzData = useRef(getPtzData(devId));
|
|
56
|
+
const onPtzControlHide = useMemoizedFn(() => {
|
|
57
|
+
setIsPtzActive(false);
|
|
58
|
+
});
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
event.on('ptzControlHide', onPtzControlHide);
|
|
61
|
+
return () => {
|
|
62
|
+
event.off('ptzControlHide', onPtzControlHide);
|
|
63
|
+
};
|
|
64
|
+
}, []);
|
|
56
65
|
useEffect(() => {
|
|
57
66
|
return () => {
|
|
58
67
|
if (ptzTimeId.current) {
|
|
@@ -63,7 +72,7 @@ export const PtzControl = props => {
|
|
|
63
72
|
}, []);
|
|
64
73
|
return /*#__PURE__*/React.createElement(CoverView, {
|
|
65
74
|
className: clsx('ipc-player-plugin-full-screen-ptz-control', {
|
|
66
|
-
'ipc-player-plugin-full-screen-ptz-control-hide': shouldHide ||
|
|
75
|
+
'ipc-player-plugin-full-screen-ptz-control-hide': shouldHide || !isPtzActive
|
|
67
76
|
})
|
|
68
77
|
}, /*#__PURE__*/React.createElement(IpcPtzZoom, {
|
|
69
78
|
ptzSize: "172px",
|
|
@@ -1,31 +1,46 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useCallback, useState, useContext, useEffect } from 'react';
|
|
2
2
|
import { Text, View } from '@ray-js/ray';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import Strings from '../../i18n';
|
|
5
|
-
import {
|
|
5
|
+
import { useMemoizedFn } from '../../hooks';
|
|
6
6
|
import { useStore } from '../../ctx/store';
|
|
7
|
+
import { UIEventContext } from '../../ui/context';
|
|
8
|
+
import { playerTap } from '../../ui/constant';
|
|
7
9
|
import './resolution.less';
|
|
8
10
|
export const FullResolutionControl = props => {
|
|
9
11
|
const {
|
|
10
|
-
setResolution
|
|
11
|
-
setFullResolutionActive
|
|
12
|
+
setResolution
|
|
12
13
|
} = props;
|
|
13
14
|
const {
|
|
14
15
|
screenType,
|
|
15
|
-
fullResolutionActive,
|
|
16
16
|
resolution,
|
|
17
17
|
resolutionList,
|
|
18
18
|
brandColor
|
|
19
19
|
} = useStore({
|
|
20
20
|
screenType: props.screenType,
|
|
21
|
-
fullResolutionActive: props.fullResolutionActive,
|
|
22
21
|
resolutionList: props.resolutionList,
|
|
23
22
|
brandColor: props.brandColor,
|
|
24
23
|
resolution: props.resolution
|
|
25
24
|
});
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
const {
|
|
26
|
+
event
|
|
27
|
+
} = useContext(UIEventContext);
|
|
28
|
+
const [hide, setHide] = useState(false);
|
|
29
|
+
const onShowFullResolutionControl = useMemoizedFn(() => {
|
|
30
|
+
setHide(false);
|
|
31
|
+
});
|
|
32
|
+
const onPlayerTap = useMemoizedFn(() => {
|
|
33
|
+
setHide(true);
|
|
34
|
+
});
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
event.on('showFullResolutionControl', onShowFullResolutionControl);
|
|
37
|
+
event.on(playerTap, onPlayerTap);
|
|
38
|
+
return () => {
|
|
39
|
+
event.off('showFullResolutionControl', onShowFullResolutionControl);
|
|
40
|
+
event.off(playerTap, onPlayerTap);
|
|
41
|
+
};
|
|
42
|
+
}, []);
|
|
43
|
+
const changeResolution = useCallback(value => {
|
|
29
44
|
if (value === resolution) {
|
|
30
45
|
ty.showToast({
|
|
31
46
|
icon: 'none',
|
|
@@ -33,12 +48,11 @@ export const FullResolutionControl = props => {
|
|
|
33
48
|
});
|
|
34
49
|
} else {
|
|
35
50
|
setResolution(value);
|
|
36
|
-
setFullResolutionActive(false);
|
|
37
51
|
}
|
|
38
|
-
};
|
|
52
|
+
}, [resolution]);
|
|
39
53
|
return /*#__PURE__*/React.createElement(View, {
|
|
40
54
|
className: clsx('ipc-player-plugin-full-resolution-control', {
|
|
41
|
-
'ipc-player-plugin-full-resolution-control-hide':
|
|
55
|
+
'ipc-player-plugin-full-resolution-control-hide': hide
|
|
42
56
|
})
|
|
43
57
|
}, resolutionList.map(item => /*#__PURE__*/React.createElement(Text, {
|
|
44
58
|
onClick: () => changeResolution(item),
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ComponentConfigProps } from '../../interface';
|
|
2
|
+
import { ComponentConfigProps, ScreenType } from '../../interface';
|
|
3
3
|
import './resolution.less';
|
|
4
|
-
export
|
|
4
|
+
export type ChangeResolutionWhenClick = ScreenType[];
|
|
5
|
+
type Props = ComponentConfigProps & {
|
|
6
|
+
className?: string;
|
|
7
|
+
changeResolutionWhenClick?: ChangeResolutionWhenClick;
|
|
8
|
+
};
|
|
9
|
+
export declare const Resolution: (props: Props) => React.JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -4,52 +4,54 @@ import clsx from 'clsx';
|
|
|
4
4
|
import React, { useContext } from 'react';
|
|
5
5
|
import Strings from '../../i18n';
|
|
6
6
|
import { FullResolutionControl } from './fullResolutionControl';
|
|
7
|
-
import { fullResolutionId, pauseTimeToHideAllComponent } from '../../ui/constant';
|
|
7
|
+
import { fullResolutionId, pauseTimeToHideAllComponent, hideAllComponent } from '../../ui/constant';
|
|
8
8
|
import { UIEventContext } from '../../ui/context';
|
|
9
9
|
import { useStore } from '../../ctx/store';
|
|
10
10
|
import './resolution.less';
|
|
11
|
+
const defaultChangeResolutionWhenClick = ['full'];
|
|
11
12
|
export const Resolution = props => {
|
|
12
13
|
const {
|
|
13
14
|
IPCPlayerContext,
|
|
14
15
|
setResolution,
|
|
15
16
|
addContent,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
hasContent,
|
|
18
|
+
className,
|
|
19
|
+
changeResolutionWhenClick = defaultChangeResolutionWhenClick
|
|
19
20
|
} = props;
|
|
20
21
|
const {
|
|
21
22
|
resolution,
|
|
22
23
|
screenType
|
|
23
24
|
} = useStore({
|
|
24
25
|
resolution: props.resolution,
|
|
25
|
-
screenType: props.screenType
|
|
26
|
-
fullResolutionActive: props.fullResolutionActive
|
|
26
|
+
screenType: props.screenType
|
|
27
27
|
});
|
|
28
28
|
const {
|
|
29
29
|
event
|
|
30
30
|
} = useContext(UIEventContext);
|
|
31
31
|
return /*#__PURE__*/React.createElement(View, {
|
|
32
32
|
onClick: () => {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
33
|
+
event.emit('resolutionBtnControlClick');
|
|
34
|
+
if (!(changeResolutionWhenClick !== null && changeResolutionWhenClick !== void 0 && changeResolutionWhenClick.length)) return false;
|
|
35
|
+
if (screenType === 'full' && defaultChangeResolutionWhenClick.includes(screenType)) {
|
|
36
|
+
event.emit(hideAllComponent);
|
|
37
|
+
if (hasContent('absolute', fullResolutionId)) {
|
|
38
|
+
event.emit('showFullResolutionControl');
|
|
39
|
+
} else {
|
|
40
|
+
addContent('absolute', {
|
|
41
|
+
id: fullResolutionId,
|
|
42
|
+
content: props => {
|
|
43
|
+
return /*#__PURE__*/React.createElement(FullResolutionControl, props);
|
|
44
|
+
},
|
|
45
|
+
absoluteContentClassName: 'ipc-player-plugin-full-resolution-control-wrap',
|
|
46
|
+
initProps: _objectSpread({}, props)
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
49
|
return false;
|
|
50
50
|
}
|
|
51
|
+
if (screenType === 'vertical' && defaultChangeResolutionWhenClick.includes(screenType)) {
|
|
52
|
+
setResolution(resolution === 'HD' ? 'SD' : 'HD');
|
|
53
|
+
}
|
|
51
54
|
event.emit(pauseTimeToHideAllComponent);
|
|
52
|
-
setResolution(resolution === 'HD' ? 'SD' : 'HD');
|
|
53
55
|
return true;
|
|
54
56
|
},
|
|
55
57
|
className: clsx(className, screenType === 'vertical' ? 'ipc-player-plugin-resolution-vertical' : 'ipc-player-plugin-resolution-full')
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
@animation-time: 0.3s;
|
|
2
|
+
|
|
1
3
|
.ipc-player-plugin-resolution {
|
|
2
4
|
background-color: rgba(255,255,255,0.2);
|
|
3
5
|
padding: calc(4px * var(--ipc-player-size-scale, 1)) calc(5px * var(--ipc-player-size-scale, 1)) !important;
|
|
@@ -15,15 +17,15 @@
|
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
.ipc-player-plugin-full-resolution-control {
|
|
18
|
-
transform: translate(0, 0);
|
|
19
20
|
height: 100%;
|
|
20
|
-
transition: transform
|
|
21
|
+
transition: transform @animation-time ease-in, opacity @animation-time ease-in, width @animation-time ease-in;
|
|
21
22
|
width: 200px;
|
|
22
23
|
display: flex;
|
|
23
24
|
flex-direction: column;
|
|
24
25
|
justify-content: center;
|
|
25
26
|
align-items: center;
|
|
26
27
|
background-color: rgba(0,0,0,0.9);
|
|
28
|
+
animation: ipc-player-plugin-full-resolution-control-move-in @animation-time ease-in-out;
|
|
27
29
|
&.ipc-player-plugin-full-resolution-control-hide {
|
|
28
30
|
transform: translate(300%, 0);
|
|
29
31
|
opacity: 0;
|
|
@@ -43,6 +45,15 @@
|
|
|
43
45
|
z-index: 345;
|
|
44
46
|
}
|
|
45
47
|
|
|
48
|
+
@keyframes ipc-player-plugin-full-resolution-control-move-in {
|
|
49
|
+
from {
|
|
50
|
+
transform: translate(300%, 0);
|
|
51
|
+
}
|
|
52
|
+
to {
|
|
53
|
+
transform: translate(0, 0);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
46
57
|
.ipc-player-plugin-full-resolution-control-text {
|
|
47
58
|
font-size: 14px;
|
|
48
59
|
font-weight: 400;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ComponentConfigProps } from '../../interface';
|
|
3
3
|
import './verticalSmallIntercom.less';
|
|
4
|
-
type Props = ComponentConfigProps
|
|
4
|
+
type Props = ComponentConfigProps & {
|
|
5
|
+
className?: string;
|
|
6
|
+
};
|
|
5
7
|
export declare function VerticalSmallIntercom(props: Props): React.JSX.Element | null;
|
|
6
8
|
export {};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ComponentConfigProps } from '../../interface';
|
|
3
3
|
import './videoBitKBP.less';
|
|
4
|
-
type Props = ComponentConfigProps
|
|
4
|
+
type Props = ComponentConfigProps & {
|
|
5
|
+
className?: string;
|
|
6
|
+
};
|
|
5
7
|
export declare const VideoBitKBP: (props: Props) => React.JSX.Element | null;
|
|
6
8
|
export {};
|
|
@@ -9,14 +9,12 @@ const BottomLeftContent = _ref => {
|
|
|
9
9
|
children
|
|
10
10
|
} = _ref;
|
|
11
11
|
const {
|
|
12
|
-
screenType
|
|
13
|
-
fullResolutionActive
|
|
12
|
+
screenType
|
|
14
13
|
} = useStore({
|
|
15
14
|
screenType: ctx.screenType,
|
|
16
|
-
playState: ctx.playState
|
|
17
|
-
fullResolutionActive: ctx.fullResolutionActive
|
|
15
|
+
playState: ctx.playState
|
|
18
16
|
});
|
|
19
|
-
const [shouldHide] = useComponentHideState(
|
|
17
|
+
const [shouldHide] = useComponentHideState();
|
|
20
18
|
return /*#__PURE__*/React.createElement(CoverView, {
|
|
21
19
|
className: clsx('ipc-player-bottom-left-content-wrap')
|
|
22
20
|
}, /*#__PURE__*/React.createElement(View, {
|
|
@@ -25,8 +23,8 @@ const BottomLeftContent = _ref => {
|
|
|
25
23
|
paddingLeft: screenType === 'vertical' ? 0 : '25px'
|
|
26
24
|
},
|
|
27
25
|
className: clsx('ipc-player-bottom-left-content-container', {
|
|
28
|
-
'ipc-player-bottom-left-content-hide': shouldHide
|
|
29
|
-
'ipc-player-bottom-left-content-show': !shouldHide
|
|
26
|
+
// 'ipc-player-bottom-left-content-hide': shouldHide,
|
|
27
|
+
// 'ipc-player-bottom-left-content-show': !shouldHide,
|
|
30
28
|
})
|
|
31
29
|
}, children));
|
|
32
30
|
};
|
|
@@ -9,14 +9,12 @@ const BottomRightContent = _ref => {
|
|
|
9
9
|
children
|
|
10
10
|
} = _ref;
|
|
11
11
|
const {
|
|
12
|
-
screenType
|
|
13
|
-
fullResolutionActive
|
|
12
|
+
screenType
|
|
14
13
|
} = useStore({
|
|
15
14
|
screenType: ctx.screenType,
|
|
16
|
-
playState: ctx.playState
|
|
17
|
-
fullResolutionActive: ctx.fullResolutionActive
|
|
15
|
+
playState: ctx.playState
|
|
18
16
|
});
|
|
19
|
-
const [shouldHide] = useComponentHideState(
|
|
17
|
+
const [shouldHide] = useComponentHideState();
|
|
20
18
|
return /*#__PURE__*/React.createElement(CoverView, {
|
|
21
19
|
className: clsx('ipc-player-bottom-right-content-wrap')
|
|
22
20
|
}, /*#__PURE__*/React.createElement(View, {
|
|
@@ -25,8 +23,8 @@ const BottomRightContent = _ref => {
|
|
|
25
23
|
paddingRight: screenType === 'vertical' ? 0 : '25px'
|
|
26
24
|
},
|
|
27
25
|
className: clsx('ipc-player-bottom-right-content-container', {
|
|
28
|
-
'ipc-player-bottom-right-content-hide': shouldHide
|
|
29
|
-
'ipc-player-bottom-right-content-show': !shouldHide
|
|
26
|
+
// 'ipc-player-bottom-right-content-hide': shouldHide,
|
|
27
|
+
// 'ipc-player-bottom-right-content-show': !shouldHide,
|
|
30
28
|
})
|
|
31
29
|
}, children));
|
|
32
30
|
};
|
package/lib/ui/constant.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export declare const playerTap = "playerTap";
|
|
|
4
4
|
export declare const pauseTimeToHideAllComponent = "pauseTimeToHideAllComponent";
|
|
5
5
|
export declare const startTimeToHideAllComponent = "startTimeToHideAllComponent";
|
|
6
6
|
export declare const voiceIntercomId = "voiceIntercomId";
|
|
7
|
+
export declare const fullTravelRouteControlId = "fullTravelRouteControl";
|
|
7
8
|
export declare const verticalScreenId = "verticalScreenId";
|
|
8
9
|
export declare const ptzControlId = "ptzControlId";
|
|
9
10
|
export declare const fullResolutionId = "fullResolutionId";
|
package/lib/ui/constant.js
CHANGED
|
@@ -4,6 +4,7 @@ export const playerTap = 'playerTap';
|
|
|
4
4
|
export const pauseTimeToHideAllComponent = 'pauseTimeToHideAllComponent';
|
|
5
5
|
export const startTimeToHideAllComponent = 'startTimeToHideAllComponent';
|
|
6
6
|
export const voiceIntercomId = 'voiceIntercomId';
|
|
7
|
+
export const fullTravelRouteControlId = 'fullTravelRouteControl';
|
|
7
8
|
export const verticalScreenId = 'verticalScreenId';
|
|
8
9
|
export const ptzControlId = 'ptzControlId';
|
|
9
10
|
export const fullResolutionId = 'fullResolutionId';
|
package/lib/ui/context.d.ts
CHANGED
package/lib/ui/context.js
CHANGED
package/lib/ui/hooks.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const useComponentHideState: (
|
|
1
|
+
export declare const useComponentHideState: () => boolean[];
|
package/lib/ui/hooks.js
CHANGED
|
@@ -1,26 +1,8 @@
|
|
|
1
|
-
import { useContext
|
|
1
|
+
import { useContext } from 'react';
|
|
2
2
|
import { UIEventContext } from './context';
|
|
3
|
-
import { hideAllComponent, showAllComponent } from './constant';
|
|
4
3
|
export const useComponentHideState = () => {
|
|
5
4
|
const {
|
|
6
|
-
|
|
5
|
+
componentHideState
|
|
7
6
|
} = useContext(UIEventContext);
|
|
8
|
-
|
|
9
|
-
const listenHideEvent = () => {
|
|
10
|
-
// 横竖屏都支持点击隐藏
|
|
11
|
-
// if (screenType === 'vertical') return;
|
|
12
|
-
setShouldHide(true);
|
|
13
|
-
};
|
|
14
|
-
const listenShowEvent = () => {
|
|
15
|
-
setShouldHide(false);
|
|
16
|
-
};
|
|
17
|
-
useEffect(() => {
|
|
18
|
-
event.on(hideAllComponent, listenHideEvent);
|
|
19
|
-
event.on(showAllComponent, listenShowEvent);
|
|
20
|
-
return () => {
|
|
21
|
-
event.off(hideAllComponent, listenHideEvent);
|
|
22
|
-
event.off(showAllComponent, listenShowEvent);
|
|
23
|
-
};
|
|
24
|
-
}, [listenHideEvent]);
|
|
25
|
-
return [shouldHide];
|
|
7
|
+
return [componentHideState];
|
|
26
8
|
};
|
package/lib/ui/index.d.ts
CHANGED
|
@@ -4,5 +4,5 @@ type Props = {
|
|
|
4
4
|
ctx: ReturnType<UseCtx>;
|
|
5
5
|
children: React.ReactNode;
|
|
6
6
|
};
|
|
7
|
-
declare const
|
|
8
|
-
export default
|
|
7
|
+
declare const _default: React.MemoExoticComponent<({ ctx, children }: Props) => React.JSX.Element>;
|
|
8
|
+
export default _default;
|
package/lib/ui/topLeftContent.js
CHANGED
|
@@ -9,14 +9,12 @@ const TopLeftContent = _ref => {
|
|
|
9
9
|
children
|
|
10
10
|
} = _ref;
|
|
11
11
|
const {
|
|
12
|
-
screenType
|
|
13
|
-
fullResolutionActive
|
|
12
|
+
screenType
|
|
14
13
|
} = useStore({
|
|
15
14
|
screenType: ctx.screenType,
|
|
16
|
-
playState: ctx.playState
|
|
17
|
-
fullResolutionActive: ctx.fullResolutionActive
|
|
15
|
+
playState: ctx.playState
|
|
18
16
|
});
|
|
19
|
-
const [shouldHide] = useComponentHideState(
|
|
17
|
+
const [shouldHide] = useComponentHideState();
|
|
20
18
|
return /*#__PURE__*/React.createElement(CoverView, {
|
|
21
19
|
className: clsx('ipc-player-top-left-content-wrap')
|
|
22
20
|
}, /*#__PURE__*/React.createElement(View, {
|
|
@@ -25,9 +23,9 @@ const TopLeftContent = _ref => {
|
|
|
25
23
|
paddingLeft: screenType === 'vertical' ? 0 : '25px'
|
|
26
24
|
},
|
|
27
25
|
className: clsx('ipc-player-top-left-content-container', {
|
|
28
|
-
'ipc-player-top-left-content-hide': shouldHide
|
|
29
|
-
'ipc-player-top-left-content-show': !shouldHide
|
|
26
|
+
// 'ipc-player-top-left-content-hide': shouldHide,
|
|
27
|
+
// 'ipc-player-top-left-content-show': !shouldHide,
|
|
30
28
|
})
|
|
31
29
|
}, children));
|
|
32
30
|
};
|
|
33
|
-
export default TopLeftContent;
|
|
31
|
+
export default /*#__PURE__*/React.memo(TopLeftContent);
|