当我的 iOS 应用程序处于后台模式时,我无法让 iOS 7 AVSpeechSynthesizer
工作。我已将“App plays audio”键添加到应用程序支持的后台模式,但我仍然无法让它工作。
我还研究了创建 AVMutableCompositionTrack
的可能性,其中包含 AVSpeechSynthesizer
话语,然后以某种方式与能够在后台运行的播放器一起播放- 但没有运气。
在后台使用 AVSpeechSynthesizer
有没有人比我运气好?
最佳答案
- 您必须在后台模式中设置“音频和 AirPlay”。
- 您必须配置 Audio Session :
NSError *error = NULL;
AVAudioSession *session = [AVAudioSession sharedInstance];
[session setCategory:AVAudioSessionCategoryPlayback error:&error];
if(error) {
// Do some error handling
}
[session setActive:YES error:&error];
if (error) {
// Do some error handling
}
关于ios - 后台模式下的 AVSpeechSynthesizer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19183591/