@ray-js/ray-ipc-utils 1.1.0-beta-10 → 1.1.0-beta-11

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/index.d.ts CHANGED
@@ -19,8 +19,8 @@ declare const IpcUtils: {
19
19
  getDpIdByCode: <T_12>(deviceId: string, dpCode: string) => Promise<import("./kit/interface").IRes<T_12>>;
20
20
  goToMiniProgramByShortLink: <T_13>(url: string, position?: string) => Promise<import("./kit/interface").IRes<T_13>>;
21
21
  getVideoBitrateKbps: <T_14>(deviceId: string, extendParam?: {}) => Promise<import("./kit/interface").IRes<T_14>>;
22
- networkStatusDidChangedEvent: (callback: any) => void;
23
- offNetworkStatusDidChangedEvent: (callback: any) => void;
22
+ networkStatusDidChangedEvent: (callback: (res: any) => void) => void;
23
+ offNetworkStatusDidChangedEvent: (callback: (res: any) => void) => void;
24
24
  getMobileOrientation: <T_15>() => Promise<import("./kit/interface").IRes<T_15>>;
25
25
  jumpToWebView: <T_16>(url: string) => Promise<import("./kit/interface").IRes<T_16>>;
26
26
  setScreenOrientation: <T_17>(pageOrientation: string) => Promise<import("./kit/interface").IRes<T_17>>;
@@ -55,8 +55,8 @@ export declare const goToMiniProgramByShortLink: <T>(url: string, position?: str
55
55
  * @returns
56
56
  */
57
57
  export declare const getVideoBitrateKbps: <T>(deviceId: string, extendParam?: {}) => Promise<IRes<T>>;
58
- export declare const networkStatusDidChangedEvent: (callback: any) => void;
59
- export declare const offNetworkStatusDidChangedEvent: (callback: any) => void;
58
+ export declare const networkStatusDidChangedEvent: (callback: (res: any) => void) => void;
59
+ export declare const offNetworkStatusDidChangedEvent: (callback: (res: any) => void) => void;
60
60
  /**
61
61
  * 获取手机当前横竖屏状态
62
62
  * 需引入IPCKit,且在>=1.0.0-TTT432.1版本才可使用
@@ -147,59 +147,62 @@ export const getCameraConfigInfo = async deviceId => {
147
147
  })) {
148
148
  // 非虚拟机设备,请求接口
149
149
  if (!isVirtualDevice) {
150
- var _rtcApiResult$audioAt, _rtcApiResult$audioAt2, _rtcApiResult$audioAt3;
151
- const rtcApiResult = await getIpcConfigInfo(deviceId);
150
+ const rtcInfo = await getIpcConfigInfo(deviceId);
151
+ if (rtcInfo.code === 0) {
152
+ var _rtcApiResult$audioAt, _rtcApiResult$audioAt2, _rtcApiResult$audioAt3;
153
+ const rtcApiResult = rtcInfo.data;
154
+ // 1. 拾音器模块
155
+ const isMicrophoneSupported = rtcApiResult === null || rtcApiResult === void 0 || (_rtcApiResult$audioAt = rtcApiResult.audioAttributes) === null || _rtcApiResult$audioAt === void 0 || (_rtcApiResult$audioAt = _rtcApiResult$audioAt.hardwareCapability) === null || _rtcApiResult$audioAt === void 0 ? void 0 : _rtcApiResult$audioAt.includes(1);
156
+ // 拾音器默认声音都为关闭, 若接口返回不支持,则将缓存值设置为关闭
157
+ microphoneSettings.isMicrophoneSupported = isMicrophoneSupported;
158
+ const muteStatus = isMicrophoneSupported ? microphoneSettings.cachedMuteMode : defaultMuteMode;
159
+ microphoneSettings.cachedMuteMode = muteStatus; // 设置默认值
152
160
 
153
- // 1. 拾音器模块
154
- const isMicrophoneSupported = rtcApiResult === null || rtcApiResult === void 0 || (_rtcApiResult$audioAt = rtcApiResult.audioAttributes) === null || _rtcApiResult$audioAt === void 0 || (_rtcApiResult$audioAt = _rtcApiResult$audioAt.hardwareCapability) === null || _rtcApiResult$audioAt === void 0 ? void 0 : _rtcApiResult$audioAt.includes(1);
155
- // 拾音器默认声音都为关闭, 若接口返回不支持,则将缓存值设置为关闭
156
- microphoneSettings.isMicrophoneSupported = isMicrophoneSupported;
157
- const muteStatus = isMicrophoneSupported ? microphoneSettings.cachedMuteMode : defaultMuteMode;
158
- microphoneSettings.cachedMuteMode = muteStatus;
159
-
160
- // 2. 对讲功能模块
161
- const isIntercomSupported = rtcApiResult === null || rtcApiResult === void 0 || (_rtcApiResult$audioAt2 = rtcApiResult.audioAttributes) === null || _rtcApiResult$audioAt2 === void 0 || (_rtcApiResult$audioAt2 = _rtcApiResult$audioAt2.hardwareCapability) === null || _rtcApiResult$audioAt2 === void 0 ? void 0 : _rtcApiResult$audioAt2.includes(2);
162
- intercomInfo.isIntercomSupported = isIntercomSupported;
163
- // 获取支持的对讲方式
164
- const supportedIntercomModes = rtcApiResult === null || rtcApiResult === void 0 || (_rtcApiResult$audioAt3 = rtcApiResult.audioAttributes) === null || _rtcApiResult$audioAt3 === void 0 ? void 0 : _rtcApiResult$audioAt3.callMode;
165
- if (isIntercomSupported && supportedIntercomModes.length > 0) {
166
- var _appIntercomCached$da;
167
- intercomInfo.defaultIntercomMode = intercomCallMode[supportedIntercomModes[0]];
168
- intercomInfo.supportedIntercomModes = supportedIntercomModes.map(mode => intercomCallMode[mode]);
169
- // 获取APP当前存储的对讲模式, 因目前设置页对讲设置使用的还是原生页面,需要读取APP缓存保持一致
170
- const appIntercomCached = await getCurrentSupportedTalkMode(deviceId);
171
- if (appIntercomCached.code !== 0) {
172
- throw appIntercomCached.msg;
161
+ // 2. 对讲功能模块
162
+ const isIntercomSupported = rtcApiResult === null || rtcApiResult === void 0 || (_rtcApiResult$audioAt2 = rtcApiResult.audioAttributes) === null || _rtcApiResult$audioAt2 === void 0 || (_rtcApiResult$audioAt2 = _rtcApiResult$audioAt2.hardwareCapability) === null || _rtcApiResult$audioAt2 === void 0 ? void 0 : _rtcApiResult$audioAt2.includes(2);
163
+ intercomInfo.isIntercomSupported = isIntercomSupported;
164
+ // 获取支持的对讲方式
165
+ const supportedIntercomModes = rtcApiResult === null || rtcApiResult === void 0 || (_rtcApiResult$audioAt3 = rtcApiResult.audioAttributes) === null || _rtcApiResult$audioAt3 === void 0 ? void 0 : _rtcApiResult$audioAt3.callMode;
166
+ if (isIntercomSupported && supportedIntercomModes.length > 0) {
167
+ var _appIntercomCached$da;
168
+ intercomInfo.defaultIntercomMode = intercomCallMode[supportedIntercomModes[0]];
169
+ intercomInfo.supportedIntercomModes = supportedIntercomModes.map(mode => intercomCallMode[mode]);
170
+ // 获取APP当前存储的对讲模式, 因目前设置页对讲设置使用的还是原生页面,需要读取APP缓存保持一致
171
+ const appIntercomCached = await getCurrentSupportedTalkMode(deviceId);
172
+ if (appIntercomCached.code !== 0) {
173
+ throw appIntercomCached.msg;
174
+ }
175
+ intercomInfo.cachedIntercomMode = intercomCallMode[appIntercomCached === null || appIntercomCached === void 0 || (_appIntercomCached$da = appIntercomCached.data) === null || _appIntercomCached$da === void 0 ? void 0 : _appIntercomCached$da.talkbackMode];
173
176
  }
174
- intercomInfo.cachedIntercomMode = intercomCallMode[appIntercomCached === null || appIntercomCached === void 0 || (_appIntercomCached$da = appIntercomCached.data) === null || _appIntercomCached$da === void 0 ? void 0 : _appIntercomCached$da.talkbackMode];
175
- }
176
177
 
177
- // 3. 视频分辨率模块
178
- videoResolution.defaultResolution = videoResolutionMode[rtcApiResult === null || rtcApiResult === void 0 ? void 0 : rtcApiResult.vedioClarity];
179
- const supportedVideoClarity = rtcApiResult === null || rtcApiResult === void 0 ? void 0 : rtcApiResult.vedioClaritys;
180
- videoResolution.availableResolutions = supportedVideoClarity.map(mode => videoResolutionMode[mode]);
178
+ // 3. 视频分辨率模块
179
+ videoResolution.defaultResolution = videoResolutionMode[rtcApiResult === null || rtcApiResult === void 0 ? void 0 : rtcApiResult.vedioClarity];
180
+ console.log(rtcApiResult, 'rtcApiResult');
181
+ const supportedVideoClarity = rtcApiResult === null || rtcApiResult === void 0 ? void 0 : rtcApiResult.vedioClaritys;
182
+ videoResolution.availableResolutions = supportedVideoClarity.map(mode => videoResolutionMode[mode]);
181
183
 
182
- // 4. 最大倍数模块
183
- maxZoomSettings = (rtcApiResult === null || rtcApiResult === void 0 ? void 0 : rtcApiResult.maxZoomInTimes) !== 0 ? rtcApiResult === null || rtcApiResult === void 0 ? void 0 : rtcApiResult.maxZoomInTimes : 6;
184
- }
184
+ // 4. 最大倍数模块
185
+ maxZoomSettings = (rtcApiResult === null || rtcApiResult === void 0 ? void 0 : rtcApiResult.maxZoomInTimes) !== 0 ? rtcApiResult === null || rtcApiResult === void 0 ? void 0 : rtcApiResult.maxZoomInTimes : 6;
186
+ }
185
187
 
186
- // 1. 设置拾音器缓存
187
- if (!microphoneStorage.data) {
188
- setNativeStorage(`${deviceId}_microphone`, microphoneSettings);
189
- }
190
- // 2. 设置对讲缓存
191
- if (!intercomStorage.data) {
192
- setNativeStorage(`${deviceId}_intercom`, intercomInfo);
193
- }
188
+ // 1. 设置拾音器缓存
189
+ if (!microphoneStorage.data) {
190
+ setNativeStorage(`${deviceId}_microphone`, microphoneSettings);
191
+ }
192
+ // 2. 设置对讲缓存
193
+ if (!intercomStorage.data) {
194
+ setNativeStorage(`${deviceId}_intercom`, intercomInfo);
195
+ }
194
196
 
195
- // 3. 设置视频清晰度缓存
196
- if (!resolutionStorage.data) {
197
- setNativeStorage(`${deviceId}_resolution`, videoResolution);
198
- }
197
+ // 3. 设置视频清晰度缓存
198
+ if (!resolutionStorage.data) {
199
+ setNativeStorage(`${deviceId}_resolution`, videoResolution);
200
+ }
199
201
 
200
- // 4. 设置最大倍数缓存
201
- if (!maxZoomSettingsStorage.data) {
202
- setNativeStorage(`${deviceId}_maxZoomSettings`, maxZoomSettings);
202
+ // 4. 设置最大倍数缓存
203
+ if (!maxZoomSettingsStorage.data) {
204
+ setNativeStorage(`${deviceId}_maxZoomSettings`, maxZoomSettings);
205
+ }
203
206
  }
204
207
  } else {
205
208
  var _appIntercomCached$da2, _intercomStorage$data;
@@ -228,13 +231,14 @@ export const getCameraConfigInfo = async deviceId => {
228
231
  data: ipcConfig
229
232
  });
230
233
  } catch (err) {
234
+ console.log(err, 'err');
231
235
  ty.showToast({
232
236
  title: I18n.t('get_ipc_config_info_api_err'),
233
237
  icon: 'error'
234
238
  });
235
239
  return Promise.resolve({
236
240
  code: -1,
237
- msg: String(err)
241
+ msg: err.errorMsg ? err.errorMsg : String(err)
238
242
  });
239
243
  }
240
244
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/ray-ipc-utils",
3
- "version": "1.1.0-beta-10",
3
+ "version": "1.1.0-beta-11",
4
4
  "description": "IPC 工具库",
5
5
  "main": "lib/index",
6
6
  "files": [