[英]How to stop StreamPlayer of IBM Watson text-to-speech
我正在尝试使用IBM Watson文本到语音在Android应用程序上将文本转换为音频输出。 这是我的依赖
compile 'com.ibm.watson.developer_cloud:java-sdk:3.5.3'
compile 'com.ibm.watson.developer_cloud:android-sdk:0.2.1'
在这里我将字符串转换为音频
new StreamPlayer().playStream(textToSpeechService.synthesize(params[0], Voice.EN_LISA).execute());
问题是当我退出播放音频的活动时,音频会继续播放,而我希望停止播放。
如果使用android.speech.tts.TextToSpeech
我可以轻松使用TextToSpeech.stop()
但如何使用IBM Watson文本转语音功能呢?
当我问这个问题时,功能还不存在,所以我创建了github问题https://github.com/watson-developer-cloud/android-sdk/issues/21 ,他们创建了一个拉取请求来解决问题。 现在我们可以使用
streamPlayer.interrupt();
停止StreamPlayer
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.