如何列出iOS上可用的音频输出路径 [英] How to list available audio output route on iOS
问题描述
现在,我想在我的iPhone应用程序列出可用的音频输出路线,这样的事情:
Now i'd like to list available audio output route in my iPhone app, something like this:
<一个href=\"http://www.blogcdn.com/www.tuaw.com/media/2008/09/cb(iphone-101_-switch-between-audio-outputs-for-your-voicemail)1729387198273.jpg\" rel=\"nofollow\">http://www.blogcdn.com/www.tuaw.com/media/2008/09/cb(iphone-101_-switch-between-audio-outputs-for-your-voicemail)1729387198273.jpg
我知道我可以使用audioRouteChangeListener音频会话来获取路由变化的信息,但这种方法只能我的应用程序启动后,得到的消息,因此,如果耳机和蓝牙两种我的应用程序运行前连接,我怎么能得到这些路线的消息,任何的提示是AP preciated。
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.
感谢。
推荐答案
我得到的东西用MPVolumeView工作。该组件有一个按钮,让您选择输出音频路线,就像在音乐应用程序。
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;
目前,我无法找到一个方法来获得输出目的地和输入源编程,因为我在这个问题<一指出, href=\"http://stackoverflow.com/questions/15643516/list-available-output-audio-target-avaudiosession\">List可输出音频目标AVAudioSession
这篇关于如何列出iOS上可用的音频输出路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!