ios - 后台模式下的 AVSpeechSynthesizer

标签 ios objective-c ios7 avfoundation

当我的 iOS 应用程序处于后台模式时,我无法让 iOS 7 AVSpeechSynthesizer 工作。我已将“App plays audio”键添加到应用程序支持的后台模式,但我仍然无法让它工作。

我还研究了创建 AVMutableCompositionTrack 的可能性,其中包含 AVSpeechSynthesizer 话语,然后以某种方式与能够在后台运行的播放器一起播放- 但没有运气。

在后台使用 AVSpeechSynthesizer 有没有人比我运气好?

最佳答案

  1. 您必须在后台模式中设置“音频和 AirPlay”。
  2. 您必须配置 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/

相关文章:

ios - 即使使用AVAudioTimePitchAlgorithmSpectral,使用AVPlayer慢速播放的音质也不够好

ios - 如何复制 ios 版本的 iPhone?

ios - 如何在 Alamofire 4 和 Swift 3 中使用代理服务器

objective-c - Swift 中的外部变量

ios - 怎么会这样“self.canDisplayBannerAds = YES;”使应用程序在iOS 8上崩溃?

objective-c - 如何让 NSTextView 随文本一起增长?

ios - cellForItemAtIndexPath 在强制滚动以使其可见后返回 nil

ios - IOS7 上的 Tableview 字幕

iphone - 从后台删除我的应用程序或删除沙箱时如何引发事件?

iphone - NSURL 到 NSString