@ray-js/ipc-player-integration 0.0.1-beta-22 → 0.0.1-beta-24
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.js +13 -5
- package/lib/i18n/index.d.ts +24 -8
- package/lib/i18n/strings.d.ts +12 -4
- package/lib/i18n/strings.js +12 -4
- package/lib/interface.d.ts +7 -1
- package/lib/plugins/fullScreen/fullScreen.js +1 -3
- package/lib/plugins/fullScreen/fullScreen.less +2 -1
- package/lib/plugins/fullScreen/voiceIntercom.js +2 -2
- package/lib/plugins/ptz/ptz.js +9 -6
- package/lib/plugins/ptz/ptz.less +1 -6
- package/lib/plugins/ptz/ptzControl.d.ts +0 -1
- package/lib/plugins/ptz/ptzControl.js +76 -30
- package/lib/plugins/recordVideo/recordVideo.js +148 -21
- package/lib/plugins/recordVideo/recordVideo.less +61 -4
- package/lib/plugins/resolution/fullResolutionControl.js +2 -1
- package/lib/plugins/resolution/resolution.js +3 -0
- package/lib/plugins/resolution/resolution.less +1 -2
- package/lib/plugins/screenshot/screenshot.js +40 -13
- package/lib/plugins/screenshot/screenshot.less +1 -4
- package/lib/plugins/voiceIntercom/voiceIntercom.d.ts +1 -1
- package/lib/plugins/voiceIntercom/voiceIntercom.js +25 -18
- package/lib/ui/bottomLeftContent.js +5 -5
- package/lib/ui/bottomRightContent.js +5 -5
- package/lib/ui/topLeftContent.js +6 -10
- package/lib/ui/topRightContent.js +5 -5
- package/lib/ui/ui.d.ts +1 -0
- package/lib/ui/ui.js +25 -21
- package/lib/utils/device/index.d.ts +6 -0
- package/lib/utils/device/index.js +52 -0
- package/lib/utils/index.d.ts +3 -0
- package/lib/utils/index.js +15 -0
- package/package.json +3 -3
|
@@ -3,13 +3,26 @@
|
|
|
3
3
|
color: var(--iconColor);
|
|
4
4
|
}
|
|
5
5
|
.ipc-player-plugin-record-video-toast-wrap {
|
|
6
|
-
z-index:
|
|
6
|
+
z-index: 400;
|
|
7
7
|
position: absolute;
|
|
8
8
|
top: calc(7px * var(--ipc-player-size-scale, 1));
|
|
9
9
|
left: 50%;
|
|
10
10
|
transform: translateX(-50%);
|
|
11
11
|
}
|
|
12
|
+
|
|
13
|
+
// 计时器显示
|
|
14
|
+
.ipc-player-plugin-record-video-toast-show {
|
|
15
|
+
transform: translate(0, 0) !important;
|
|
16
|
+
transition: transform ease-in 3s;
|
|
17
|
+
}
|
|
18
|
+
// 计时器隐藏
|
|
19
|
+
.ipc-player-plugin-record-video-toast-hide {
|
|
20
|
+
transform: translate(0, -110%) !important;
|
|
21
|
+
transition: transform 0.3s ease-in-out;
|
|
22
|
+
}
|
|
23
|
+
|
|
12
24
|
.ipc-player-plugin-record-video-toast {
|
|
25
|
+
transform: translate(0, -110%);
|
|
13
26
|
display: flex;
|
|
14
27
|
padding: calc(12px * var(--ipc-player-size-scale, 1));
|
|
15
28
|
align-items: center;
|
|
@@ -21,21 +34,65 @@
|
|
|
21
34
|
width: calc(6px * var(--ipc-player-size-scale, 1));
|
|
22
35
|
height: calc(6px * var(--ipc-player-size-scale, 1));
|
|
23
36
|
border-radius: calc(6px * var(--ipc-player-size-scale, 1));
|
|
24
|
-
background-color: #FF3838;
|
|
25
37
|
}
|
|
26
38
|
.ipc-player-plugin-record-video-toast-time {
|
|
27
39
|
font-size: calc(12px * var(--ipc-player-size-scale, 1));;
|
|
28
|
-
font-weight:
|
|
40
|
+
font-weight: 700;
|
|
29
41
|
color: var(--fontColor);
|
|
30
42
|
margin-left: calc(8px * var(--ipc-player-size-scale, 1));;
|
|
31
43
|
display: flex;
|
|
32
44
|
align-items: center;
|
|
45
|
+
font-family: Manrope !important;
|
|
33
46
|
.ipc-player-plugin-record-video-toast-time-warp {
|
|
34
|
-
width: calc(17px * var(--ipc-player-size-scale, 1));;
|
|
35
47
|
text-align: center;
|
|
36
48
|
}
|
|
37
49
|
.ipc-player-plugin-record-video-toast-time-delimiter {
|
|
38
50
|
margin: 0 calc(2px * var(--ipc-player-size-scale, 1));;
|
|
39
51
|
}
|
|
40
52
|
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** 录制成功弹窗 */
|
|
56
|
+
.ipc-player-plugin-record-success-toast-wrap {
|
|
57
|
+
position: absolute;
|
|
58
|
+
}
|
|
59
|
+
.ipc-player-plugin-record-success-toast {
|
|
60
|
+
flex: 1;
|
|
61
|
+
border-radius: calc(8px * var(--ipc-player-size-scale, 1));;
|
|
62
|
+
background-color: var(--shot-card-bg-color);
|
|
63
|
+
display: flex;
|
|
64
|
+
align-items: center;
|
|
65
|
+
padding: calc(8px * var(--ipc-player-size-scale, 1)) calc(12px * var(--ipc-player-size-scale, 1));
|
|
66
|
+
z-index: 100;
|
|
67
|
+
.ipc-player-plugin-record-success-toast-image-box {
|
|
68
|
+
border-radius: calc(4px * var(--ipc-player-size-scale, 1));
|
|
69
|
+
overflow: hidden;
|
|
70
|
+
width: calc(66px * var(--ipc-player-size-scale, 1));
|
|
71
|
+
height: calc(66px * 0.57 * var(--ipc-player-size-scale, 1));
|
|
72
|
+
}
|
|
73
|
+
.ipc-player-plugin-record-success-toast-image {
|
|
74
|
+
width: 100%;
|
|
75
|
+
height: 100%;
|
|
76
|
+
object-fit: cover;
|
|
77
|
+
}
|
|
78
|
+
.ipc-player-plugin-record-success-toast-title {
|
|
79
|
+
flex: 1;
|
|
80
|
+
margin-left: calc(12px * var(--ipc-player-size-scale, 1));
|
|
81
|
+
font-size: calc(14px * var(--ipc-player-size-scale, 1));
|
|
82
|
+
color: var(--fontColor);
|
|
83
|
+
margin-right: calc(12px * var(--ipc-player-size-scale, 1));
|
|
84
|
+
word-break: break-word;
|
|
85
|
+
|
|
86
|
+
}
|
|
87
|
+
.ipc-player-plugin-record-success-toast-bottom {
|
|
88
|
+
border: 1px solid #1989FA;
|
|
89
|
+
min-width: calc(52px * var(--ipc-player-size-scale, 1));
|
|
90
|
+
max-width: calc(100px * var(--ipc-player-size-scale, 1));
|
|
91
|
+
border-radius: calc(4px * var(--ipc-player-size-scale, 1));
|
|
92
|
+
padding: calc(5px * var(--ipc-player-size-scale, 1)) calc(11px * var(--ipc-player-size-scale, 1));
|
|
93
|
+
font-size: calc(14px * var(--ipc-player-size-scale, 1));
|
|
94
|
+
white-space: nowrap;
|
|
95
|
+
overflow: hidden;
|
|
96
|
+
text-overflow: ellipsis;
|
|
97
|
+
}
|
|
41
98
|
}
|
|
@@ -12,6 +12,7 @@ export const FullResolutionControl = props => {
|
|
|
12
12
|
setResolution,
|
|
13
13
|
setFullResolutionActive
|
|
14
14
|
} = props;
|
|
15
|
+
console.log(props, 'props========');
|
|
15
16
|
const {
|
|
16
17
|
screenType,
|
|
17
18
|
fullResolutionActive,
|
|
@@ -51,5 +52,5 @@ export const FullResolutionControl = props => {
|
|
|
51
52
|
style: item === resolution && {
|
|
52
53
|
color: brandColor
|
|
53
54
|
}
|
|
54
|
-
},
|
|
55
|
+
}, Strings.getLang(`ipc_player_resolution_${item}`))));
|
|
55
56
|
};
|
|
@@ -13,6 +13,7 @@ export const Resolution = props => {
|
|
|
13
13
|
IPCPlayerContext,
|
|
14
14
|
setResolution,
|
|
15
15
|
addContent,
|
|
16
|
+
deleteContent,
|
|
16
17
|
setFullResolutionActive,
|
|
17
18
|
className
|
|
18
19
|
} = props;
|
|
@@ -30,6 +31,8 @@ export const Resolution = props => {
|
|
|
30
31
|
return /*#__PURE__*/React.createElement(View, {
|
|
31
32
|
onClick: () => {
|
|
32
33
|
if (screenType === 'full') {
|
|
34
|
+
// 移除全屏清晰度空间
|
|
35
|
+
deleteContent('absolute', fullResolutionId);
|
|
33
36
|
// 添加全屏清晰度空间
|
|
34
37
|
addContent('absolute', {
|
|
35
38
|
id: fullResolutionId,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React, { useRef } from 'react';
|
|
2
2
|
import { View, Image, Text } from '@ray-js/ray';
|
|
3
|
+
import { useSetState, useUpdateEffect } from 'ahooks';
|
|
3
4
|
import clsx from 'clsx';
|
|
4
5
|
import IpcUtils from '@ray-js/ray-ipc-utils';
|
|
5
|
-
import Strings from '
|
|
6
|
+
import Strings from '../../i18n';
|
|
6
7
|
import { useStore } from '../../ctx/store';
|
|
7
8
|
import './screenshot.less';
|
|
8
9
|
const CLOSE_TIME = 5000;
|
|
@@ -23,18 +24,37 @@ export function Screenshot(props) {
|
|
|
23
24
|
screenType: props.screenType,
|
|
24
25
|
brandColor: props.brandColor
|
|
25
26
|
});
|
|
26
|
-
|
|
27
|
+
|
|
28
|
+
/** 记录截屏url */
|
|
29
|
+
const [state, setState] = useSetState({
|
|
30
|
+
showShot: false,
|
|
31
|
+
shotUrl: ''
|
|
32
|
+
});
|
|
33
|
+
useUpdateEffect(() => {
|
|
34
|
+
if (state.showShot && screenType) {
|
|
35
|
+
showShotToast();
|
|
36
|
+
}
|
|
37
|
+
}, [state.showShot, screenType]);
|
|
38
|
+
const timer = useRef();
|
|
27
39
|
const timeToCloseToast = () => {
|
|
28
|
-
|
|
29
|
-
//
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
40
|
+
clearInterval(timer.current);
|
|
41
|
+
// @ts-ignore
|
|
42
|
+
timer.current = setTimeout(() => {
|
|
43
|
+
setState({
|
|
44
|
+
showShot: false,
|
|
45
|
+
shotUrl: ''
|
|
46
|
+
});
|
|
47
|
+
deleteContent('absolute', 'plugin-screenshot-toast');
|
|
48
|
+
}, CLOSE_TIME);
|
|
33
49
|
};
|
|
50
|
+
|
|
51
|
+
/** 跳转相册 */
|
|
34
52
|
const handCheck = () => {
|
|
35
53
|
IpcUtils.goToIpcPageNativeRoute('ipc_album_panel', devId);
|
|
36
54
|
};
|
|
37
|
-
|
|
55
|
+
|
|
56
|
+
/** 添加截屏成功弹窗 */
|
|
57
|
+
const showShotToast = () => {
|
|
38
58
|
deleteContent('absolute', 'plugin-screenshot-toast');
|
|
39
59
|
addContent('absolute', {
|
|
40
60
|
id: 'plugin-screenshot-toast',
|
|
@@ -42,7 +62,10 @@ export function Screenshot(props) {
|
|
|
42
62
|
absolutePosition: {
|
|
43
63
|
top: screenType === 'vertical' ? '12px' : '60px',
|
|
44
64
|
left: screenType === 'vertical' ? '16px' : '50%',
|
|
45
|
-
right: screenType === 'vertical' ? '16px' : '
|
|
65
|
+
right: screenType === 'vertical' ? '16px' : 'unset',
|
|
66
|
+
display: 'flex',
|
|
67
|
+
width: screenType === 'vertical' ? 'auto' : '400px',
|
|
68
|
+
marginLeft: screenType === 'vertical' ? '0' : '-200px'
|
|
46
69
|
},
|
|
47
70
|
content: () => {
|
|
48
71
|
return /*#__PURE__*/React.createElement(View, {
|
|
@@ -51,7 +74,7 @@ export function Screenshot(props) {
|
|
|
51
74
|
className: "ipc-player-plugin-screenshot-toast-image-box"
|
|
52
75
|
}, /*#__PURE__*/React.createElement(Image, {
|
|
53
76
|
className: "ipc-player-plugin-screenshot-toast-image",
|
|
54
|
-
src:
|
|
77
|
+
src: state.shotUrl
|
|
55
78
|
})), /*#__PURE__*/React.createElement(View, {
|
|
56
79
|
className: "ipc-player-plugin-screenshot-toast-title"
|
|
57
80
|
}, Strings.getLang('ipc_player_screenshot_success_tip')), /*#__PURE__*/React.createElement(View, {
|
|
@@ -61,7 +84,7 @@ export function Screenshot(props) {
|
|
|
61
84
|
color: brandColor,
|
|
62
85
|
borderColor: brandColor
|
|
63
86
|
}
|
|
64
|
-
}, Strings.getLang('
|
|
87
|
+
}, Strings.getLang('ipc_player_shot_success_check')));
|
|
65
88
|
}
|
|
66
89
|
});
|
|
67
90
|
timeToCloseToast();
|
|
@@ -74,11 +97,15 @@ export function Screenshot(props) {
|
|
|
74
97
|
saveToAlbum,
|
|
75
98
|
// 保存到 IPC 相册
|
|
76
99
|
success: res => {
|
|
77
|
-
|
|
100
|
+
console.log(res, 'res');
|
|
101
|
+
setState({
|
|
102
|
+
showShot: true,
|
|
103
|
+
shotUrl: res.tempImagePath
|
|
104
|
+
});
|
|
78
105
|
},
|
|
79
106
|
fail: err => {
|
|
80
107
|
const errObj = err.innerError || err || {};
|
|
81
|
-
const errMsg = errObj.errorMsg ||
|
|
108
|
+
const errMsg = errObj.errorMsg || Strings.getLang('ipc_player_error_screenshot_error_tip');
|
|
82
109
|
toast({
|
|
83
110
|
title: errMsg
|
|
84
111
|
});
|
|
@@ -4,12 +4,9 @@
|
|
|
4
4
|
}
|
|
5
5
|
.ipc-player-plugin-screenshot-toast-wrap {
|
|
6
6
|
position: absolute;
|
|
7
|
-
// max-width: 300px;
|
|
8
|
-
// left: 50%;
|
|
9
|
-
// transform: translateX(-50%);
|
|
10
|
-
// top: calc(16px * var(--ipc-player-size-scale, 1));
|
|
11
7
|
}
|
|
12
8
|
.ipc-player-plugin-screenshot-toast {
|
|
9
|
+
flex: 1;
|
|
13
10
|
border-radius: calc(8px * var(--ipc-player-size-scale, 1));;
|
|
14
11
|
background-color: var(--shot-card-bg-color);
|
|
15
12
|
display: flex;
|
|
@@ -9,5 +9,5 @@ type Props = ComponentConfigProps & {
|
|
|
9
9
|
onTouchStart?: TouchEventHandler['onTouchStart'];
|
|
10
10
|
onTouchEnd?: TouchEventHandler['onTouchEnd'];
|
|
11
11
|
};
|
|
12
|
-
export declare
|
|
12
|
+
export declare const VoiceIntercom: (props: Props) => React.JSX.Element;
|
|
13
13
|
export {};
|
|
@@ -7,34 +7,39 @@ import { useStore, getDefaultStore } from '../../ctx/store';
|
|
|
7
7
|
import './voiceIntercom.less';
|
|
8
8
|
import { PlayerStreamStatus, IntercomMode } from '../../interface';
|
|
9
9
|
import { UIEventContext } from '../../ui/context';
|
|
10
|
+
import { radialGradient } from '../../utils';
|
|
10
11
|
import { startTimeToHideAllComponent, pauseTimeToHideAllComponent } from '../../ui/constant';
|
|
11
12
|
const NILL = () => null;
|
|
12
|
-
export
|
|
13
|
-
|
|
13
|
+
export const VoiceIntercom = props => {
|
|
14
|
+
const {
|
|
14
15
|
style,
|
|
15
16
|
className,
|
|
16
17
|
iconClassName,
|
|
17
|
-
recording: recordingAtom,
|
|
18
|
-
intercom: intercomAtom,
|
|
19
|
-
intercomMode: intercomModeAtom,
|
|
18
|
+
// recording: recordingAtom,
|
|
19
|
+
// intercom: intercomAtom,
|
|
20
|
+
// intercomMode: intercomModeAtom,
|
|
20
21
|
setIntercom,
|
|
21
|
-
mute: muteAtom,
|
|
22
|
+
// mute: muteAtom,
|
|
22
23
|
setMute,
|
|
23
24
|
getStreamStatus,
|
|
24
25
|
onTouchStart = NILL,
|
|
25
26
|
onTouchEnd = NILL
|
|
26
|
-
} =
|
|
27
|
+
} = props;
|
|
27
28
|
const {
|
|
28
29
|
event
|
|
29
30
|
} = useContext(UIEventContext);
|
|
30
31
|
const {
|
|
32
|
+
recording,
|
|
31
33
|
mute,
|
|
32
34
|
intercom,
|
|
33
|
-
intercomMode
|
|
35
|
+
intercomMode,
|
|
36
|
+
brandColor
|
|
34
37
|
} = useStore({
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
recording: props.recording,
|
|
39
|
+
mute: props.mute,
|
|
40
|
+
intercom: props.intercom,
|
|
41
|
+
intercomMode: props.intercomMode,
|
|
42
|
+
brandColor: props.brandColor
|
|
38
43
|
});
|
|
39
44
|
// 对讲开始之前的静音状态
|
|
40
45
|
const originMuteStatusBeforeVoice = useRef(mute);
|
|
@@ -70,17 +75,19 @@ export function VoiceIntercom(_ref) {
|
|
|
70
75
|
event.emit(startTimeToHideAllComponent);
|
|
71
76
|
};
|
|
72
77
|
return /*#__PURE__*/React.createElement(View, {
|
|
73
|
-
style: _objectSpread({}, style),
|
|
78
|
+
style: _objectSpread(_objectSpread({}, style), {
|
|
79
|
+
background: radialGradient(brandColor)
|
|
80
|
+
}),
|
|
74
81
|
className: clsx('ipc-player-plugin-voice-intercom', className),
|
|
75
82
|
onTouchStart: async e => {
|
|
76
83
|
onTouchStart(e);
|
|
77
|
-
|
|
84
|
+
getDefaultStore();
|
|
78
85
|
if (loading.current) return;
|
|
79
86
|
loading.current = true;
|
|
80
|
-
const _intercom = store.get(intercomAtom);
|
|
81
|
-
const _recording = store.get(recordingAtom);
|
|
82
|
-
const target = !
|
|
83
|
-
if (target &&
|
|
87
|
+
// const _intercom = store.get(intercomAtom);
|
|
88
|
+
// const _recording = store.get(recordingAtom);
|
|
89
|
+
const target = !intercom;
|
|
90
|
+
if (target && recording) {
|
|
84
91
|
console.log('录制中,无法对讲');
|
|
85
92
|
loading.current = false;
|
|
86
93
|
return;
|
|
@@ -104,4 +111,4 @@ export function VoiceIntercom(_ref) {
|
|
|
104
111
|
}) : /*#__PURE__*/React.createElement(View, {
|
|
105
112
|
className: clsx('icon-panel', 'icon-panel-one-way-intercom', 'intercom-default-icon', iconClassName)
|
|
106
113
|
}));
|
|
107
|
-
}
|
|
114
|
+
};
|
|
@@ -18,16 +18,16 @@ const BottomLeftContent = _ref => {
|
|
|
18
18
|
});
|
|
19
19
|
const [shouldHide] = useComponentHideState(screenType);
|
|
20
20
|
return /*#__PURE__*/React.createElement(CoverView, {
|
|
21
|
-
className: clsx('ipc-player-bottom-left-content-wrap'
|
|
22
|
-
'ipc-player-bottom-left-content-hide': shouldHide || fullResolutionActive,
|
|
23
|
-
'ipc-player-bottom-left-content-show': !shouldHide && !fullResolutionActive
|
|
24
|
-
})
|
|
21
|
+
className: clsx('ipc-player-bottom-left-content-wrap')
|
|
25
22
|
}, /*#__PURE__*/React.createElement(View, {
|
|
26
23
|
style: {
|
|
27
24
|
paddingBottom: screenType === 'vertical' ? '14px' : '20px',
|
|
28
25
|
paddingLeft: screenType === 'vertical' ? 0 : '25px'
|
|
29
26
|
},
|
|
30
|
-
className: clsx('ipc-player-bottom-left-content-container'
|
|
27
|
+
className: clsx('ipc-player-bottom-left-content-container', {
|
|
28
|
+
'ipc-player-bottom-left-content-hide': shouldHide || fullResolutionActive,
|
|
29
|
+
'ipc-player-bottom-left-content-show': !shouldHide && !fullResolutionActive
|
|
30
|
+
})
|
|
31
31
|
}, children));
|
|
32
32
|
};
|
|
33
33
|
export default BottomLeftContent;
|
|
@@ -18,16 +18,16 @@ const BottomRightContent = _ref => {
|
|
|
18
18
|
});
|
|
19
19
|
const [shouldHide] = useComponentHideState(screenType);
|
|
20
20
|
return /*#__PURE__*/React.createElement(CoverView, {
|
|
21
|
-
className: clsx('ipc-player-bottom-right-content-wrap'
|
|
22
|
-
'ipc-player-bottom-right-content-hide': shouldHide || fullResolutionActive,
|
|
23
|
-
'ipc-player-bottom-right-content-show': !shouldHide && !fullResolutionActive
|
|
24
|
-
})
|
|
21
|
+
className: clsx('ipc-player-bottom-right-content-wrap')
|
|
25
22
|
}, /*#__PURE__*/React.createElement(View, {
|
|
26
23
|
style: {
|
|
27
24
|
paddingBottom: screenType === 'vertical' ? '14px' : '20px',
|
|
28
25
|
paddingRight: screenType === 'vertical' ? 0 : '25px'
|
|
29
26
|
},
|
|
30
|
-
className: clsx('ipc-player-bottom-right-content-container'
|
|
27
|
+
className: clsx('ipc-player-bottom-right-content-container', {
|
|
28
|
+
'ipc-player-bottom-right-content-hide': shouldHide || fullResolutionActive,
|
|
29
|
+
'ipc-player-bottom-right-content-show': !shouldHide && !fullResolutionActive
|
|
30
|
+
})
|
|
31
31
|
}, children));
|
|
32
32
|
};
|
|
33
33
|
export default BottomRightContent;
|
package/lib/ui/topLeftContent.js
CHANGED
|
@@ -18,20 +18,16 @@ const TopLeftContent = _ref => {
|
|
|
18
18
|
});
|
|
19
19
|
const [shouldHide] = useComponentHideState(screenType);
|
|
20
20
|
return /*#__PURE__*/React.createElement(CoverView, {
|
|
21
|
-
className: clsx('ipc-player-top-left-content-wrap'
|
|
22
|
-
'ipc-player-top-left-content-hide': shouldHide || fullResolutionActive,
|
|
23
|
-
'ipc-player-top-left-content-show': !shouldHide && !fullResolutionActive
|
|
24
|
-
})
|
|
21
|
+
className: clsx('ipc-player-top-left-content-wrap')
|
|
25
22
|
}, /*#__PURE__*/React.createElement(View, {
|
|
26
23
|
style: {
|
|
27
24
|
paddingTop: screenType === 'vertical' ? '12px' : '16px',
|
|
28
25
|
paddingLeft: screenType === 'vertical' ? 0 : '25px'
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
className: clsx('ipc-player-top-left-content-container')
|
|
26
|
+
},
|
|
27
|
+
className: clsx('ipc-player-top-left-content-container', {
|
|
28
|
+
'ipc-player-top-left-content-hide': shouldHide || fullResolutionActive,
|
|
29
|
+
'ipc-player-top-left-content-show': !shouldHide && !fullResolutionActive
|
|
30
|
+
})
|
|
35
31
|
}, children));
|
|
36
32
|
};
|
|
37
33
|
export default TopLeftContent;
|
|
@@ -18,16 +18,16 @@ const TopRightContent = _ref => {
|
|
|
18
18
|
});
|
|
19
19
|
const [shouldHide] = useComponentHideState(screenType);
|
|
20
20
|
return /*#__PURE__*/React.createElement(CoverView, {
|
|
21
|
-
className: clsx('ipc-player-top-right-content-wrap'
|
|
22
|
-
'ipc-player-top-right-content-hide': shouldHide || fullResolutionActive,
|
|
23
|
-
'ipc-player-top-right-content-show': !shouldHide && !fullResolutionActive
|
|
24
|
-
})
|
|
21
|
+
className: clsx('ipc-player-top-right-content-wrap')
|
|
25
22
|
}, /*#__PURE__*/React.createElement(View, {
|
|
26
23
|
style: {
|
|
27
24
|
paddingTop: screenType === 'vertical' ? '12px' : '16px',
|
|
28
25
|
paddingRight: screenType === 'vertical' ? 0 : '25px'
|
|
29
26
|
},
|
|
30
|
-
className: clsx('ipc-player-top-right-content-container'
|
|
27
|
+
className: clsx('ipc-player-top-right-content-container', {
|
|
28
|
+
'ipc-player-top-right-content-hide': shouldHide || fullResolutionActive,
|
|
29
|
+
'ipc-player-top-right-content-show': !shouldHide && !fullResolutionActive
|
|
30
|
+
})
|
|
31
31
|
}, children));
|
|
32
32
|
};
|
|
33
33
|
export default TopRightContent;
|
package/lib/ui/ui.d.ts
CHANGED
package/lib/ui/ui.js
CHANGED
|
@@ -44,13 +44,15 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
44
44
|
style,
|
|
45
45
|
CSSVariable = defaultCSSVariable,
|
|
46
46
|
privateState = false,
|
|
47
|
-
deviceOnline = true
|
|
47
|
+
deviceOnline = true,
|
|
48
|
+
brandColor = '#FF592A'
|
|
48
49
|
} = props;
|
|
49
50
|
const instance = getCtxInstance(props.instance, devId);
|
|
50
51
|
const {
|
|
51
52
|
setPlayState,
|
|
52
53
|
setScreenType,
|
|
53
|
-
setFullResolutionActive
|
|
54
|
+
setFullResolutionActive,
|
|
55
|
+
setBrandColor
|
|
54
56
|
} = instance;
|
|
55
57
|
const prevTriggerEvent = useRef();
|
|
56
58
|
const eventRef = useRef();
|
|
@@ -58,6 +60,9 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
58
60
|
if (!eventRef.current) {
|
|
59
61
|
eventRef.current = getEventInstance();
|
|
60
62
|
}
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
setBrandColor(brandColor);
|
|
65
|
+
}, []);
|
|
61
66
|
const {
|
|
62
67
|
event
|
|
63
68
|
} = useContext(UIEventContext);
|
|
@@ -267,30 +272,30 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
267
272
|
,
|
|
268
273
|
onZoomChange: data => {
|
|
269
274
|
console.log(`zoomChange事件: ${JSON.stringify(data)}`);
|
|
270
|
-
ty.showToast({
|
|
271
|
-
|
|
272
|
-
});
|
|
273
|
-
setTimeout(() => {
|
|
274
|
-
|
|
275
|
-
}, 3000);
|
|
275
|
+
// ty.showToast({
|
|
276
|
+
// title: `zoomChange事件: ${JSON.stringify(data)}`,
|
|
277
|
+
// });
|
|
278
|
+
// setTimeout(() => {
|
|
279
|
+
// ty.hideToast();
|
|
280
|
+
// }, 3000);
|
|
276
281
|
},
|
|
277
282
|
onCameraPreviewFailure: data => {
|
|
278
283
|
console.log(`onCameraPreviewFailure事件: ${JSON.stringify(data)}`);
|
|
279
|
-
ty.showToast({
|
|
280
|
-
|
|
281
|
-
});
|
|
282
|
-
setTimeout(() => {
|
|
283
|
-
|
|
284
|
-
}, 3000);
|
|
284
|
+
// ty.showToast({
|
|
285
|
+
// title: `onCameraPreviewFailure事件: ${JSON.stringify(data)}`,
|
|
286
|
+
// });
|
|
287
|
+
// setTimeout(() => {
|
|
288
|
+
// ty.hideToast();
|
|
289
|
+
// }, 3000);
|
|
285
290
|
},
|
|
286
291
|
onCameraNotifyWeakNetwork: data => {
|
|
287
292
|
console.log(`onCameraNotifyWeakNetwork: ${JSON.stringify(data)}`);
|
|
288
|
-
ty.showToast({
|
|
289
|
-
|
|
290
|
-
});
|
|
291
|
-
setTimeout(() => {
|
|
292
|
-
|
|
293
|
-
}, 3000);
|
|
293
|
+
// ty.showToast({
|
|
294
|
+
// title: `onCameraNotifyWeakNetwork: ${JSON.stringify(data)}`,
|
|
295
|
+
// });
|
|
296
|
+
// setTimeout(() => {
|
|
297
|
+
// ty.hideToast();
|
|
298
|
+
// }, 3000);
|
|
294
299
|
},
|
|
295
300
|
clarity: resolution === 'HD' ? 'hd' : 'normal',
|
|
296
301
|
privateState: privateState,
|
|
@@ -305,7 +310,6 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
305
310
|
ctx: instance
|
|
306
311
|
}, renderBottomRightContent), playerReady && (() => {
|
|
307
312
|
if (!absoluteContent || !(absoluteContent !== null && absoluteContent !== void 0 && absoluteContent.length)) return null;
|
|
308
|
-
console.log(absoluteContent, 'absoluteContent');
|
|
309
313
|
return absoluteContent.map(item => {
|
|
310
314
|
return /*#__PURE__*/React.createElement(CoverView, {
|
|
311
315
|
key: item.id,
|
|
@@ -11,3 +11,9 @@ export interface IDpCode {
|
|
|
11
11
|
}
|
|
12
12
|
export declare function getDpIdsByCodes<T extends string>(devId: string, dpIds: T[]): Promise<Record<T, string>>;
|
|
13
13
|
export declare const showMathPowValue: (value: any, scale: any) => string | 0;
|
|
14
|
+
export declare const getDevInfo: <T>(deviceId: string) => Promise<any>;
|
|
15
|
+
/**
|
|
16
|
+
* 根据DpCode获取枚举型DP的range是否包含对应项
|
|
17
|
+
* @param result: {code: number, msg: string}
|
|
18
|
+
*/
|
|
19
|
+
export declare const getEnumRangeIsValid: (devId: any, dpCode: any, rangValue: any) => Promise<any>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import IpcUtils from '@ray-js/ray-ipc-utils';
|
|
1
2
|
export function getDpValue(options) {
|
|
2
3
|
return new Promise((resolve, reject) => {
|
|
3
4
|
ty.device.getDeviceInfo({
|
|
@@ -52,4 +53,55 @@ export const showMathPowValue = (value, scale) => {
|
|
|
52
53
|
v = (Number(value) / Math.pow(10, scale)).toFixed(1);
|
|
53
54
|
}
|
|
54
55
|
return v;
|
|
56
|
+
};
|
|
57
|
+
export const getDevInfo = deviceId => {
|
|
58
|
+
return new Promise(resolve => {
|
|
59
|
+
try {
|
|
60
|
+
ty.device.getDeviceInfo({
|
|
61
|
+
deviceId,
|
|
62
|
+
success: res => {
|
|
63
|
+
resolve({
|
|
64
|
+
code: 0,
|
|
65
|
+
data: res
|
|
66
|
+
});
|
|
67
|
+
},
|
|
68
|
+
fail: err => {
|
|
69
|
+
resolve({
|
|
70
|
+
code: -1,
|
|
71
|
+
msg: err
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
} catch (err) {
|
|
76
|
+
resolve({
|
|
77
|
+
code: -1,
|
|
78
|
+
msg: String(err)
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* 根据DpCode获取枚举型DP的range是否包含对应项
|
|
86
|
+
* @param result: {code: number, msg: string}
|
|
87
|
+
*/
|
|
88
|
+
|
|
89
|
+
export const getEnumRangeIsValid = async (devId, dpCode, rangValue) => {
|
|
90
|
+
const infoData = await IpcUtils.getDevInfo(devId);
|
|
91
|
+
if (infoData.code === 0) {
|
|
92
|
+
var _targetSchema$propert;
|
|
93
|
+
const {
|
|
94
|
+
schema
|
|
95
|
+
} = infoData.data;
|
|
96
|
+
const arrayFromValues = Object.values(schema);
|
|
97
|
+
const targetSchema = arrayFromValues.find(item => item.code === dpCode);
|
|
98
|
+
if ((targetSchema === null || targetSchema === void 0 || (_targetSchema$propert = targetSchema.property) === null || _targetSchema$propert === void 0 ? void 0 : _targetSchema$propert.type) === 'enum') {
|
|
99
|
+
const {
|
|
100
|
+
range
|
|
101
|
+
} = targetSchema.property;
|
|
102
|
+
return range.includes(rangValue);
|
|
103
|
+
}
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
return false;
|
|
55
107
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** 美克风对讲按钮径向渐变 */
|
|
2
|
+
export const radialGradient = color => {
|
|
3
|
+
return `radial-gradient(at center, ${adjustBrightness(color, 0.88)}, ${adjustBrightness(color, 1.2)})`;
|
|
4
|
+
};
|
|
5
|
+
export const adjustBrightness = (hex, factor) => {
|
|
6
|
+
const color = parseInt(hex.slice(1), 16); // 去掉 # 转为数字
|
|
7
|
+
let r = color >> 16 & 0xff;
|
|
8
|
+
let g = color >> 8 & 0xff;
|
|
9
|
+
let b = color >> 0 & 0xff;
|
|
10
|
+
r = Math.min(255, Math.max(30, Math.floor(r * factor)));
|
|
11
|
+
g = Math.min(255, Math.max(30, Math.floor(g * factor)));
|
|
12
|
+
b = Math.min(255, Math.max(30, Math.floor(b * factor)));
|
|
13
|
+
const hexString = 1 << 24 | r << 16 | g << 8 | b;
|
|
14
|
+
return `#${hexString.toString(16).slice(1)}`;
|
|
15
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ray-js/ipc-player-integration",
|
|
3
|
-
"version": "0.0.1-beta-
|
|
3
|
+
"version": "0.0.1-beta-24",
|
|
4
4
|
"description": "IPC 播放器功能集成",
|
|
5
5
|
"main": "lib/index",
|
|
6
6
|
"files": [
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@ray-js/ray-ipc-player": "2.0.
|
|
36
|
+
"@ray-js/ray-ipc-player": "2.0.20-beta-1",
|
|
37
37
|
"@ray-js/ray-ipc-utils": "1.1.0-beta-12",
|
|
38
|
-
"@ray-js/ipc-ptz-zoom": "0.0.2-beta-
|
|
38
|
+
"@ray-js/ipc-ptz-zoom": "0.0.2-beta-3",
|
|
39
39
|
"clsx": "^1.2.1",
|
|
40
40
|
"jotai": "^2.10.2",
|
|
41
41
|
"@ray-js/panel-sdk": "^1.13.1"
|