在 Android 上文本转语音停止说话后运行代码
我需要运行一些代码,但仅在文本转语音停止说话之后。 我目前延迟了几秒钟,但这并不是真正的动态,这个问题有什么解决方案吗?当声音停止说话时我可以收到通知吗?
I need to run some code but only after the text-to-speech stops talking.
I am currently delaying a few seconds but that is not really dynamic, is there any solution for this problem? Can I get notified when the voice stops talking?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
听起来您需要实现 TextToSpeech.OnUtteranceCompletedListener 接口并将代码设置为在 onUtteranceCompleted() 实现期间运行。
Android 开发者资源中有一个这样的示例:
http://developer.android.com /resources/articles/tts.html
It sounds like you need to implement the TextToSpeech.OnUtteranceCompletedListener interface and set your code to run during the onUtteranceCompleted() implementation.
There is an example of this in the Android Developer resources:
http://developer.android.com/resources/articles/tts.html