@ray-js/ray-ipc-utils 1.1.11 → 1.1.12-beta.1
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/interface.d.ts +4 -0
- package/lib/service/index.js +20 -5
- package/package.json +1 -1
package/lib/interface.d.ts
CHANGED
package/lib/service/index.js
CHANGED
|
@@ -119,6 +119,7 @@ export const getCameraConfigInfo = async function (deviceId) {
|
|
|
119
119
|
const supportedIntercomModes = [IntercomMode.OneWay, IntercomMode.TwoWay];
|
|
120
120
|
const defaultMuteMode = MuteMode.OFF;
|
|
121
121
|
let maxZoomSettings = 6;
|
|
122
|
+
let p2pBizCmdNumber = 0;
|
|
122
123
|
let microphoneSettings = {
|
|
123
124
|
isMicrophoneSupported: true,
|
|
124
125
|
defaultMuteMode,
|
|
@@ -137,9 +138,9 @@ export const getCameraConfigInfo = async function (deviceId) {
|
|
|
137
138
|
};
|
|
138
139
|
// native 缓存Key值
|
|
139
140
|
|
|
140
|
-
const nativeStorageInfo = await Promise.all([`${deviceId}_resolution`, `${deviceId}_intercom`, `${deviceId}_microphone`, `${deviceId}_maxZoomSettings`].map(key => getNativeStorage(key)));
|
|
141
|
+
const nativeStorageInfo = await Promise.all([`${deviceId}_resolution`, `${deviceId}_intercom`, `${deviceId}_microphone`, `${deviceId}_maxZoomSettings`, `${deviceId}_p2pBizCmd`].map(key => getNativeStorage(key)));
|
|
141
142
|
ipcTTTOperatorLog(`Utils: nativeStorageInfo: ${nativeStorageInfo}`);
|
|
142
|
-
const [resolutionStorage, intercomStorage, microphoneStorage, maxZoomSettingsStorage] = nativeStorageInfo;
|
|
143
|
+
const [resolutionStorage, intercomStorage, microphoneStorage, maxZoomSettingsStorage, p2pBizCmdStorage, p2pBizCmdNumberStorage] = nativeStorageInfo;
|
|
143
144
|
// 任意缓存为空,则请求接口
|
|
144
145
|
|
|
145
146
|
console.log(nativeStorageInfo, 'nativeStorageInfo');
|
|
@@ -150,7 +151,7 @@ export const getCameraConfigInfo = async function (deviceId) {
|
|
|
150
151
|
if (noCache) {
|
|
151
152
|
// 非虚拟机设备,请求接口
|
|
152
153
|
if (!isVirtualDevice) {
|
|
153
|
-
var _microphoneStorage$da, _intercomStorage$data, _resolutionStorage$da, _maxZoomSettingsStora;
|
|
154
|
+
var _microphoneStorage$da, _intercomStorage$data, _resolutionStorage$da, _maxZoomSettingsStora, _p2pBizCmdStorage$dat;
|
|
154
155
|
const rtcInfo = await getIpcConfigInfo(deviceId);
|
|
155
156
|
ipcTTTOperatorLog(`Utils: rtcInfo: ${rtcInfo}`);
|
|
156
157
|
if (rtcInfo.code === 0) {
|
|
@@ -200,6 +201,12 @@ export const getCameraConfigInfo = async function (deviceId) {
|
|
|
200
201
|
|
|
201
202
|
// 4. 最大倍数模块
|
|
202
203
|
maxZoomSettings = (rtcApiResult === null || rtcApiResult === void 0 ? void 0 : rtcApiResult.maxZoomInTimes) !== 0 ? rtcApiResult === null || rtcApiResult === void 0 ? void 0 : rtcApiResult.maxZoomInTimes : 6;
|
|
204
|
+
// 5. p2pBizCmd 配置
|
|
205
|
+
const skillObj = typeof (rtcApiResult === null || rtcApiResult === void 0 ? void 0 : rtcApiResult.skill) === 'string' ? JsonUtil.parseJSON(rtcApiResult.skill) : rtcApiResult === null || rtcApiResult === void 0 ? void 0 : rtcApiResult.skill;
|
|
206
|
+
const parsedValue = Number((skillObj === null || skillObj === void 0 ? void 0 : skillObj.p2pBizCmd) || 0);
|
|
207
|
+
if (Number.isFinite(parsedValue)) {
|
|
208
|
+
p2pBizCmdNumber = parsedValue;
|
|
209
|
+
}
|
|
203
210
|
}
|
|
204
211
|
|
|
205
212
|
// 由于utils为统一返回,多加了一层data,所以需要取data.data
|
|
@@ -225,6 +232,11 @@ export const getCameraConfigInfo = async function (deviceId) {
|
|
|
225
232
|
if (!maxZoomSettingsStorageData) {
|
|
226
233
|
setNativeStorage(`${deviceId}_maxZoomSettings`, maxZoomSettings);
|
|
227
234
|
}
|
|
235
|
+
// 5. 设置 p2pBizCmd 缓存
|
|
236
|
+
const p2pBizCmdStorageData = p2pBizCmdStorage === null || p2pBizCmdStorage === void 0 || (_p2pBizCmdStorage$dat = p2pBizCmdStorage.data) === null || _p2pBizCmdStorage$dat === void 0 ? void 0 : _p2pBizCmdStorage$dat.data;
|
|
237
|
+
if (!p2pBizCmdStorageData && typeof p2pBizCmdNumber === 'number') {
|
|
238
|
+
setNativeStorage(`${deviceId}_p2pBizCmd`, p2pBizCmdNumber);
|
|
239
|
+
}
|
|
228
240
|
} else {
|
|
229
241
|
// 针对虚拟设备未有数据时设置缓存
|
|
230
242
|
setNativeStorage(`${deviceId}_microphone`, microphoneSettings);
|
|
@@ -241,9 +253,10 @@ export const getCameraConfigInfo = async function (deviceId) {
|
|
|
241
253
|
setNativeStorage(`${deviceId}_intercom`, intercomInfo);
|
|
242
254
|
setNativeStorage(`${deviceId}_resolution`, videoResolution);
|
|
243
255
|
setNativeStorage(`${deviceId}_maxZoomSettings`, maxZoomSettings);
|
|
256
|
+
setNativeStorage(`${deviceId}_p2pBizCmd`, p2pBizCmdNumber);
|
|
244
257
|
}
|
|
245
258
|
} else {
|
|
246
|
-
var _intercomStorage$data2, _resolutionStorage$da2, _microphoneStorage$da2, _maxZoomSettingsStora2;
|
|
259
|
+
var _intercomStorage$data2, _resolutionStorage$da2, _microphoneStorage$da2, _maxZoomSettingsStora2, _p2pBizCmdNumberStora;
|
|
247
260
|
// 都有缓存的情况下,直接返回取缓存
|
|
248
261
|
// 对于对讲缓存的方式每次需从APP获取更新
|
|
249
262
|
const intercomStorageData = intercomStorage === null || intercomStorage === void 0 || (_intercomStorage$data2 = intercomStorage.data) === null || _intercomStorage$data2 === void 0 ? void 0 : _intercomStorage$data2.data;
|
|
@@ -264,12 +277,14 @@ export const getCameraConfigInfo = async function (deviceId) {
|
|
|
264
277
|
videoResolution = resolutionStorage === null || resolutionStorage === void 0 || (_resolutionStorage$da2 = resolutionStorage.data) === null || _resolutionStorage$da2 === void 0 ? void 0 : _resolutionStorage$da2.data;
|
|
265
278
|
microphoneSettings = microphoneStorage === null || microphoneStorage === void 0 || (_microphoneStorage$da2 = microphoneStorage.data) === null || _microphoneStorage$da2 === void 0 ? void 0 : _microphoneStorage$da2.data;
|
|
266
279
|
maxZoomSettings = maxZoomSettingsStorage === null || maxZoomSettingsStorage === void 0 || (_maxZoomSettingsStora2 = maxZoomSettingsStorage.data) === null || _maxZoomSettingsStora2 === void 0 ? void 0 : _maxZoomSettingsStora2.data;
|
|
280
|
+
p2pBizCmdNumber = p2pBizCmdNumberStorage === null || p2pBizCmdNumberStorage === void 0 || (_p2pBizCmdNumberStora = p2pBizCmdNumberStorage.data) === null || _p2pBizCmdNumberStora === void 0 ? void 0 : _p2pBizCmdNumberStora.data;
|
|
267
281
|
}
|
|
268
282
|
const ipcConfig = {
|
|
269
283
|
videoResolution,
|
|
270
284
|
intercomInfo,
|
|
271
285
|
microphoneSettings,
|
|
272
|
-
maxZoomSettings
|
|
286
|
+
maxZoomSettings,
|
|
287
|
+
p2pBizCmd: Number(p2pBizCmdNumber)
|
|
273
288
|
};
|
|
274
289
|
return Promise.resolve({
|
|
275
290
|
code: 0,
|