我遇到了以下问题:每当我在应用程序中为音频会话设置播放和录制类别时,AirPlay就变得不可用:
[[AVAudioSession sharedInstance]
setCategory: AVAudioSessionCategoryPlayAndRecord
error: &setCategoryError];此调用使AirPlay消失,并立即将音频重新路由到扬声器。
这个问题可以很容易地重现,例如,在Xcode文档中的示例项目avTouch上,将AVAudioSessionCategoryPlayback类别替换为AVAudioSessionCategoryPlayAndRecord:在原始示例中,AirPlay选择器可见,并允许更改输出源,而使用AVAudioSessionCategoryPlayAndRecord类别时,选择器消失。
有没有合适的方法切换到AVAudioSessionCategoryPlayAndRecord类别,使AirPlay仍然可用?
(像这样的问题已经被already asked了,但没有得到任何答案。)
发布于 2013-10-11 04:50:31
您尝试使用的AirPlay设备是什么?它有麦克风吗?
如果没有,iOS在使用PlayAndRecord类别时不会将其显示为一个选项,因为该设备无法播放和录制。不过,当使用Play类别时,它会显示出来。
另外,如果您使用的设备是蓝牙设备,您是否已将AVAudioSessionCategoryOptionAllowBluetooth设置为YES?
发布于 2013-03-01 19:52:09
我认为你应该将下面的代码添加到AVAudioSession之上。我希望它能起作用。
NSError *setCategoryError = nil;
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error: &setCategoryError];
if (setCategoryError) {
// Handle error
}发布于 2012-11-06 03:41:02
好吧,AirPlay和PlayAndRecord类别是不兼容的。这就是我在苹果论坛上学到的。
为什么当音频输出发生在其他地方时,您还需要设备上的音频输入?
https://stackoverflow.com/questions/13138197
复制相似问题