1.登陆微信公众平台,侧边栏设置-----第三方设置-----插件管理----添加插件(搜索–同声传译)
2.引用插件
"plugins": { "WechatSI": { "version": "0.3.5", "provider": "wx069ba97219f66d99" } }
3.使用
let plugin = requirePlugin("WechatSI"); let manager = plugin.getRecordRecognitionManager(); skvido(){ let _this=this; plugin.textToSpeech({ lang: "zh_CN", tts: true, content: '成功收款200', success: function(res) { // console.log("succ tts", res.filename) let music = null; music = uni.createInnerAudioContext(); //创建播放器对象 music.src = res.filename; music.play(); //执行播放 music.onEnded(() => { //播放结束 music = null; }); }, fail: function(res) { // console.log("fail tts", res) } }) },
来源:https://blog.csdn.net/qq_42958772/article/details/119868914