@ray-js/ray-ipc-utils 1.1.0-beta-11 → 1.1.0-beta-13
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/kit/ipc/index.js +2 -0
- package/lib/service/index.js +25 -15
- package/package.json +1 -1
package/lib/kit/ipc/index.js
CHANGED
|
@@ -80,12 +80,14 @@ export const setNativeStorage = (key, data) => {
|
|
|
80
80
|
key,
|
|
81
81
|
data,
|
|
82
82
|
success: res => {
|
|
83
|
+
console.log(res, '______');
|
|
83
84
|
resolve({
|
|
84
85
|
code: 0,
|
|
85
86
|
data: res
|
|
86
87
|
});
|
|
87
88
|
},
|
|
88
89
|
fail: err => {
|
|
90
|
+
console.log(err, '___________');
|
|
89
91
|
resolve({
|
|
90
92
|
code: -1,
|
|
91
93
|
msg: err
|
package/lib/service/index.js
CHANGED
|
@@ -11,7 +11,7 @@ const errStyle = 'background: red; color: #fff;';
|
|
|
11
11
|
|
|
12
12
|
// 获取 IPC 配置信息
|
|
13
13
|
const get_ipc_config_info_api = {
|
|
14
|
-
url: '
|
|
14
|
+
url: 'm.ipc.v4.rtc.config.get',
|
|
15
15
|
version: '1.0'
|
|
16
16
|
};
|
|
17
17
|
// 获取 IPC 收藏点信息
|
|
@@ -147,10 +147,15 @@ export const getCameraConfigInfo = async deviceId => {
|
|
|
147
147
|
})) {
|
|
148
148
|
// 非虚拟机设备,请求接口
|
|
149
149
|
if (!isVirtualDevice) {
|
|
150
|
+
var _microphoneStorage$da, _intercomStorage$data, _resolutionStorage$da, _maxZoomSettingsStora;
|
|
150
151
|
const rtcInfo = await getIpcConfigInfo(deviceId);
|
|
151
152
|
if (rtcInfo.code === 0) {
|
|
152
153
|
var _rtcApiResult$audioAt, _rtcApiResult$audioAt2, _rtcApiResult$audioAt3;
|
|
153
154
|
const rtcApiResult = rtcInfo.data;
|
|
155
|
+
const {
|
|
156
|
+
p2pType
|
|
157
|
+
} = rtcApiResult;
|
|
158
|
+
const p2p4 = p2pType >= 8;
|
|
154
159
|
// 1. 拾音器模块
|
|
155
160
|
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
161
|
// 拾音器默认声音都为关闭, 若接口返回不支持,则将缓存值设置为关闭
|
|
@@ -176,50 +181,55 @@ export const getCameraConfigInfo = async deviceId => {
|
|
|
176
181
|
}
|
|
177
182
|
|
|
178
183
|
// 3. 视频分辨率模块
|
|
179
|
-
videoResolution.defaultResolution = videoResolutionMode[rtcApiResult === null || rtcApiResult === void 0 ? void 0 : rtcApiResult.vedioClarity];
|
|
180
|
-
|
|
181
|
-
const supportedVideoClarity = rtcApiResult === null || rtcApiResult === void 0 ? void 0 : rtcApiResult.vedioClaritys;
|
|
184
|
+
videoResolution.defaultResolution = p2p4 ? videoResolutionMode[rtcApiResult === null || rtcApiResult === void 0 ? void 0 : rtcApiResult.videoClarity] : videoResolutionMode[rtcApiResult === null || rtcApiResult === void 0 ? void 0 : rtcApiResult.vedioClarity];
|
|
185
|
+
const supportedVideoClarity = p2p4 ? rtcApiResult === null || rtcApiResult === void 0 ? void 0 : rtcApiResult.videoClaritys : rtcApiResult === null || rtcApiResult === void 0 ? void 0 : rtcApiResult.vedioClaritys;
|
|
182
186
|
videoResolution.availableResolutions = supportedVideoClarity.map(mode => videoResolutionMode[mode]);
|
|
183
187
|
|
|
184
188
|
// 4. 最大倍数模块
|
|
185
189
|
maxZoomSettings = (rtcApiResult === null || rtcApiResult === void 0 ? void 0 : rtcApiResult.maxZoomInTimes) !== 0 ? rtcApiResult === null || rtcApiResult === void 0 ? void 0 : rtcApiResult.maxZoomInTimes : 6;
|
|
186
190
|
}
|
|
187
|
-
|
|
191
|
+
// 由于utils为统一返回,多加了一层data,所以需要取data.data
|
|
188
192
|
// 1. 设置拾音器缓存
|
|
189
|
-
|
|
193
|
+
const microphoneStorageData = microphoneStorage === null || microphoneStorage === void 0 || (_microphoneStorage$da = microphoneStorage.data) === null || _microphoneStorage$da === void 0 ? void 0 : _microphoneStorage$da.data;
|
|
194
|
+
if (!microphoneStorageData) {
|
|
190
195
|
setNativeStorage(`${deviceId}_microphone`, microphoneSettings);
|
|
191
196
|
}
|
|
192
197
|
// 2. 设置对讲缓存
|
|
193
|
-
|
|
198
|
+
const intercomStorageData = intercomStorage === null || intercomStorage === void 0 || (_intercomStorage$data = intercomStorage.data) === null || _intercomStorage$data === void 0 ? void 0 : _intercomStorage$data.data;
|
|
199
|
+
if (!intercomStorageData) {
|
|
194
200
|
setNativeStorage(`${deviceId}_intercom`, intercomInfo);
|
|
195
201
|
}
|
|
196
202
|
|
|
197
203
|
// 3. 设置视频清晰度缓存
|
|
198
|
-
|
|
204
|
+
const resolutionStorageData = resolutionStorage === null || resolutionStorage === void 0 || (_resolutionStorage$da = resolutionStorage.data) === null || _resolutionStorage$da === void 0 ? void 0 : _resolutionStorage$da.data;
|
|
205
|
+
if (!resolutionStorageData) {
|
|
199
206
|
setNativeStorage(`${deviceId}_resolution`, videoResolution);
|
|
200
207
|
}
|
|
201
208
|
|
|
202
209
|
// 4. 设置最大倍数缓存
|
|
203
|
-
|
|
210
|
+
const maxZoomSettingsStorageData = maxZoomSettingsStorage === null || maxZoomSettingsStorage === void 0 || (_maxZoomSettingsStora = maxZoomSettingsStorage.data) === null || _maxZoomSettingsStora === void 0 ? void 0 : _maxZoomSettingsStora.data;
|
|
211
|
+
if (!maxZoomSettingsStorageData) {
|
|
204
212
|
setNativeStorage(`${deviceId}_maxZoomSettings`, maxZoomSettings);
|
|
205
213
|
}
|
|
206
214
|
}
|
|
207
215
|
} else {
|
|
208
|
-
var _appIntercomCached$da2,
|
|
216
|
+
var _intercomStorage$data2, _appIntercomCached$da2, _resolutionStorage$da2, _microphoneStorage$da2, _maxZoomSettingsStora2;
|
|
209
217
|
// 对于对讲缓存的方式每次需从APP获取更新
|
|
210
|
-
|
|
218
|
+
const intercomStorageData = intercomStorage === null || intercomStorage === void 0 || (_intercomStorage$data2 = intercomStorage.data) === null || _intercomStorage$data2 === void 0 ? void 0 : _intercomStorage$data2.data;
|
|
219
|
+
intercomInfo = intercomStorageData;
|
|
211
220
|
const appIntercomCached = await getCurrentSupportedTalkMode(deviceId);
|
|
212
221
|
if (appIntercomCached.code !== 0) {
|
|
213
222
|
throw appIntercomCached.msg;
|
|
214
223
|
}
|
|
215
224
|
intercomInfo.cachedIntercomMode = intercomCallMode[appIntercomCached === null || appIntercomCached === void 0 || (_appIntercomCached$da2 = appIntercomCached.data) === null || _appIntercomCached$da2 === void 0 ? void 0 : _appIntercomCached$da2.talkbackMode];
|
|
216
|
-
if (
|
|
225
|
+
if (intercomStorageData.cachedIntercomMode !== intercomInfo.cachedIntercomMode) {
|
|
217
226
|
setNativeStorage(`${deviceId}_intercom`, intercomInfo);
|
|
218
227
|
}
|
|
219
|
-
videoResolution = resolutionStorage.data;
|
|
220
|
-
microphoneSettings = microphoneStorage.data;
|
|
221
|
-
maxZoomSettings = maxZoomSettingsStorage.data;
|
|
228
|
+
videoResolution = resolutionStorage === null || resolutionStorage === void 0 || (_resolutionStorage$da2 = resolutionStorage.data) === null || _resolutionStorage$da2 === void 0 ? void 0 : _resolutionStorage$da2.data;
|
|
229
|
+
microphoneSettings = microphoneStorage === null || microphoneStorage === void 0 || (_microphoneStorage$da2 = microphoneStorage.data) === null || _microphoneStorage$da2 === void 0 ? void 0 : _microphoneStorage$da2.data;
|
|
230
|
+
maxZoomSettings = maxZoomSettingsStorage === null || maxZoomSettingsStorage === void 0 || (_maxZoomSettingsStora2 = maxZoomSettingsStorage.data) === null || _maxZoomSettingsStora2 === void 0 ? void 0 : _maxZoomSettingsStora2.data;
|
|
222
231
|
}
|
|
232
|
+
console.log(videoResolution, intercomInfo, microphoneSettings, maxZoomSettings, '_____');
|
|
223
233
|
const ipcConfig = {
|
|
224
234
|
videoResolution,
|
|
225
235
|
intercomInfo,
|