如何在iOS6中支持后台AirPlay?

5
我的应用程序应该通过Airplay将视频流传输到AppleTV,即使应用程序在后台运行。在iOS5下它工作得很完美,在iOS6下不行了。Xcode在这行代码上给了我一个弃用警告:
moviePlayerViewController.moviePlayer.useApplicationAudioSession = NO;

这是我应用程序不再正常运行的原因吗?在iOS6中,这段代码的等效代码是什么?

2个回答

10

找到了解决方案:可以通过设置正确的AVAudioSessionCategory来解决这个问题。

NSError *setCategoryError = nil;
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error: &setCategoryError];

@Murze,AVAudioSession 是什么? - iPatel
1
@iPatel:#import“AVFoundation / AVAudioSession.h” - JLundell

1

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接