Overriding Audio Record Settings Fails

Please provide the following:

  1. SDK Version: 6.14.11
  2. Platforms(Android/iOS/web/all): Android
  3. expo-av

I have an app that records audio like this:

  const audioRecording = new Audio.Recording();
  await audioRecording.prepareToRecordAsync(Audio.RECORDING_OPTIONS_PRESET_HIGH_QUALITY);

But if I replace the constant with a object that’s a duplicate of the high quality preset, it reverts to 3GP recording.

  const recordingSettings = {
    android: {
      extension: '.m4a',
      outputFormat: RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_MPEG_4,
      audioEncoder: RECORDING_OPTION_ANDROID_AUDIO_ENCODER_AAC,
      sampleRate: 44100,
      numberOfChannels: 2,
      bitRate: 128000,
    },
    ios: {
      extension: '.caf',
      audioQuality: RECORDING_OPTION_IOS_AUDIO_QUALITY_MAX,
      sampleRate: 44100,
      numberOfChannels: 2,
      bitRate: 128000,
      linearPCMBitDepth: 16,
      linearPCMIsBigEndian: false,
      linearPCMIsFloat: false,
    },
  };
  const audioRecording = new Audio.Recording();
  await audioRecording.prepareToRecordAsync(recordingSettings);

I am making no other change to the code, so I’m perplexed how this is even happening, but I’ve tested it several different ways. There seems to be no way to override the audio settings, even with what are presumably the same values.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.