使用 MT-TTS离线语音合成 - DCloud 插件市场 插件MT-TTS离线语音合成
方法:
const SpeechTTS = uni.requireNativePlugin("MT-TTS-Speech");//引入包
//页面load方法加载
onLoad() { /* tts语言设置为谷歌的 */
SpeechTTS.setEngine('com.google.android.tts');
SpeechTTS.init((callback) => {
console.log('>> tts: init success');
});}
//页面卸载方法
onUnload() {
SpeechTTS.destroy();}
//方法内调用,在text里面调用需要提示的代码
SpeechTTS.speak({
text: '请点击扫码选项,进行扫码'
});
谷歌tts语音安装包下载
链接:https://pan.baidu.com/s/1VDH4NcJUZ5NdV-j-HVaGjg?pwd=ttss
提取码:ttss
--来自百度网盘超级会员V6的分享