ios - 如何在中间停止 AVSpeechSynthesizer 播放?

标签 ios iphone ios7 text-to-speech avspeechsynthesizer

我在我的应用程序中使用 AVSpeechSynthesizer 进行文本转语音。是否可以在中间停止播放,例如如果用户点击停止按钮?

最佳答案

查看 Documentation for AVSpeechSynthesizer ,你需要调用 -[AVSpeechSynthesizer pauseSpeakingAtBoundary:] 停止说话,然后 -[AVSpeechSynthesizer continueSpeaking] 继续说话。

您可以选择立即暂停说话 (AVSpeechBoundaryImmediate),或者在当前单词结束时暂停 (AVSpeechBoundaryWord)。

关于ios - 如何在中间停止 AVSpeechSynthesizer 播放?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20064368/

相关文章:

iOS - 如何更改选项卡栏中图标的颜色更多 ViewController

c# - WCF GET 方法未获取 iOS 客户端的最新数据

ios - 我想放置具有不同标签文本颜色的选框标签

ios - RxSwift - 表格 View 中的文本字段变量绑定(bind)

ios - 实时人脸检测不起作用

iphone - iOS 7 错误警告 : Attempt to dismiss from view controller <UINavigationController: 0x1568db40> while a presentation or dismiss is in progress

ios - 清理 Documents 文件夹中的 .txt

iphone - 将自定义方法添加到单独文件中的 Core Data 托管对象的方法是什么?

iphone - 如何从我的各种 View Controller 访问存储在我的应用程序委托(delegate)中的数据?

iphone - 在 View Controller ios 7 之间传递数据