gpt4 book ai didi

ios - 从蓝牙输出到线路输出或扬声器的 AudioSession 输入

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:24:44 24 4
gpt4 key购买 nike

设置 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:

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

但是 MPVolumeView 不允许您独立路由输入和输出。

关于ios - 从蓝牙输出到线路输出或扬声器的 AudioSession 输入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8305986/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com