Contents

bluetoothHighQualityRecording

An option that indicates to enable high-quality audio for input and output routes.

Declaration

static var bluetoothHighQualityRecording: AVAudioSession.CategoryOptions { get }

Discussion

Specifying this option enables full-bandwidth audio when the Bluetooth route supports it, such as on certain AirPods models. You can combine it with the allowBluetoothHFP option, which the audio session uses as a fallback when the audio route doesn’t support the feature. You can request high-quality recording only when using the default audio session mode.

To determine whether a Bluetooth input port supports high-quality recording, access its bluetoothMicrophoneExtension and query the extension’s highQualityRecording capability like shown below:

let audioSession = AVAudioSession.sharedInstance()
// Get the input port description for the current route.
guard let inputPort = audioSession.currentRoute.inputs.first else { return }
// Access the Bluetooth microphone extension, if it exists.
guard let micExtension = inputPort.bluetoothMicrophoneExtension else { return }
// Query the extension's high-quality recording capability.
if micExtension.highQualityRecording.isSupported {
    // The Bluetooth input supports high-quality recording.
}

Similarly, you can query the high-quality recording capability’s isEnabled property to determine whether this feature is in an enabled state for the active session.

If your app uses high-quality recording, consider setting setPrefersNoInterruptionsFromSystemAlerts(_:) while recording, to avoid the recording session being interrupted by an incoming call ringtone.

See Also

Category options