即使连接了 HDMI 配件,是否也可以强制 AVAudioSession 输出到耳机插孔?

发布于 2024-12-12 02:56:52 字数 1264 浏览 0 评论 0原文

即使连接了 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.

问题:

  1. 该属性是否旨在让我强制输出路由?
  2. 文档提到了 USB 音频配件。当未连接任何配件或连接 HDMI 电缆时,此功能是否有效?
  3. 是否有任何示例代码显示如何正确设置此属性?

谢谢!

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:

  1. Is the property designed to let me force the output route?
  2. The docs mention a USB audio accessory. Will this work when no accessory is connected, or when a HDMI cable is connected?
  3. Is there any sample code showing how to set this property correctly?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文