@ray-js/ipc-player-integration 0.0.1-beta-26 → 0.0.1-beta-27
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.js +6 -3
- package/lib/ctx/ctx.js +5 -0
- package/lib/interface.d.ts +2 -0
- package/lib/plugins/battery/battery.composition.d.ts +4 -0
- package/lib/plugins/fullScreen/fullScreen.js +5 -8
- package/lib/plugins/fullScreen/{voiceIntercom.d.ts → fullVoiceIntercom.d.ts} +1 -1
- package/lib/plugins/fullScreen/{voiceIntercom.js → fullVoiceIntercom.js} +8 -5
- package/lib/plugins/{smallIntercom/smallIntercom.d.ts → fullSmallIntercom/fullSmallIntercom.d.ts} +2 -2
- package/lib/plugins/fullSmallIntercom/fullSmallIntercom.js +46 -0
- package/lib/plugins/fullSmallIntercom/fullSmallIntercom.less +0 -0
- package/lib/plugins/fullSmallIntercom/index.d.ts +1 -0
- package/lib/plugins/fullSmallIntercom/index.js +1 -0
- package/lib/plugins/index.d.ts +2 -1
- package/lib/plugins/index.js +2 -1
- package/lib/plugins/ptz/ptz.js +1 -1
- package/lib/plugins/ptz/ptz.less +1 -1
- package/lib/plugins/ptz/ptzControl.js +1 -2
- package/lib/plugins/recordVideo/recordVideo.js +2 -0
- package/lib/plugins/resolution/resolution.js +1 -0
- package/lib/plugins/screenshot/screenshot.js +7 -1
- package/lib/plugins/tempHumidity/tempHumidity.less +2 -3
- package/lib/plugins/verticalSmallIntercom/index.d.ts +1 -0
- package/lib/plugins/verticalSmallIntercom/index.js +1 -0
- package/lib/plugins/verticalSmallIntercom/verticalSmallIntercom.d.ts +6 -0
- package/lib/plugins/verticalSmallIntercom/verticalSmallIntercom.js +48 -0
- package/lib/plugins/verticalSmallIntercom/verticalSmallIntercom.less +4 -0
- package/lib/plugins/voiceIntercom/voiceIntercom.d.ts +4 -1
- package/lib/plugins/voiceIntercom/voiceIntercom.js +54 -12
- package/lib/plugins/voiceIntercom/voiceIntercom.less +30 -2
- package/lib/ui/ui.d.ts +1 -0
- package/lib/ui/ui.js +5 -2
- package/lib/utils/index.d.ts +3 -1
- package/lib/utils/index.js +3 -1
- package/package.json +5 -4
- package/lib/plugins/smallIntercom/index.d.ts +0 -1
- package/lib/plugins/smallIntercom/index.js +0 -1
- package/lib/plugins/smallIntercom/smallIntercom.js +0 -49
- package/lib/plugins/smallIntercom/smallIntercom.less +0 -50
- package/lib/plugins/voiceIntercom/type.d.ts +0 -4
- package/lib/plugins/voiceIntercom/voice.gif +0 -0
|
@@ -4,7 +4,7 @@ const _excluded = ["title", "duration"];
|
|
|
4
4
|
import IPCUtils from '@ray-js/ray-ipc-utils';
|
|
5
5
|
import { IntercomMode, MuteMode, ClarityType } from '@ray-js/ray-ipc-utils/lib/interface';
|
|
6
6
|
import { createUseCtx } from './ctx';
|
|
7
|
-
import {
|
|
7
|
+
import { FullSmallIntercom, VerticalSmallIntercom, BatteryFull, Battery, Screenshot, TempHumidity, RecordVideo, FullScreen, VideoBitKBP, Muted, Resolution, Ptz } from '../plugins';
|
|
8
8
|
import { authorizeStatus } from '../utils/authorize';
|
|
9
9
|
const createPlayContext = ty.createIpcPlayerContext;
|
|
10
10
|
// const createPlayContext = () => null;
|
|
@@ -24,8 +24,8 @@ const topRightContent = [{
|
|
|
24
24
|
content: VideoBitKBP
|
|
25
25
|
}];
|
|
26
26
|
const bottomLeftContent = [{
|
|
27
|
-
id: '
|
|
28
|
-
content:
|
|
27
|
+
id: 'FullSmallIntercom',
|
|
28
|
+
content: FullSmallIntercom
|
|
29
29
|
}, {
|
|
30
30
|
id: 'Screenshot',
|
|
31
31
|
content: Screenshot
|
|
@@ -35,6 +35,9 @@ const bottomLeftContent = [{
|
|
|
35
35
|
}, {
|
|
36
36
|
id: 'Muted',
|
|
37
37
|
content: Muted
|
|
38
|
+
}, {
|
|
39
|
+
id: 'VerticalSmallIntercom',
|
|
40
|
+
content: VerticalSmallIntercom
|
|
38
41
|
}, {
|
|
39
42
|
id: 'Ptz',
|
|
40
43
|
content: Ptz
|
package/lib/ctx/ctx.js
CHANGED
|
@@ -43,6 +43,9 @@ export const createUseCtx = _ref => {
|
|
|
43
43
|
// 品牌色 默认
|
|
44
44
|
const [brandColor, setBrandColor] = useAtom('#FF592A');
|
|
45
45
|
|
|
46
|
+
// 竖屏下是否展示对讲, 默认展示
|
|
47
|
+
const [verticalMic, setVerticalMic] = useAtom(true);
|
|
48
|
+
|
|
46
49
|
// ptz 是否点击
|
|
47
50
|
const [ptzActive, setPtzActive] = useAtom(false);
|
|
48
51
|
|
|
@@ -142,6 +145,7 @@ export const createUseCtx = _ref => {
|
|
|
142
145
|
return {
|
|
143
146
|
devId,
|
|
144
147
|
brandColor,
|
|
148
|
+
verticalMic,
|
|
145
149
|
saveToAlbum,
|
|
146
150
|
screenType,
|
|
147
151
|
recording,
|
|
@@ -156,6 +160,7 @@ export const createUseCtx = _ref => {
|
|
|
156
160
|
playState,
|
|
157
161
|
setPlayState,
|
|
158
162
|
setBrandColor,
|
|
163
|
+
setVerticalMic,
|
|
159
164
|
setIntercom: async target => {
|
|
160
165
|
const store = getDefaultStore();
|
|
161
166
|
const _intercom = store.get(intercom);
|
package/lib/interface.d.ts
CHANGED
|
@@ -36,6 +36,7 @@ export type UseCtx = (options: {
|
|
|
36
36
|
className: string;
|
|
37
37
|
devId: string;
|
|
38
38
|
brandColor: RetAtom<string>;
|
|
39
|
+
verticalMic: RetAtom<boolean>;
|
|
39
40
|
saveToAlbum: 0 | 1;
|
|
40
41
|
screenType: RetAtom<ScreenType>;
|
|
41
42
|
recording: RetAtom<boolean>;
|
|
@@ -55,6 +56,7 @@ export type UseCtx = (options: {
|
|
|
55
56
|
bottomRightContent: RetAtom<ComponentConfig[]>;
|
|
56
57
|
absoluteContent: RetAtom<ComponentConfig[]>;
|
|
57
58
|
setBrandColor: (color: string) => void;
|
|
59
|
+
setVerticalMic: (color: string) => void;
|
|
58
60
|
setScreenType: (type: ScreenType) => void;
|
|
59
61
|
setRecordingDisabled: (type: boolean) => void;
|
|
60
62
|
setPtzActive: (type: boolean) => void;
|
|
@@ -5,6 +5,7 @@ export declare const Battery: import("react").FunctionComponent<{
|
|
|
5
5
|
className: string;
|
|
6
6
|
devId: string;
|
|
7
7
|
brandColor: import("../..").RetAtom<string>;
|
|
8
|
+
verticalMic: import("../..").RetAtom<boolean>;
|
|
8
9
|
saveToAlbum: 0 | 1;
|
|
9
10
|
screenType: import("../..").RetAtom<import("../..").ScreenType>;
|
|
10
11
|
recording: import("../..").RetAtom<boolean>;
|
|
@@ -24,6 +25,7 @@ export declare const Battery: import("react").FunctionComponent<{
|
|
|
24
25
|
bottomRightContent: import("../..").RetAtom<import("../..").ComponentConfig<any & Record<string, any>>[]>;
|
|
25
26
|
absoluteContent: import("../..").RetAtom<import("../..").ComponentConfig<any & Record<string, any>>[]>;
|
|
26
27
|
setBrandColor: (color: string) => void;
|
|
28
|
+
setVerticalMic: (color: string) => void;
|
|
27
29
|
setScreenType: (type: import("../..").ScreenType) => void;
|
|
28
30
|
setRecordingDisabled: (type: boolean) => void;
|
|
29
31
|
setPtzActive: (type: boolean) => void;
|
|
@@ -48,6 +50,7 @@ export declare const BatteryFull: import("react").FunctionComponent<{
|
|
|
48
50
|
className: string;
|
|
49
51
|
devId: string;
|
|
50
52
|
brandColor: import("../..").RetAtom<string>;
|
|
53
|
+
verticalMic: import("../..").RetAtom<boolean>;
|
|
51
54
|
saveToAlbum: 0 | 1;
|
|
52
55
|
screenType: import("../..").RetAtom<import("../..").ScreenType>;
|
|
53
56
|
recording: import("../..").RetAtom<boolean>;
|
|
@@ -67,6 +70,7 @@ export declare const BatteryFull: import("react").FunctionComponent<{
|
|
|
67
70
|
bottomRightContent: import("../..").RetAtom<import("../..").ComponentConfig<any & Record<string, any>>[]>;
|
|
68
71
|
absoluteContent: import("../..").RetAtom<import("../..").ComponentConfig<any & Record<string, any>>[]>;
|
|
69
72
|
setBrandColor: (color: string) => void;
|
|
73
|
+
setVerticalMic: (color: string) => void;
|
|
70
74
|
setScreenType: (type: import("../..").ScreenType) => void;
|
|
71
75
|
setRecordingDisabled: (type: boolean) => void;
|
|
72
76
|
setPtzActive: (type: boolean) => void;
|
|
@@ -4,10 +4,10 @@ import { View, setPageOrientation, Text } from '@ray-js/ray';
|
|
|
4
4
|
import { useUpdateEffect } from 'ahooks';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import { UIEventContext } from '../../ui/context';
|
|
7
|
-
import {
|
|
7
|
+
import { showAllComponent, voiceIntercomId, verticalScreenId, ptzControlId, fullResolutionId, pauseTimeToHideAllComponent } from '../../ui/constant';
|
|
8
8
|
import { useStore } from '../../ctx/store';
|
|
9
9
|
import { VerticalScreen } from './verticalScreen';
|
|
10
|
-
import {
|
|
10
|
+
import { FullVoiceIntercom } from './fullVoiceIntercom';
|
|
11
11
|
import './fullScreen.less';
|
|
12
12
|
export function FullScreen(props) {
|
|
13
13
|
const {
|
|
@@ -58,7 +58,7 @@ export function FullScreen(props) {
|
|
|
58
58
|
addContent('absolute', {
|
|
59
59
|
id: voiceIntercomId,
|
|
60
60
|
content: props => {
|
|
61
|
-
return /*#__PURE__*/React.createElement(
|
|
61
|
+
return /*#__PURE__*/React.createElement(FullVoiceIntercom, props);
|
|
62
62
|
},
|
|
63
63
|
absoluteContentClassName: 'ipc-player-plugin-full-screen-voice-wrap',
|
|
64
64
|
initProps: _objectSpread({}, props)
|
|
@@ -71,9 +71,9 @@ export function FullScreen(props) {
|
|
|
71
71
|
const handlers = {
|
|
72
72
|
full: () => {
|
|
73
73
|
handleFull();
|
|
74
|
-
event.emit(startTimeToHideAllComponent);
|
|
75
74
|
},
|
|
76
75
|
vertical: () => {
|
|
76
|
+
event.emit(pauseTimeToHideAllComponent);
|
|
77
77
|
ty.setNavigationBarBack({
|
|
78
78
|
type: 'system'
|
|
79
79
|
});
|
|
@@ -95,14 +95,11 @@ export function FullScreen(props) {
|
|
|
95
95
|
}, [screenType]);
|
|
96
96
|
const handClick = target => {
|
|
97
97
|
const pageOrientation = target === 'vertical' ? 'portrait' : 'landscape';
|
|
98
|
+
event.emit(pauseTimeToHideAllComponent);
|
|
98
99
|
setPageOrientation({
|
|
99
100
|
pageOrientation,
|
|
100
101
|
success: () => {
|
|
101
102
|
setScreenType(target);
|
|
102
|
-
if (target === 'full') {
|
|
103
|
-
// handFull();
|
|
104
|
-
// event.emit(startTimeToHideAllComponent);
|
|
105
|
-
}
|
|
106
103
|
}
|
|
107
104
|
});
|
|
108
105
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ComponentConfigProps } from '../../interface';
|
|
3
3
|
type Props = ComponentConfigProps;
|
|
4
|
-
export declare function
|
|
4
|
+
export declare function FullVoiceIntercom(props: Props): React.JSX.Element;
|
|
5
5
|
export {};
|
|
@@ -2,12 +2,12 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import React, { useContext } from 'react';
|
|
3
3
|
import { View } from '@ray-js/ray';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
|
-
import { VoiceIntercom
|
|
5
|
+
import { VoiceIntercom } from '../voiceIntercom';
|
|
6
6
|
import { useComponentHideState } from '../../ui/hooks';
|
|
7
7
|
import { UIEventContext } from '../../ui/context';
|
|
8
|
-
import {
|
|
8
|
+
import { pauseTimeToHideAllComponent } from '../../ui/constant';
|
|
9
9
|
import { useStore } from '../../ctx/store';
|
|
10
|
-
export function
|
|
10
|
+
export function FullVoiceIntercom(props) {
|
|
11
11
|
const {
|
|
12
12
|
screenType,
|
|
13
13
|
isPtzActive,
|
|
@@ -25,12 +25,15 @@ export function VoiceIntercom(props) {
|
|
|
25
25
|
className: clsx('ipc-player-plugin-full-screen-voice', {
|
|
26
26
|
'ipc-player-plugin-full-screen-voice-hide': shouldHide || isPtzActive || fullResolutionActive
|
|
27
27
|
})
|
|
28
|
-
}, /*#__PURE__*/React.createElement(
|
|
28
|
+
}, /*#__PURE__*/React.createElement(VoiceIntercom, _extends({}, props, {
|
|
29
|
+
talkingColor: "#FFFFFF",
|
|
30
|
+
scale: 0.14,
|
|
31
|
+
mode: "circle",
|
|
29
32
|
onTouchStart: () => {
|
|
30
33
|
event.emit(pauseTimeToHideAllComponent);
|
|
31
34
|
},
|
|
32
35
|
onTouchEnd: () => {
|
|
33
|
-
event.emit(startTimeToHideAllComponent);
|
|
36
|
+
// event.emit(startTimeToHideAllComponent);
|
|
34
37
|
}
|
|
35
38
|
})));
|
|
36
39
|
}
|
package/lib/plugins/{smallIntercom/smallIntercom.d.ts → fullSmallIntercom/fullSmallIntercom.d.ts}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ComponentConfigProps } from '../../interface';
|
|
3
|
-
import './
|
|
3
|
+
import './fullSmallIntercom.less';
|
|
4
4
|
type Props = ComponentConfigProps;
|
|
5
|
-
export declare function
|
|
5
|
+
export declare function FullSmallIntercom(props: Props): React.JSX.Element | null;
|
|
6
6
|
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import React, { useContext } from 'react';
|
|
3
|
+
import { View } from '@ray-js/ray';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import { useStore } from '../../ctx/store';
|
|
6
|
+
import { pauseTimeToHideAllComponent } from '../../ui/constant';
|
|
7
|
+
import { UIEventContext } from '../../ui/context';
|
|
8
|
+
import { VoiceIntercom } from '../voiceIntercom';
|
|
9
|
+
import './fullSmallIntercom.less';
|
|
10
|
+
export function FullSmallIntercom(props) {
|
|
11
|
+
const {
|
|
12
|
+
className
|
|
13
|
+
} = props;
|
|
14
|
+
const {
|
|
15
|
+
screenType,
|
|
16
|
+
ptzActive,
|
|
17
|
+
brandColor
|
|
18
|
+
} = useStore({
|
|
19
|
+
screenType: props.screenType,
|
|
20
|
+
ptzActive: props.ptzActive,
|
|
21
|
+
brandColor: props.brandColor
|
|
22
|
+
});
|
|
23
|
+
const {
|
|
24
|
+
event
|
|
25
|
+
} = useContext(UIEventContext);
|
|
26
|
+
if (screenType === 'vertical' && !ptzActive) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
const onTouchStart = () => {
|
|
30
|
+
event.emit(pauseTimeToHideAllComponent);
|
|
31
|
+
};
|
|
32
|
+
const onTouchEnd = () => {
|
|
33
|
+
// event.emit(startTimeToHideAllComponent);
|
|
34
|
+
};
|
|
35
|
+
if (screenType === 'full' && ptzActive) {
|
|
36
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
37
|
+
className: clsx(className)
|
|
38
|
+
}, /*#__PURE__*/React.createElement(VoiceIntercom, _extends({}, props, {
|
|
39
|
+
talkingColor: brandColor,
|
|
40
|
+
mode: "fullSmall",
|
|
41
|
+
onTouchStart: onTouchStart,
|
|
42
|
+
onTouchEnd: onTouchEnd
|
|
43
|
+
})));
|
|
44
|
+
}
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './fullSmallIntercom';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './fullSmallIntercom';
|
package/lib/plugins/index.d.ts
CHANGED
package/lib/plugins/index.js
CHANGED
package/lib/plugins/ptz/ptz.js
CHANGED
|
@@ -37,7 +37,7 @@ export const Ptz = props => {
|
|
|
37
37
|
content: props => {
|
|
38
38
|
return /*#__PURE__*/React.createElement(PtzControl, props);
|
|
39
39
|
},
|
|
40
|
-
absoluteContentClassName: 'ipc-player-plugin-full-screen-ptz-control-
|
|
40
|
+
absoluteContentClassName: 'ipc-player-plugin-full-screen-ptz-control-wrap',
|
|
41
41
|
initProps: _objectSpread({}, props)
|
|
42
42
|
});
|
|
43
43
|
} else {
|
package/lib/plugins/ptz/ptz.less
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
// font-size: calc(var(--iconFontSize) * var(--ipc-player-size-scale, 1));
|
|
12
12
|
// }
|
|
13
13
|
|
|
14
|
-
.ipc-player-plugin-full-screen-ptz-control-
|
|
14
|
+
.ipc-player-plugin-full-screen-ptz-control-wrap {
|
|
15
15
|
position: absolute;
|
|
16
16
|
bottom: 10px;
|
|
17
17
|
// transform: translate(0, -20%);
|
|
@@ -9,7 +9,7 @@ import { useComponentHideState } from '../../ui/hooks';
|
|
|
9
9
|
import { UIEventContext } from '../../ui/context';
|
|
10
10
|
import { useStore } from '../../ctx/store';
|
|
11
11
|
import { getEnumRangeIsValid } from '../../utils/device';
|
|
12
|
-
import {
|
|
12
|
+
import { pauseTimeToHideAllComponent } from '../../ui/constant';
|
|
13
13
|
import Styles from './ptz.less';
|
|
14
14
|
const getPtzData = devId => {
|
|
15
15
|
return [{
|
|
@@ -100,7 +100,6 @@ export const PtzControl = props => {
|
|
|
100
100
|
clearInterval(ptzTimeId.current);
|
|
101
101
|
ptzTimeId.current = null;
|
|
102
102
|
}
|
|
103
|
-
event.emit(startTimeToHideAllComponent);
|
|
104
103
|
},
|
|
105
104
|
brandColor: brandColor,
|
|
106
105
|
iconClassName: Styles['arrow-icon-wrapper'],
|
|
@@ -5,6 +5,7 @@ import clsx from 'clsx';
|
|
|
5
5
|
import IpcUtils from '@ray-js/ray-ipc-utils';
|
|
6
6
|
import Strings from '../../i18n';
|
|
7
7
|
import { UIEventContext } from '../../ui/context';
|
|
8
|
+
import { pauseTimeToHideAllComponent } from '../../ui/constant';
|
|
8
9
|
import { useStore, getDefaultStore } from '../../ctx/store';
|
|
9
10
|
import './recordVideo.less';
|
|
10
11
|
const CLOSE_TIME = 5000;
|
|
@@ -202,6 +203,7 @@ export function RecordVideo(props) {
|
|
|
202
203
|
});
|
|
203
204
|
};
|
|
204
205
|
const handRecordVideo = async () => {
|
|
206
|
+
event.emit(pauseTimeToHideAllComponent);
|
|
205
207
|
const store = getDefaultStore();
|
|
206
208
|
const _recording = store.get(recordingAtom);
|
|
207
209
|
const target = !_recording;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import React, { useRef } from 'react';
|
|
1
|
+
import React, { useContext, useRef } from 'react';
|
|
2
2
|
import { View, Image, Text } from '@ray-js/ray';
|
|
3
3
|
import { useSetState, useUpdateEffect } from 'ahooks';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import IpcUtils from '@ray-js/ray-ipc-utils';
|
|
6
6
|
import Strings from '../../i18n';
|
|
7
7
|
import { useStore } from '../../ctx/store';
|
|
8
|
+
import { UIEventContext } from '../../ui/context';
|
|
9
|
+
import { pauseTimeToHideAllComponent } from '../../ui/constant';
|
|
8
10
|
import './screenshot.less';
|
|
9
11
|
const CLOSE_TIME = 5000;
|
|
10
12
|
export function Screenshot(props) {
|
|
@@ -24,6 +26,9 @@ export function Screenshot(props) {
|
|
|
24
26
|
screenType: props.screenType,
|
|
25
27
|
brandColor: props.brandColor
|
|
26
28
|
});
|
|
29
|
+
const {
|
|
30
|
+
event
|
|
31
|
+
} = useContext(UIEventContext);
|
|
27
32
|
|
|
28
33
|
/** 记录截屏url */
|
|
29
34
|
const [state, setState] = useSetState({
|
|
@@ -93,6 +98,7 @@ export function Screenshot(props) {
|
|
|
93
98
|
className: clsx(className),
|
|
94
99
|
onClick: () => {
|
|
95
100
|
console.log('截屏!!!');
|
|
101
|
+
event.emit(pauseTimeToHideAllComponent);
|
|
96
102
|
IPCPlayerContext.snapshot({
|
|
97
103
|
saveToAlbum,
|
|
98
104
|
// 保存到 IPC 相册
|
|
@@ -4,11 +4,10 @@
|
|
|
4
4
|
height: calc(24px * var(--ipc-player-size-scale, 1));
|
|
5
5
|
padding: 0 calc(8px * var(--ipc-player-size-scale, 1));
|
|
6
6
|
border-radius: calc(24px * var(--ipc-player-size-scale, 1));
|
|
7
|
-
opacity: 1;
|
|
8
|
-
background: rgba(255, 255, 255, 0.1);
|
|
9
|
-
backdrop-filter: blur(10px);
|
|
10
7
|
color: var(--iconColor);
|
|
11
8
|
font-size: calc(12px * var(--ipc-player-size-scale, 1));
|
|
9
|
+
background-color: rgba(255, 255, 255, 0.3);
|
|
10
|
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
|
12
11
|
}
|
|
13
12
|
|
|
14
13
|
.ipc-player-plugin-tempHumidity-divider {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './verticalSmallIntercom';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './verticalSmallIntercom';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import React, { useContext } from 'react';
|
|
3
|
+
import { View } from '@ray-js/ray';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import { useStore } from '../../ctx/store';
|
|
6
|
+
import { pauseTimeToHideAllComponent } from '../../ui/constant';
|
|
7
|
+
import { UIEventContext } from '../../ui/context';
|
|
8
|
+
import { VoiceIntercom } from '../voiceIntercom';
|
|
9
|
+
import './verticalSmallIntercom.less';
|
|
10
|
+
export function VerticalSmallIntercom(props) {
|
|
11
|
+
const {
|
|
12
|
+
className
|
|
13
|
+
} = props;
|
|
14
|
+
const {
|
|
15
|
+
screenType,
|
|
16
|
+
verticalMic,
|
|
17
|
+
brandColor
|
|
18
|
+
} = useStore({
|
|
19
|
+
screenType: props.screenType,
|
|
20
|
+
ptzActive: props.ptzActive,
|
|
21
|
+
verticalMic: props.verticalMic,
|
|
22
|
+
intercomMode: props.intercomMode,
|
|
23
|
+
brandColor: props.brandColor
|
|
24
|
+
});
|
|
25
|
+
const {
|
|
26
|
+
event
|
|
27
|
+
} = useContext(UIEventContext);
|
|
28
|
+
const onTouchStart = () => {
|
|
29
|
+
event.emit(pauseTimeToHideAllComponent);
|
|
30
|
+
};
|
|
31
|
+
const onTouchEnd = () => {
|
|
32
|
+
// event.emit(startTimeToHideAllComponent);
|
|
33
|
+
};
|
|
34
|
+
if (screenType === 'vertical' && verticalMic) {
|
|
35
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
36
|
+
className: clsx(className)
|
|
37
|
+
}, /*#__PURE__*/React.createElement(VoiceIntercom, _extends({}, props, {
|
|
38
|
+
talkingColor: brandColor,
|
|
39
|
+
mode: "verticalSmall",
|
|
40
|
+
onTouchStart: onTouchStart,
|
|
41
|
+
onTouchEnd: onTouchEnd
|
|
42
|
+
})));
|
|
43
|
+
}
|
|
44
|
+
if (screenType === 'full') {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
@@ -4,10 +4,13 @@ import './voiceIntercom.less';
|
|
|
4
4
|
import { ComponentConfigProps } from '../../interface';
|
|
5
5
|
type Props = ComponentConfigProps & {
|
|
6
6
|
style?: React.CSSProperties;
|
|
7
|
-
|
|
7
|
+
intercomClassName?: string;
|
|
8
8
|
iconClassName?: string;
|
|
9
|
+
scale?: number;
|
|
9
10
|
onTouchStart?: TouchEventHandler['onTouchStart'];
|
|
10
11
|
onTouchEnd?: TouchEventHandler['onTouchEnd'];
|
|
12
|
+
talkingColor?: string;
|
|
13
|
+
mode?: 'verticalSmall' | 'fullSmall' | 'circle';
|
|
11
14
|
};
|
|
12
15
|
export declare const VoiceIntercom: (props: Props) => React.JSX.Element;
|
|
13
16
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
-
import React, { useRef, useContext } from 'react';
|
|
3
|
-
import { View
|
|
2
|
+
import React, { useRef, useContext, useState, useEffect } from 'react';
|
|
3
|
+
import { View } from '@ray-js/ray';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
|
-
import
|
|
5
|
+
import Svg from '@ray-js/svg';
|
|
6
6
|
import { useStore, getDefaultStore } from '../../ctx/store';
|
|
7
7
|
import './voiceIntercom.less';
|
|
8
8
|
import { PlayerStreamStatus, IntercomMode } from '../../interface';
|
|
@@ -13,7 +13,7 @@ const NILL = () => null;
|
|
|
13
13
|
export const VoiceIntercom = props => {
|
|
14
14
|
const {
|
|
15
15
|
style,
|
|
16
|
-
|
|
16
|
+
intercomClassName,
|
|
17
17
|
iconClassName,
|
|
18
18
|
// recording: recordingAtom,
|
|
19
19
|
// intercom: intercomAtom,
|
|
@@ -23,8 +23,13 @@ export const VoiceIntercom = props => {
|
|
|
23
23
|
setMute,
|
|
24
24
|
getStreamStatus,
|
|
25
25
|
onTouchStart = NILL,
|
|
26
|
-
onTouchEnd = NILL
|
|
26
|
+
onTouchEnd = NILL,
|
|
27
|
+
mode = 'circle',
|
|
28
|
+
scale = 0.12,
|
|
29
|
+
talkingColor = '#ffffff'
|
|
27
30
|
} = props;
|
|
31
|
+
const [frame, setFrame] = useState(0);
|
|
32
|
+
const talkingInterval = useRef(null);
|
|
28
33
|
const {
|
|
29
34
|
event
|
|
30
35
|
} = useContext(UIEventContext);
|
|
@@ -74,11 +79,33 @@ export const VoiceIntercom = props => {
|
|
|
74
79
|
await setIntercom(false);
|
|
75
80
|
event.emit(startTimeToHideAllComponent);
|
|
76
81
|
};
|
|
82
|
+
/**
|
|
83
|
+
* 处理对讲中动画
|
|
84
|
+
*/
|
|
85
|
+
useEffect(() => {
|
|
86
|
+
if (intercom) {
|
|
87
|
+
talkingInterval.current = setInterval(() => {
|
|
88
|
+
setFrame(prevFrame => (prevFrame + 1) % 124); // 循环播放帧
|
|
89
|
+
}, 30); // 每帧间隔 15ms,加快动画速度
|
|
90
|
+
} else {
|
|
91
|
+
talkingInterval.current && clearInterval(talkingInterval.current);
|
|
92
|
+
}
|
|
93
|
+
return () => clearInterval(talkingInterval.current);
|
|
94
|
+
}, [intercom]);
|
|
95
|
+
|
|
96
|
+
// 根据当前帧和矩形索引计算高度
|
|
97
|
+
const getHeight = (frame, index) => {
|
|
98
|
+
const animationFactor = Math.sin((frame + index) / 5) * 20; // 使用正弦波来模拟动态变化
|
|
99
|
+
return [50, 130, 180, 130, 50][index] + animationFactor; // 可以根据需求修改此逻辑
|
|
100
|
+
};
|
|
77
101
|
return /*#__PURE__*/React.createElement(View, {
|
|
78
|
-
style: _objectSpread(_objectSpread({}, style), {
|
|
102
|
+
style: _objectSpread(_objectSpread({}, style), mode === 'circle' && {
|
|
79
103
|
background: radialGradient(brandColor)
|
|
80
104
|
}),
|
|
81
|
-
className: clsx(
|
|
105
|
+
className: clsx({
|
|
106
|
+
'ipc-player-plugin-voice-intercom': mode === 'circle',
|
|
107
|
+
'ipc-player-plugin-voice-small-intercom': mode !== 'circle'
|
|
108
|
+
}, intercomClassName),
|
|
82
109
|
onTouchStart: async e => {
|
|
83
110
|
onTouchStart(e);
|
|
84
111
|
getDefaultStore();
|
|
@@ -105,10 +132,25 @@ export const VoiceIntercom = props => {
|
|
|
105
132
|
}
|
|
106
133
|
},
|
|
107
134
|
onTouchEnd: onTouchEnd
|
|
108
|
-
}, intercom ? /*#__PURE__*/React.createElement(
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
135
|
+
}, intercom ? /*#__PURE__*/React.createElement(View, {
|
|
136
|
+
className: clsx({
|
|
137
|
+
'ipc-player-plugin-voice-small-ing-intercom': mode !== 'circle'
|
|
138
|
+
})
|
|
139
|
+
}, /*#__PURE__*/React.createElement(Svg, {
|
|
140
|
+
width: `${200 * scale}px`,
|
|
141
|
+
height: `${200 * scale}px`,
|
|
142
|
+
viewBox: `0 0 ${200 * scale} ${200 * scale}`
|
|
143
|
+
}, [0, 1, 2, 3, 4].map(index => /*#__PURE__*/React.createElement("rect", {
|
|
144
|
+
key: index,
|
|
145
|
+
x: (index * 34 + 20) * scale,
|
|
146
|
+
y: (200 - getHeight(frame, index)) / 2 * scale,
|
|
147
|
+
width: 20 * scale,
|
|
148
|
+
height: getHeight(frame, index) * scale,
|
|
149
|
+
fill: talkingColor,
|
|
150
|
+
rx: index === 0 || index === 4 ? 1 : 2 // 控制圆角
|
|
151
|
+
,
|
|
152
|
+
ry: index === 0 || index === 4 ? 1 : 2
|
|
153
|
+
})))) : /*#__PURE__*/React.createElement(View, {
|
|
154
|
+
className: clsx('icon-panel', 'icon-panel-one-way-intercom', mode === 'circle' && 'intercom-default-size', mode !== 'circle' && 'ipc-player-plugin-voice-small-intercom', iconClassName)
|
|
113
155
|
}));
|
|
114
156
|
};
|
|
@@ -11,16 +11,44 @@
|
|
|
11
11
|
font-size: calc(@size * var(--ipc-player-size-scale, 1));
|
|
12
12
|
color: #fff;
|
|
13
13
|
}
|
|
14
|
+
.ipc-player-plugin-voice-small-intercom {
|
|
15
|
+
height: 100%;
|
|
16
|
+
display: flex;
|
|
17
|
+
align-items: center;
|
|
18
|
+
justify-content: center;
|
|
19
|
+
}
|
|
20
|
+
.ipc-player-plugin-voice-small-intercom {
|
|
21
|
+
color: var(--iconColor);
|
|
22
|
+
font-size: calc(var(--iconPlayerSize) * var(--ipc-player-size-scale, 1)) !important;
|
|
23
|
+
}
|
|
24
|
+
.ipc-player-plugin-voice-small-ing-intercom {
|
|
25
|
+
color: var(--iconColor);
|
|
26
|
+
font-size: calc(var(--iconPlayerSize) * var(--ipc-player-size-scale, 1)) !important;
|
|
27
|
+
display: flex;
|
|
28
|
+
justify-content: center;
|
|
29
|
+
align-items: center;
|
|
30
|
+
height: 100%;
|
|
31
|
+
}
|
|
14
32
|
.ipc-player-plugin-voice-intercom-img {
|
|
15
33
|
width: calc(@size * var(--ipc-player-size-scale, 1));
|
|
16
|
-
height: calc(@size * var(--ipc-player-size-scale, 1))
|
|
34
|
+
height: calc(@size * var(--ipc-player-size-scale, 1));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.ipc-player-plugin-small-voice-intercom-img {
|
|
38
|
+
width: calc(var(--iconPlayerSize) * var(--ipc-player-size-scale, 1));
|
|
39
|
+
height: calc(var(--iconPlayerSize) * var(--ipc-player-size-scale, 1));
|
|
17
40
|
}
|
|
18
41
|
|
|
19
|
-
.intercom-default-
|
|
42
|
+
.intercom-default-size {
|
|
20
43
|
font-size: calc(@size * var(--ipc-player-size-scale, 1.5)) !important;
|
|
21
44
|
}
|
|
22
45
|
|
|
23
46
|
.intercom-ing-default-size {
|
|
24
47
|
width: calc(@size * var(--ipc-player-size-scale, 1.5));
|
|
25
48
|
height: calc(@size * var(--ipc-player-size-scale, 1.5));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.intercom-ing-small-size {
|
|
52
|
+
width: calc(var(--iconPlayerSize) * var(--ipc-player-size-scale, 1));
|
|
53
|
+
height: calc(var(--iconPlayerSize) * var(--ipc-player-size-scale, 1));
|
|
26
54
|
}
|
package/lib/ui/ui.d.ts
CHANGED
package/lib/ui/ui.js
CHANGED
|
@@ -45,14 +45,16 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
45
45
|
CSSVariable = defaultCSSVariable,
|
|
46
46
|
privateState = false,
|
|
47
47
|
deviceOnline = true,
|
|
48
|
-
brandColor = '#FF592A'
|
|
48
|
+
brandColor = '#FF592A',
|
|
49
|
+
verticalMic = true
|
|
49
50
|
} = props;
|
|
50
51
|
const instance = getCtxInstance(props.instance, devId);
|
|
51
52
|
const {
|
|
52
53
|
setPlayState,
|
|
53
54
|
setScreenType,
|
|
54
55
|
setFullResolutionActive,
|
|
55
|
-
setBrandColor
|
|
56
|
+
setBrandColor,
|
|
57
|
+
setVerticalMic
|
|
56
58
|
} = instance;
|
|
57
59
|
const prevTriggerEvent = useRef();
|
|
58
60
|
const eventRef = useRef();
|
|
@@ -62,6 +64,7 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
62
64
|
}
|
|
63
65
|
useEffect(() => {
|
|
64
66
|
setBrandColor(brandColor);
|
|
67
|
+
setVerticalMic(verticalMic);
|
|
65
68
|
}, []);
|
|
66
69
|
const {
|
|
67
70
|
event
|
package/lib/utils/index.d.ts
CHANGED
package/lib/utils/index.js
CHANGED
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-27",
|
|
4
4
|
"description": "IPC 播放器功能集成",
|
|
5
5
|
"main": "lib/index",
|
|
6
6
|
"files": [
|
|
@@ -33,12 +33,13 @@
|
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {},
|
|
35
35
|
"dependencies": {
|
|
36
|
+
"@ray-js/ipc-ptz-zoom": "0.0.2-beta-4",
|
|
37
|
+
"@ray-js/panel-sdk": "^1.13.1",
|
|
36
38
|
"@ray-js/ray-ipc-player": "2.0.20-beta-3",
|
|
37
39
|
"@ray-js/ray-ipc-utils": "1.1.0-beta-12",
|
|
38
|
-
"@ray-js/
|
|
40
|
+
"@ray-js/svg": "0.2.0",
|
|
39
41
|
"clsx": "^1.2.1",
|
|
40
|
-
"jotai": "^2.10.2"
|
|
41
|
-
"@ray-js/panel-sdk": "^1.13.1"
|
|
42
|
+
"jotai": "^2.10.2"
|
|
42
43
|
},
|
|
43
44
|
"devDependencies": {
|
|
44
45
|
"@commitlint/cli": "^7.2.1",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './smallIntercom';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './smallIntercom';
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { View, Text } from '@ray-js/ray';
|
|
3
|
-
import clsx from 'clsx';
|
|
4
|
-
import { useStore } from '../../ctx/store';
|
|
5
|
-
import './smallIntercom.less';
|
|
6
|
-
export function SmallIntercom(props) {
|
|
7
|
-
const {
|
|
8
|
-
IPCPlayerContext,
|
|
9
|
-
addContent,
|
|
10
|
-
saveToAlbum,
|
|
11
|
-
deleteContent,
|
|
12
|
-
devId,
|
|
13
|
-
toast,
|
|
14
|
-
className
|
|
15
|
-
} = props;
|
|
16
|
-
const {
|
|
17
|
-
screenType,
|
|
18
|
-
ptzActive
|
|
19
|
-
} = useStore({
|
|
20
|
-
screenType: props.screenType,
|
|
21
|
-
ptzActive: props.ptzActive
|
|
22
|
-
});
|
|
23
|
-
const handClick = () => {
|
|
24
|
-
console.log('截屏!!!');
|
|
25
|
-
// IPCPlayerContext.snapshot({
|
|
26
|
-
// saveToAlbum, // 保存到 IPC 相册
|
|
27
|
-
// success: res => {
|
|
28
|
-
// showToast(res.tempImagePath);
|
|
29
|
-
// },
|
|
30
|
-
// fail: err => {
|
|
31
|
-
// const errObj = err.innerError || err || {};
|
|
32
|
-
// const errMsg = errObj.errorMsg || I18n.t('error_screenshot');
|
|
33
|
-
// toast({ title: errMsg });
|
|
34
|
-
// },
|
|
35
|
-
// });
|
|
36
|
-
};
|
|
37
|
-
if (screenType === 'vertical' && !ptzActive) {
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
if (screenType === 'full' && ptzActive) {
|
|
41
|
-
return /*#__PURE__*/React.createElement(View, {
|
|
42
|
-
className: clsx(className),
|
|
43
|
-
onClick: handClick
|
|
44
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
45
|
-
className: clsx('icon-panel', 'icon-panel-one-way-intercom', 'ipc-player-plugin-small-intercom-icon')
|
|
46
|
-
}));
|
|
47
|
-
}
|
|
48
|
-
return null;
|
|
49
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
.ipc-player-plugin-small-intercom-icon {
|
|
2
|
-
color: var(--iconColor);
|
|
3
|
-
font-size: calc(var(--iconPlayerSize) * var(--ipc-player-size-scale, 1)) !important;
|
|
4
|
-
}
|
|
5
|
-
.ipc-player-plugin-screenshot-toast-wrap {
|
|
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
|
-
}
|
|
12
|
-
.ipc-player-plugin-screenshot-toast {
|
|
13
|
-
border-radius: calc(8px * var(--ipc-player-size-scale, 1));;
|
|
14
|
-
background-color: var(--shot-card-bg-color);
|
|
15
|
-
display: flex;
|
|
16
|
-
align-items: center;
|
|
17
|
-
padding: calc(8px * var(--ipc-player-size-scale, 1)) calc(12px * var(--ipc-player-size-scale, 1));
|
|
18
|
-
z-index: 100;
|
|
19
|
-
.ipc-player-plugin-screenshot-toast-image-box {
|
|
20
|
-
border-radius: calc(4px * var(--ipc-player-size-scale, 1));
|
|
21
|
-
overflow: hidden;
|
|
22
|
-
width: calc(66px * var(--ipc-player-size-scale, 1));
|
|
23
|
-
height: calc(66px * 0.57 * var(--ipc-player-size-scale, 1));
|
|
24
|
-
}
|
|
25
|
-
.ipc-player-plugin-screenshot-toast-image {
|
|
26
|
-
width: 100%;
|
|
27
|
-
height: 100%;
|
|
28
|
-
object-fit: cover;
|
|
29
|
-
}
|
|
30
|
-
.ipc-player-plugin-screenshot-toast-title {
|
|
31
|
-
flex: 1;
|
|
32
|
-
margin-left: calc(12px * var(--ipc-player-size-scale, 1));
|
|
33
|
-
font-size: calc(14px * var(--ipc-player-size-scale, 1));
|
|
34
|
-
color: var(--fontColor);
|
|
35
|
-
margin-right: calc(12px * var(--ipc-player-size-scale, 1));
|
|
36
|
-
word-break: break-word;
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
.ipc-player-plugin-screenshot-toast-bottom {
|
|
40
|
-
border: 1px solid #1989FA;
|
|
41
|
-
min-width: calc(52px * var(--ipc-player-size-scale, 1));
|
|
42
|
-
max-width: calc(100px * var(--ipc-player-size-scale, 1));
|
|
43
|
-
border-radius: calc(4px * var(--ipc-player-size-scale, 1));
|
|
44
|
-
padding: calc(5px * var(--ipc-player-size-scale, 1)) calc(11px * var(--ipc-player-size-scale, 1));
|
|
45
|
-
font-size: calc(14px * var(--ipc-player-size-scale, 1));
|
|
46
|
-
white-space: nowrap;
|
|
47
|
-
overflow: hidden;
|
|
48
|
-
text-overflow: ellipsis;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
Binary file
|