同声传译OnStop事件写在app.js里面安卓机授权允许后根本调不起事件,但是iphone又可以?
发布于 6 年前 作者 cwu 13538 次浏览 来自 官方Issues

下面是app.js应用启动事件中写的

//为了解决第一次不能识别的问题

manager.start({

duration: 1, //识别1毫秒

lang: ‘zh_CN’,

});

//语音识别事件

manager.onError = (res) => {

wx.showToast({

title: ‘识别失败’,

icon: ‘success’,

image: ‘/images/shibai.png’,

duration: 1500

});

}

// 识别结束事件

manager.onStop = (res) => {

var text = res.result.replace(’。’, ‘’);

if (text == ‘’) {

// 用户没有说话,可以做一下提示处理…

wx.showToast({

title: ‘请说话’,

icon: ‘success’,

image: ‘/images/no_voice.png’,

duration: 1500

});

return;

}

var pages = getCurrentPages();

pages[pages.length - 1].VoiceRecoEnd({

content: text

});

}

求官方回答

1 回复

麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html

回到顶部