即使连接了 HDMI 配件,是否也可以强制 AVAudioSession 输出到耳机插孔?
即使连接了 HDMI 适配器,是否也可以强制通过耳机插孔播放音频?
我看到 iOS 5.0 现在有多个音频路由的常量:
const CFStringRef kAudioSessionOutputRoute_LineOut;
const CFStringRef kAudioSessionOutputRoute_Headphones;
const CFStringRef kAudioSessionOutputRoute_BluetoothHFP;
const CFStringRef kAudioSessionOutputRoute_BluetoothA2DP;
const CFStringRef kAudioSessionOutputRoute_BuiltInReceiver;
const CFStringRef kAudioSessionOutputRoute_BuiltInSpeaker;
const CFStringRef kAudioSessionOutputRoute_USBAudio;
const CFStringRef kAudioSessionOutputRoute_HDMI;
const CFStringRef kAudioSessionOutputRoute_AirPlay;
我还看到 iOS 5.0 支持一个名为 kAudioSessionProperty_OutputDestination 的新属性,它是读/写的:
kAudioSessionProperty_OutputDestination
A read/write CFNumberRef object that indicates the audio output destination, from a USB audio accessory attached through the iPad camera connection kit, that you want to use.
The value must be one of the identifiers provided as a kAudioSession_OutputDestinationKey_ID key as part of the kAudioSessionProperty_OutputDestinations array.
Available in iOS 5.0 and later.
问题:
- 该属性是否旨在让我强制输出路由?
- 文档提到了 USB 音频配件。当未连接任何配件或连接 HDMI 电缆时,此功能是否有效?
- 是否有任何示例代码显示如何正确设置此属性?
谢谢!
Is it possible to force audio through the headphone jack even if an HDMI adatper is connected?
I see that iOS 5.0 now has constants for multiple Audio Routes:
const CFStringRef kAudioSessionOutputRoute_LineOut;
const CFStringRef kAudioSessionOutputRoute_Headphones;
const CFStringRef kAudioSessionOutputRoute_BluetoothHFP;
const CFStringRef kAudioSessionOutputRoute_BluetoothA2DP;
const CFStringRef kAudioSessionOutputRoute_BuiltInReceiver;
const CFStringRef kAudioSessionOutputRoute_BuiltInSpeaker;
const CFStringRef kAudioSessionOutputRoute_USBAudio;
const CFStringRef kAudioSessionOutputRoute_HDMI;
const CFStringRef kAudioSessionOutputRoute_AirPlay;
I also see that iOS 5.0 supports a new property called kAudioSessionProperty_OutputDestination that is read/write:
kAudioSessionProperty_OutputDestination
A read/write CFNumberRef object that indicates the audio output destination, from a USB audio accessory attached through the iPad camera connection kit, that you want to use.
The value must be one of the identifiers provided as a kAudioSession_OutputDestinationKey_ID key as part of the kAudioSessionProperty_OutputDestinations array.
Available in iOS 5.0 and later.
Questions:
- Is the property designed to let me force the output route?
- The docs mention a USB audio accessory. Will this work when no accessory is connected, or when a HDMI cable is connected?
- Is there any sample code showing how to set this property correctly?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论