gpt4 book ai didi

ios - 后台模式下的 AVSpeechSynthesizer

转载 作者:IT王子 更新时间:2023-10-29 08:13:44 25 4
gpt4 key购买 nike

当我的 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/

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