iOS版:使用蓝牙音频输出(kAudioSessionProperty_OverrideCategoryEnableBluetoothInput)AudioSession [英] iOS: Using Bluetooth audio output (kAudioSessionProperty_OverrideCategoryEnableBluetoothInput) AudioSession

查看:3144
本文介绍了iOS版:使用蓝牙音频输出(kAudioSessionProperty_OverrideCategoryEnableBluetoothInput)AudioSession的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个问题涉及到多个蓝牙任务CoreAudio的AudioSession框架,我希望有人能帮助我处理这些问题,或至少可以证实我的最新调查结果。该用例是想与支持,HFP和A2DP蓝牙无线连接导航应用。我已阅读了整个AudioSession编程指南,但我必须特别是通过使用蓝牙音频输出还存在一些悬而未决的问题。

I have several questions to the CoreAudio AudioSession framework related to several Bluetooth tasks and I hope someone can help me with these issues or at least can confirm my latest findings. The usecase is a navigation app that wants to connect with a bluetooth enabled radio which supports both, HFP and A2DP. I have read the whole AudioSession Programming Guidelines but I have still some open issues especially using audio output through Bluetooth.


  1. 在AudioSession kAudioSessionCategory_PlayAndRecord的情况下,设置和你将覆盖以下属性蓝牙HFP音频输出(kAudioSessionOutputRoute_BluetoothHFP)是唯一可能:kAudioSessionProperty_OverrideCategoryEnableBluetoothInput。这是真的?如果不是,我怎么可以路由作为同届的MediaPlayback向kAudioSessionOutputRoute_BluetoothHFP路线的例子。

  1. Bluetooth HFP audio output (kAudioSessionOutputRoute_BluetoothHFP) is only possible in case of AudioSession kAudioSessionCategory_PlayAndRecord is set and you are overriding the following property: kAudioSessionProperty_OverrideCategoryEnableBluetoothInput. Is this true? If not, how I can route as an example with the MediaPlayback session to kAudioSessionOutputRoute_BluetoothHFP route.

在后台模式音频输出是不可能的类别kAudioSessionCategory_PlayAndRecord。因此,如果我在后台我无法通过蓝牙HFP航线播放声音。这是真的?有没有办法如何通过蓝牙HFP协议发送音频,如果应用程序在后台?

Audio output in background mode is not possible with the category kAudioSessionCategory_PlayAndRecord. Therefore I can not play sound through an bluetooth HFP route if I am in background. Is this true? Is there a way how to send audio through the Bluetooth HFP protocol if app is in the background?

如果有一个支持A2DP功能设备可用的我的音频路由将总是自动切换到kAudioSessionOutputRoute_BluetoothA2DP路由。我怎样才能prevent这条路线的变化?此外,我怎么可以指定输出的路线我想拥有的时刻。随着iOS5中,可以通过kAudioSessionProperty_AudioRouteDescription标志查询所有这些航线的目的地,但我不知道我怎么可以将其设置为我想拥有它。是否有可能以某种方式实现这一目标?

If there is an A2DP enabled device available my audio route will always switch automatically to the kAudioSessionOutputRoute_BluetoothA2DP route. How can I prevent this route change? In addition how can I specify the output route I wanna have at the moment. With iOS5 it is possible to query all those route destination through the kAudioSessionProperty_AudioRouteDescription flag, but I have no idea how I can set it as I wanna have it. Is it somehow possible to achieve this?

我希望你们中的一些可以帮助我这些问题。这将真正帮助我与我的CoreAudio的的全面了解,尤其是AudioSession框架。

I hope some of you can help me with these questions. It would really help me with my overall understanding of the CoreAudio, especially the AudioSession framework.

推荐答案

AudioSession是件棘手的事。

AudioSession is tricky business.

1.蓝牙HFP音频输出(kAudioSessionOutputRoute_BluetoothHFP)是唯一可能在AudioSession kAudioSessionCategory_PlayAndRecord的情况下,设置和你将覆盖以下属性:kAudioSessionProperty_OverrideCategoryEnableBluetoothInput。这是真的?如果不是,我怎么可以路由作为同届的MediaPlayback向kAudioSessionOutputRoute_BluetoothHFP路线的例子。

1.Bluetooth HFP audio output (kAudioSessionOutputRoute_BluetoothHFP) is only possible in case of AudioSession kAudioSessionCategory_PlayAndRecord is set and you are overriding the following property: kAudioSessionProperty_OverrideCategoryEnableBluetoothInput. Is this true? If not, how I can route as an example with the MediaPlayback session to kAudioSessionOutputRoute_BluetoothHFP route.

如果你有一个蓝牙耳机连接,那么它是真实的。您将需要两个kAudioSessionCategory_PlayAndRecord音频会话集和kAudioSessionProperty_OverrideCategoryEnableBluetoothInput设置有音频播放了蓝牙耳机。 EnableBluetoothInput影响根据这个的输入和输出。还记得,音频将会为8000 Hz起到应有蓝牙输入设备的限制。对于连接,支持A2DP的设备,你可以在音频会话kAudioSessionCategoryMediaPlayback离开它,它会在44100赫兹的采样率播放。

If you have a Bluetooth headset connected, then it is true. You will need both kAudioSessionCategory_PlayAndRecord audio session set and kAudioSessionProperty_OverrideCategoryEnableBluetoothInput set to have audio play out of a Bluetooth headset. EnableBluetoothInput affects both input and output according to this. Also remember, the audio will play at 8000 Hz due to the limitation of bluetooth input devices. For a device that is connected that supports A2DP, you can leave it at audio session kAudioSessionCategoryMediaPlayback and it will play at 44100 Hz sample rate.

2.Audio输出是不可能与类别kAudioSessionCategory_PlayAndRecord。因此,如果我在后台我无法通过蓝牙HFP航线播放声音。这是真的?有没有办法如何通过蓝牙HFP协议发送音频,如果应用程序在后台?

2.Audio output in background mode is not possible with the category kAudioSessionCategory_PlayAndRecord. Therefore I can not play sound through an bluetooth HFP route if I am in background. Is this true? Is there a way how to send audio through the Bluetooth HFP protocol if app is in the background?

播放通过蓝牙HFP音频的背景是可能的,只要你设置你的应用程序的plist背景音效模式键。查看更多<一个href=\"https://developer.apple.com/library/ios/documentation/general/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html\">here.

Playing audio through the bluetooth HFP is possible in the background as long as you have set the background audio mode key in your app plist. See more here.

3,如果有一个的A2DP功能设备可用的我的音频路由将总是自动切换到kAudioSessionOutputRoute_BluetoothA2DP路由。我怎样才能prevent这条路线的变化?此外,我怎么可以指定输出的路线我想拥有的时刻。随着iOS5中,可以通过kAudioSessionProperty_AudioRouteDescription标志查询所有这些航线的目的地,但我不知道我怎么可以将其设置为我想拥有它。是否有可能以某种方式实现这一目标?

3.If there is an A2DP enabled device available my audio route will always switch automatically to the kAudioSessionOutputRoute_BluetoothA2DP route. How can I prevent this route change? In addition how can I specify the output route I wanna have at the moment. With iOS5 it is possible to query all those route destination through the kAudioSessionProperty_AudioRouteDescription flag, but I have no idea how I can set it as I wanna have it. Is it somehow possible to achieve this?

你在哪里所需的音频走呢?你可以尝试音频会话设置为PlayAndRecord保持它去A2DP。这可能是在你的控制,虽然,音频会话将使用其认为是直观的用户。如果他们只是连接了A2DP的设备和您只输出音频时,A2DP设备将被使用。

Where do you want the audio to go instead? You can try to set the audio session to PlayAndRecord to keep it from going to A2DP. This may be out of your control though, Audio Session will use what it deems to be intuitive to the user. If they just connected an A2DP device and you are only outputting audio, the A2DP device will be used.

这篇关于iOS版:使用蓝牙音频输出(kAudioSessionProperty_OverrideCategoryEnableBluetoothInput)AudioSession的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆