AVSpeechSynthesizer在后台模式下

编程入门 行业动态 更新时间:2024-10-25 06:33:17
本文介绍了AVSpeechSynthesizer在后台模式下的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

当我的iOS应用处于后台模式时,我无法使iOS 7 AVSpeechSynthesizer 正常工作。我已将 App播放音频键添加到应用程序支持的后台模式,但我仍无法使其正常工作。

I can't get the iOS 7 AVSpeechSynthesizer to work when my iOS app is in background mode. I have added the "App plays audio" key to the app's supported background modes, but I still can't get it to work.

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

I have also investigated the possibility of creating an AVMutableCompositionTrack, with an AVSpeechSynthesizer utterance, and then somehow play it with a player that would be able to run in the background - but with no luck.

在使用 AVSpeechSynthesizer 在后台吗?

推荐答案

  • 您必须在后台模式中设置Audio and AirPlay 。
  • 您必须配置音频会话:
  • 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 }

    更多推荐

    AVSpeechSynthesizer在后台模式下

    本文发布于:2023-11-27 10:11:09,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1637643.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:后台   模式下   AVSpeechSynthesizer

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!