Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to list available audio output route on iOS

Tags:

ios

routes

audio

Now i'd like to list available audio output route in my iPhone app, something like this:

http://www.blogcdn.com/www.tuaw.com/media/2008/09/cb(iphone-101_-switch-between-audio-outputs-for-your-voicemail)1729387198273.jpg

i know that i can use audioRouteChangeListener of audio session to get route change info, but this method only can get the message after my app launch, so if headset and bluetooth both are connected before my app run, how can i get these routes' messages, any tips are appreciated.

Thanks.

like image 202
Asnor Avatar asked Nov 03 '22 16:11

Asnor


1 Answers

I got something working using MPVolumeView . This component has a button that lets you choose the output audio route, like in the Music App.

If you want you can hide the slider (and have only the button) using:

self.myMPVolumeView.showsVolumeSlider = NO;

At the moment I cannot find a way to obtain the output destinations and input sources programmatically as I pointed out in this question List available output audio target AVAudioSession

like image 61
lucianoenrico Avatar answered Nov 14 '22 13:11

lucianoenrico