getAppleAudioConfigurationForMode static method

AppleAudioConfiguration getAppleAudioConfigurationForMode(
  1. AppleAudioIOMode mode, {
  2. bool preferSpeakerOutput = false,
})

Implementation

static AppleAudioConfiguration getAppleAudioConfigurationForMode(
    AppleAudioIOMode mode,
    {bool preferSpeakerOutput = false}) {
  currentMode = mode;
  if (mode == AppleAudioIOMode.remoteOnly) {
    return AppleAudioConfiguration(
      appleAudioCategory: AppleAudioCategory.playback,
      appleAudioCategoryOptions: {
        AppleAudioCategoryOption.mixWithOthers,
      },
      appleAudioMode: AppleAudioMode.spokenAudio,
    );
  } else if ([
    AppleAudioIOMode.localOnly,
    AppleAudioIOMode.localAndRemote,
  ].contains(mode)) {
    return AppleAudioConfiguration(
      appleAudioCategory: AppleAudioCategory.playAndRecord,
      appleAudioCategoryOptions: {
        AppleAudioCategoryOption.allowBluetooth,
        AppleAudioCategoryOption.mixWithOthers,
      },
      appleAudioMode: preferSpeakerOutput
          ? AppleAudioMode.videoChat
          : AppleAudioMode.voiceChat,
    );
  }

  return AppleAudioConfiguration(
    appleAudioCategory: AppleAudioCategory.soloAmbient,
    appleAudioCategoryOptions: {},
    appleAudioMode: AppleAudioMode.default_,
  );
}