@ray-js/ipc-player-integration 0.0.1-beta-55 → 0.0.1-beta-57

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.
@@ -68,7 +68,8 @@ const getMemoryState = devId => {
68
68
  mute: true,
69
69
  intercomMode: IntercomMode.TwoWay,
70
70
  resolution: ClarityType.HD,
71
- resolutionList: [ClarityType.HD, ClarityType.SD]
71
+ resolutionList: [ClarityType.HD, ClarityType.SD],
72
+ isIntercomSupported: false
72
73
  };
73
74
  return new Promise(resolve => {
74
75
  IPCUtils.getCameraConfigInfo(devId).then(res => {
@@ -79,6 +80,7 @@ const getMemoryState = devId => {
79
80
  return resolve({
80
81
  mute: muteValue,
81
82
  intercomMode: res.data.intercomInfo.cachedIntercomMode,
83
+ isIntercomSupported: res.data.intercomInfo.isIntercomSupported,
82
84
  resolution: res.data.videoResolution.cachedResolution,
83
85
  resolutionList: res.data.videoResolution.availableResolutions
84
86
  });
package/lib/ctx/ctx.js CHANGED
@@ -59,6 +59,8 @@ export const createUseCtx = _ref => {
59
59
 
60
60
  // 单向对讲还是双向对讲
61
61
  const [intercomMode, setIntercomMode] = useAtom(IntercomMode.TwoWay);
62
+ // 摄像头配置是否支持对讲
63
+ const [intercomSupported, setIntercomSupported] = useAtom(false);
62
64
 
63
65
  // 对讲中
64
66
  const [intercom] = useAtom(false);
@@ -92,6 +94,7 @@ export const createUseCtx = _ref => {
92
94
  _setResolution(res.resolution, true);
93
95
  _setMute(res.mute, true);
94
96
  setIntercomMode(res.intercomMode);
97
+ setIntercomSupported(res.isIntercomSupported);
95
98
  } catch (error) {
96
99
  console.error('获取 getMemoryState 失败:', error);
97
100
  }
@@ -107,6 +110,7 @@ export const createUseCtx = _ref => {
107
110
  _setResolution(res.resolution, true);
108
111
  _setMute(res.mute, true);
109
112
  setIntercomMode(res.intercomMode);
113
+ setIntercomSupported(res.isIntercomSupported);
110
114
  });
111
115
  }
112
116
  }, [devId, _playState]);
@@ -215,6 +219,7 @@ export const createUseCtx = _ref => {
215
219
  resolutionList,
216
220
  intercom,
217
221
  intercomMode,
222
+ intercomSupported,
218
223
  playState,
219
224
  setPlayState,
220
225
  setBrandColor,
@@ -53,6 +53,7 @@ export type UseCtx = (options: {
53
53
  mute: RetAtom<boolean>;
54
54
  intercom: RetAtom<boolean>;
55
55
  intercomMode: RetAtom<IntercomMode>;
56
+ intercomSupported: RetAtom<boolean>;
56
57
  resolution: RetAtom<string>;
57
58
  resolutionList: RetAtom<string[]>;
58
59
  playState: RetAtom<PlayState>;
@@ -12,6 +12,7 @@ export declare const Battery: import("react").FunctionComponent<{
12
12
  mute: import("../..").RetAtom<boolean>;
13
13
  intercom: import("../..").RetAtom<boolean>;
14
14
  intercomMode: import("../..").RetAtom<import("@ray-js/ray-ipc-utils/lib/interface").IntercomMode>;
15
+ intercomSupported: import("../..").RetAtom<boolean>;
15
16
  resolution: import("../..").RetAtom<string>;
16
17
  resolutionList: import("../..").RetAtom<string[]>;
17
18
  playState: import("../..").RetAtom<import("../..").PlayState>;
@@ -56,6 +57,7 @@ export declare const BatteryFull: import("react").FunctionComponent<{
56
57
  mute: import("../..").RetAtom<boolean>;
57
58
  intercom: import("../..").RetAtom<boolean>;
58
59
  intercomMode: import("../..").RetAtom<import("@ray-js/ray-ipc-utils/lib/interface").IntercomMode>;
60
+ intercomSupported: import("../..").RetAtom<boolean>;
59
61
  resolution: import("../..").RetAtom<string>;
60
62
  resolutionList: import("../..").RetAtom<string[]>;
61
63
  playState: import("../..").RetAtom<import("../..").PlayState>;
@@ -5,7 +5,7 @@ import { useUpdateEffect } from 'ahooks';
5
5
  import clsx from 'clsx';
6
6
  import { unstable_batchedUpdates as batchedUpdates } from '@ray-core/ray';
7
7
  import { UIEventContext } from '../../ui/context';
8
- import { showAllComponent, voiceIntercomId, verticalScreenId, fullTravelRouteControlId, ptzControlId, fullResolutionId, pauseTimeToHideAllComponent } from '../../ui/constant';
8
+ import { showAllComponent, voiceIntercomId, verticalScreenId, fullTravelRouteControlId, ptzControlId, fullResolutionId, fullSmallIntercomId, pauseTimeToHideAllComponent } from '../../ui/constant';
9
9
  import { useStore } from '../../ctx/store';
10
10
  import { VerticalScreen } from './verticalScreen';
11
11
  import { FullVoiceIntercom } from './fullVoiceIntercom';
@@ -19,6 +19,7 @@ export function FullScreen(props) {
19
19
  setScreenType,
20
20
  addContent,
21
21
  deleteContent,
22
+ hideContent,
22
23
  className,
23
24
  showContent,
24
25
  devId,
@@ -57,6 +58,7 @@ export function FullScreen(props) {
57
58
  onClick: () => {
58
59
  // 点击返回时提前调用一波
59
60
  deleteContent('topLeft', verticalScreenId);
61
+ hideContent('bottomLeft', fullSmallIntercomId);
60
62
  deleteContent('absolute', voiceIntercomId);
61
63
  deleteContent('absolute', ptzControlId);
62
64
  deleteContent('absolute', fullResolutionId);
@@ -107,6 +109,7 @@ export function FullScreen(props) {
107
109
  showMenuButton();
108
110
  showStatusBar();
109
111
  deleteContent('topLeft', verticalScreenId);
112
+ hideContent('bottomLeft', fullSmallIntercomId);
110
113
  deleteContent('absolute', voiceIntercomId);
111
114
  deleteContent('absolute', ptzControlId);
112
115
  deleteContent('absolute', fullResolutionId);
@@ -4,5 +4,5 @@
4
4
  import React from 'react';
5
5
  import type { ComponentConfigProps } from '../../interface';
6
6
  type Props = ComponentConfigProps;
7
- export declare function FullVoiceIntercom(props: Props): React.JSX.Element;
7
+ export declare function FullVoiceIntercom(props: Props): React.JSX.Element | null;
8
8
  export {};
@@ -18,9 +18,11 @@ export function FullVoiceIntercom(props) {
18
18
  event
19
19
  } = useContext(UIEventContext);
20
20
  const {
21
- screenType
21
+ screenType,
22
+ intercomSupported
22
23
  } = useStore({
23
- screenType: props.screenType
24
+ screenType: props.screenType,
25
+ intercomSupported: props.intercomSupported
24
26
  });
25
27
  const onPtzControlShow = useMemoizedFn(() => {
26
28
  setIsPtzActive(true);
@@ -36,6 +38,9 @@ export function FullVoiceIntercom(props) {
36
38
  event.off('ptzControlHide', onPtzControlHide);
37
39
  };
38
40
  }, []);
41
+ if (!intercomSupported) {
42
+ return null;
43
+ }
39
44
  return /*#__PURE__*/React.createElement(View, {
40
45
  className: clsx('ipc-player-plugin-full-screen-voice', {
41
46
  'ipc-player-plugin-full-screen-voice-hide': shouldHide || isPtzActive,
@@ -13,10 +13,12 @@ export function FullSmallIntercom(props) {
13
13
  } = props;
14
14
  const {
15
15
  screenType,
16
- brandColor
16
+ brandColor,
17
+ intercomSupported
17
18
  } = useStore({
18
19
  screenType: props.screenType,
19
- brandColor: props.brandColor
20
+ brandColor: props.brandColor,
21
+ intercomSupported: props.intercomSupported
20
22
  });
21
23
  const {
22
24
  event
@@ -30,7 +32,7 @@ export function FullSmallIntercom(props) {
30
32
  const onTouchEnd = () => {
31
33
  // event.emit(startTimeToHideAllComponent);
32
34
  };
33
- if (screenType === 'full') {
35
+ if (screenType === 'full' && intercomSupported) {
34
36
  return /*#__PURE__*/React.createElement(View, {
35
37
  className: clsx(className)
36
38
  }, /*#__PURE__*/React.createElement(VoiceIntercom, _extends({}, props, {
@@ -14,12 +14,14 @@ export function VerticalSmallIntercom(props) {
14
14
  const {
15
15
  screenType,
16
16
  verticalMic,
17
- brandColor
17
+ brandColor,
18
+ intercomSupported
18
19
  } = useStore({
19
20
  screenType: props.screenType,
20
21
  verticalMic: props.verticalMic,
21
22
  intercomMode: props.intercomMode,
22
- brandColor: props.brandColor
23
+ brandColor: props.brandColor,
24
+ intercomSupported: props.intercomSupported
23
25
  });
24
26
  const {
25
27
  event
@@ -30,7 +32,7 @@ export function VerticalSmallIntercom(props) {
30
32
  const onTouchEnd = () => {
31
33
  // event.emit(startTimeToHideAllComponent);
32
34
  };
33
- if (screenType === 'vertical' && verticalMic) {
35
+ if (screenType === 'vertical' && verticalMic && intercomSupported) {
34
36
  return /*#__PURE__*/React.createElement(View, {
35
37
  className: clsx(className)
36
38
  }, /*#__PURE__*/React.createElement(VoiceIntercom, _extends({}, props, {
@@ -9,6 +9,7 @@ export declare const verticalScreenId = "verticalScreenId";
9
9
  export declare const ptzControlId = "ptzControlId";
10
10
  export declare const fullResolutionId = "fullResolutionId";
11
11
  export declare const batteryId = "Battery";
12
+ export declare const fullSmallIntercomId = "FullSmallIntercom";
12
13
  export declare const decodeClarityDic: {
13
14
  SS: string;
14
15
  SD: string;
@@ -9,6 +9,7 @@ export const verticalScreenId = 'verticalScreenId';
9
9
  export const ptzControlId = 'ptzControlId';
10
10
  export const fullResolutionId = 'fullResolutionId';
11
11
  export const batteryId = 'Battery';
12
+ export const fullSmallIntercomId = 'FullSmallIntercom';
12
13
  export const decodeClarityDic = {
13
14
  SS: 'ss',
14
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-55",
3
+ "version": "0.0.1-beta-57",
4
4
  "description": "IPC 播放器功能集成",
5
5
  "main": "lib/index",
6
6
  "files": [