Jas*_*son 2 iphone text-to-speech ios ios7 avspeechsynthesizer
我在我的应用程序中使用AVSpeechSynthesizer进行文本到语音转换.是否可以在中间停止播放,例如,如果用户点击停止按钮?
zad*_*adr 11
查看AVSpeechSynthesizer的文档,您需要打电话-[AVSpeechSynthesizer pauseSpeakingAtBoundary:]
停止说话,然后再-[AVSpeechSynthesizer continueSpeaking]
继续说话.
您可以选择立即暂停说话(AVSpeechBoundaryImmediate
),或者在当前单词(AVSpeechBoundaryWord
)的末尾.
迅速:
synthesizer.stopSpeaking(at: .immediate)
Run Code Online (Sandbox Code Playgroud)
或者
synthesizer.stopSpeaking(at: .word)
Run Code Online (Sandbox Code Playgroud)