一旦设置了 Audio Session ,以下代码将允许蓝牙输入。
UInt32 allowBluetoothInput = 1;
AudioSessionSetProperty (kAudioSessionProperty_OverrideCategoryEnableBluetoothInput, sizeof (allowBluetoothInput), &allowBluetoothInput);
此代码看起来只允许蓝牙输入,但此代码还将音频输出路由到蓝牙设备(在蓝牙耳机的情况下)。当输入来自蓝牙设备时,我想将音频输出路由到线路输出或扬声器之外。我只想从蓝牙设备获取音频输入,我不想通过蓝牙输出音频。
这种行为可能吗?
从 iOS 5 开始,这种行为是不可能的,引用苹果技术支持
Bluetooth devices are not "Jacked In" devices and therefore any other audio routing must be user picked and cannot be changed in code. To do this, you can use the functionality of the MPVolumeView which will have an extra routing widget viewable allowing the user to specify the routing of the output.
There's a older thread on the Core Audio mailing list regarding this functionality but behavior hasn't changed:
http://lists.apple.com/archives/coreaudio-api/2009/Oct/msg00030.html
MPVolumeView reference:
但是 MPVolumeView 不允许您独立路由输入和输出。
关于ios - 从蓝牙输出到线路输出或扬声器的 AudioSession 输入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8305986/
欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) | Powered by Discuz! X3.4 |