agora-appbuilder-core 4.0.0-spl.16 → 4.0.0-spl.18

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agora-appbuilder-core",
3
- "version": "4.0.0-spl.16",
3
+ "version": "4.0.0-spl.18",
4
4
  "description": "React Native template for RTE app builder",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -165,9 +165,18 @@ if ($config.GEO_FENCING) {
165
165
  }
166
166
 
167
167
  if ($config.LOG_ENABLED) {
168
- AgoraRTC.setLogLevel(0);
168
+ if (
169
+ (APPBUILDER_PUBLIC_TARGET === 'wsdk' ||
170
+ APPBUILDER_PUBLIC_TARGET === 'rsdk') &&
171
+ APPBUILDER_PUBLIC_NODE_ENV === 'production'
172
+ ) {
173
+ AgoraRTC.setLogLevel(4);
174
+ } else {
175
+ AgoraRTC.setLogLevel(0);
176
+ }
169
177
  AgoraRTC.enableLogUpload();
170
178
  } else {
179
+ AgoraRTC.setLogLevel(4);
171
180
  AgoraRTC.disableLogUpload();
172
181
  }
173
182
 
@@ -224,6 +233,9 @@ export default class RtcEngine {
224
233
 
225
234
  async enableAudio(): Promise<void> {
226
235
  const audioConfig: MicrophoneAudioTrackInitConfig = {
236
+ encoderConfig: $config.AUDIO_ENCODER_CONFIG_PRESET
237
+ ? $config.AUDIO_ENCODER_CONFIG_PRESET
238
+ : undefined,
227
239
  bypassWebAudio: Platform.OS == 'web' && isMobileOrTablet(),
228
240
  // microphoneId: this.audioDeviceId,
229
241
  };
@@ -257,6 +269,9 @@ export default class RtcEngine {
257
269
  const audioConfig: MicrophoneAudioTrackInitConfig = {
258
270
  bypassWebAudio: Platform.OS == 'web' && isMobileOrTablet(),
259
271
  microphoneId: preferredMicrophoneId,
272
+ encoderConfig: $config.AUDIO_ENCODER_CONFIG_PRESET
273
+ ? $config.AUDIO_ENCODER_CONFIG_PRESET
274
+ : undefined,
260
275
  };
261
276
  const videoConfig: CameraVideoTrackInitConfig = {
262
277
  encoderConfig: this.videoProfile,
@@ -307,7 +322,32 @@ export default class RtcEngine {
307
322
  localVideo = await AgoraRTC.createCameraVideoTrack(videoConfig);
308
323
  } catch (e) {
309
324
  videoConfig.cameraId = '';
310
- localVideo = await AgoraRTC.createCameraVideoTrack(videoConfig);
325
+ try {
326
+ localVideo = await AgoraRTC.createCameraVideoTrack(videoConfig);
327
+ } catch (e) {
328
+ console.log(
329
+ '[RTCEngineBridge]: Provided cameraId and default camera failed, trying other available devices',
330
+ );
331
+ const devices = await navigator.mediaDevices.enumerateDevices();
332
+ for (let device of devices) {
333
+ if (device.kind === 'videoinput') {
334
+ videoConfig.cameraId = device.deviceId;
335
+ try {
336
+ localVideo = await AgoraRTC.createCameraVideoTrack(
337
+ videoConfig,
338
+ );
339
+ break;
340
+ } catch (e) {
341
+ console.log(
342
+ '[RTCEngineBridge]:',
343
+ 'Camera not available with deviceId' + device,
344
+ 'Reason: ',
345
+ e,
346
+ );
347
+ }
348
+ }
349
+ }
350
+ }
311
351
  }
312
352
  this.localStream.video = localVideo;
313
353
  this.videoDeviceId = localVideo
@@ -99,6 +99,7 @@ interface ConfigInterface {
99
99
  TOOLBAR_COLOR: string;
100
100
  ACTIVE_SPEAKER: boolean;
101
101
  TOAST_NOTIFICATIONS: boolean;
102
+ AUDIO_ENCODER_CONFIG_PRESET: string;
102
103
  }
103
104
  declare var $config: ConfigInterface;
104
105
 
@@ -28,10 +28,6 @@ interface AppBuilderReactSdkInterface extends AppBuilderSdkApiInterface {
28
28
  View: React.FC;
29
29
  }
30
30
 
31
- if (APPBUILDER_PUBLIC_NODE_ENV === 'production') {
32
- AgoraRTC.setLogLevel(4);
33
- }
34
-
35
31
  const AppBuilderReactSdkApi: AppBuilderReactSdkInterface = {
36
32
  ...AppBuilderSdkApi,
37
33
  View: SDKAppWrapper,
@@ -10,10 +10,6 @@ import AgoraRTC from 'agora-rtc-sdk-ng';
10
10
  export * from 'customization-api';
11
11
  export * from 'customization-implementation';
12
12
 
13
- if (APPBUILDER_PUBLIC_NODE_ENV === 'production') {
14
- AgoraRTC.setLogLevel(4);
15
- }
16
-
17
13
  const AppBuilderWebSdkApi: AppBuilderSdkApiInterface = AppBuilderSdkApi;
18
14
 
19
15
  // init code