agora-appbuilder-core 4.0.0-spl.17 → 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.17",
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": [
@@ -233,6 +233,9 @@ export default class RtcEngine {
233
233
 
234
234
  async enableAudio(): Promise<void> {
235
235
  const audioConfig: MicrophoneAudioTrackInitConfig = {
236
+ encoderConfig: $config.AUDIO_ENCODER_CONFIG_PRESET
237
+ ? $config.AUDIO_ENCODER_CONFIG_PRESET
238
+ : undefined,
236
239
  bypassWebAudio: Platform.OS == 'web' && isMobileOrTablet(),
237
240
  // microphoneId: this.audioDeviceId,
238
241
  };
@@ -266,6 +269,9 @@ export default class RtcEngine {
266
269
  const audioConfig: MicrophoneAudioTrackInitConfig = {
267
270
  bypassWebAudio: Platform.OS == 'web' && isMobileOrTablet(),
268
271
  microphoneId: preferredMicrophoneId,
272
+ encoderConfig: $config.AUDIO_ENCODER_CONFIG_PRESET
273
+ ? $config.AUDIO_ENCODER_CONFIG_PRESET
274
+ : undefined,
269
275
  };
270
276
  const videoConfig: CameraVideoTrackInitConfig = {
271
277
  encoderConfig: this.videoProfile,
@@ -316,7 +322,32 @@ export default class RtcEngine {
316
322
  localVideo = await AgoraRTC.createCameraVideoTrack(videoConfig);
317
323
  } catch (e) {
318
324
  videoConfig.cameraId = '';
319
- 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
+ }
320
351
  }
321
352
  this.localStream.video = localVideo;
322
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