I need to list the audio outputs available to an iOS application. My question is similar to this one: How to list available audio output route on iOS
i tried this co
It will depend on your AVAudioSession category.
You can safely assume on an iPhone that you have at least a microphone as input and a speaker as output. If you're trying to get a list of Bluetooth/AirPlay outputs, first you'd have to make sure your session category is reporting them to you:
do
{
try audioSession.setCategory(AVAudioSessionCategoryPlayAndRecord, withOptions: .AllowBluetooth)
try audioSession.setActive(true)
}
catch let e
{
debugPrint("failed to initialize audio session: \(e)")
}
Then a non-intuitive way to get available outputs is to check AVAudioSession.availableInputs as usually a bluetooth HFP device would have a mic too.. I might be assuming a lot right now.. but that's the only way to consistently get your availableOutputs.
A better way is to use MultipleRoute category which will give you more freedom at accessing AVAudioSessionPort