AudioSession input from bluetooth output to line out or speaker

帅比萌擦擦* 提交于 2019-12-01 08:21:02

问题


Once an audio session has been set up the following code allows bluetooth input.

UInt32 allowBluetoothInput = 1;
AudioSessionSetProperty (kAudioSessionProperty_OverrideCategoryEnableBluetoothInput, sizeof (allowBluetoothInput), &allowBluetoothInput);

This code looks like it only allows bluetooth input however this code also routes the audio output to the bluetooth device (in the case of a bluetooth headset). I would like to route the audio output out of the line out or speaker when the input is coming from a bluetooth device. I just want to get audio input from a bluetooth device, I do not want to output audio via bluetooth.

Is this behaviour possible?


回答1:


as of iOS 5 this behaviour is not possible, quoting apple technical support

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:

http://developer.apple.com/library/ios/#documentation/mediaplayer/reference/MPVolumeView_Class/Reference/Reference.html

However the MPVolumeView does not allow you to route the input and output independently.



来源:https://stackoverflow.com/questions/8305986/audiosession-input-from-bluetooth-output-to-line-out-or-speaker

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!