[英]Is it possible to Redirect audio output to phone speaker or headset in iOS programmatically
[英]iOS 7 Get all the available audio devices (bluetooth, headset, speaker, phone)
期望的功能:
这就像iPhone本机手机应用程序。 当蓝牙/耳机连接到iPhone时,扬声器按钮(通常只有扬声器/电话切换)将显示所有可用的音频输出设备。 默认使用蓝牙。 用户可以选择其他设备播放声音。
问题:
如何检测连接到iPhone的所有可用音频设备?
如何更新路由并将音频输出设置为所选设备?
请注意,使用AudioSessionGetProperty和AudioSessionSetProperty的现有解决方案可能并不理想,因为iOS7不推荐使用这两种方法。
既然没有回应。 我开始基于Jawbone的AudioSessionManager编写自己的库。
关于这两个问题
我仍然找不到获得可用输出的方法。 但是AVAudioSession确实支持来自iOS7的属性availableInputs。
AVAudioSession有一个routeChange通知。 你可以捕捉到不同的路线变化原因并妥善处理。
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(currentRouteChanged :) name:AVAudioSessionRouteChangeNotification object:nil];
完整的实现是在我的github 回购 。 欢迎反馈。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.