let options: AVAudioSession.CategoryOptions = [.mixWithOthers, .allowBluetoothA2DP, .allowBluetooth]
try session.setCategory(.playAndRecord, mode: .default, options: options)
try session.setActive(true)
if let inputs = session.availableInputs {
for input in inputs {
if input.portType == .bluetoothHFP {
do {
try session.setPreferredInput(input)
} catch {
print(error)
}
}
}
}
I set audio session's input to BluetoothHFP for playing and recording music with Bluetooth mic.
After changing the input, there is no sound even after restarting the player.
I set audio session's input to BluetoothHFP for playing and recording music with Bluetooth mic. After changing the input, there is no sound even after restarting the player.