How to detect possible audio outputs in iOS? - ios

Is it possible to detect audio outputs like airpods, regular headphones or remote speakers connected to the device and get their properties?
Thanks!

No. Only currentRoute is available through the public API.

Related

Routing audio to both built-in speaker and bluetooth headset simultaneously in iOS

I'm simulating an incoming call notification by playing an audio file through AVAudioPlayer. I wish to play the audio to both built-in speaker and connected bluetooth headset simultaneously.
I tried using AVAudioSessionCategoryMultiRoute and AVAudioSessionCategoryPlayAndRecord with AllowBluetooth category option selected.
For AVAudioSessionCategoryMultiRoute, it is not able to detect the bluetooth device in available outputs.
For AVAudioSessionCategoryPlayAndRecord, audio is routed to either bluetooth or speaker depending on the category option passed in while setting up the audio session category.
Is it possible to route the audio to both built-in speaker and bluetooth device simultaneously using AVAudioSession API? Any code snippets, if available?
Looking at the documentation of AVAudioSessionCategoryMultiRoute it states that (emphasis added by me)
The category for routing distinct streams of audio data to different output devices at the same time.
Meaning that you can only output different audio streams to different output channels. You cannot output the same audio stream to several channels.
As far as I'm concerned, there are no other methods to achieve playing the same audio stream on several channels either.

How to switch off audio output ios?

Is it possible to switch off audio output on device?
I need route the sound to phone's speaker when headphones are connected.
I need to connect some device via audio output(like connect headphones) but if i connected it the voice on ios device is blocked. I want turn off audio output and turn on when i need use this device.
This goes against Apple's Human Interface Guidelines. If you read the section on Technology usage you find a section labelled Sound. It describes the expected behaviour when using headphones:
http://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/MobileHIG/TechnologyUsage/TechnologyUsage.html#//apple_ref/doc/uid/TP40006556-CH18-SW3
I don't think so you can do this. Because apple is very strict and stick with their functionality.

Intercom with Bluetooth headset

I've been researching the ability to create a bi-directional audio link between iOS and a bluetooth audio headset.
What I need to be able to do is:
When the user speaks into the microphone on the iOS device, that audio should be redirected to the audio out of the headset, the piece.
When the microphone of the headset picks up audio, that should come out the speaker of the iOS device.
In my searching I've found that you can:
Enable bluetooth audio input and output:
how to route iPhone audio to the bluetooth headset
Redirect input to speaker:
Mic input to the speaker output on an iOS device?
After reading this:
AudioSession input from bluetooth output to line out or speaker
I'm thinking what I want to do cannot be done.
So before I get to testing, does anyone know if what I'm trying to do is even possible. From the last link it appears you can only have one input and output pair at a time. What I'm trying to do would require two pairs of input and output. In from BT, out to iOS speaker. In from iOS Mic, out to BT.
Thank you!
The current public iOS Audio Session APIs appear to only support a single audio route pair (input+output).

iOS HSP turn off Audio output

I would like to be able to control a bluetooth headset from an iOS device and turn off the audio output, effectively only making it a bluetooth microphone. I am using the HSP headset profile.
Possible?
Pointers?
Not possible
BTW where do you want the output to be routed ? on the phone speaker ?

Blackberry How to play sound (short[]) using the speaker of the device?

I am using Alert.startAudio to play an array of short values,
I want the same short[] to be played using the phone speaker, how could I do this ?
I believe it is played with speaker by default!
But if it's not, try to use AudioPathControl
See BB KB How To - Specify Audio Path Routing
UPDATE
BB Developer Journals - The BlackBerry Alert Class:
The next two methods will start and stop an audio alert on the audio channel selected by the user. An audio channel can be the internal headset, speaker, earpiece or a Bluetooth® headset.
maybe this should be configured somewhere in device...

Resources