- 微信同声传译插件onRecognize方法不执行,已经有很多问答了,辛苦官方回答下吧
initRecord() { console.log(manager); //有新的识别内容返回,则会调用此事件 manager.onRecognize = (res) => { console.log('onRecognize: ', res.result); this.setData({ recordStatus: RECORD_STATUS.ING, activeText: res.result, activeTip: '点击下方停止录音' }); if (recordTimer) { recordTimer = null; } setTimeout(() => { console.log('handle streamRecordEnd'); this.streamRecordEnd(); }, 2000); }; // 识别结束事件 manager.onStop = (res) => { let activeText = res.result; console.log('manager.onStop: ', activeText); if(activeText == '') { activeText = '抱歉,没听清'; activeTip = '点击下方再说一遍吧'; } this.setData({ recordStatus: RECORD_STATUS.NORMAL, activeText, activeTip: '' }); }; // 识别错误事件 manager.onError = (res) => { this.setData({ recordStatus: RECORD_STATUS.NORMAL, activeText: '抱歉,没听清', activeTip: '点击下方重新发起语音搜索' }); } },
2023-10-09 - 微信同声传译onRecognize无法触发
ASRmanager.onRecognize = function(res) { // TODO on recognize 没有看到何时调用过 console.error("ASR recognize: ", res.result) } ASRmanager.onStop = function(res) { console.error("ASR stop: record file path ", res.tempFilePath) } ASRmanager.onStart = function(res) { console.error("ASR start: ", res) } ASRmanager.onError = function(res) { let info = res.msg + '\n错误码:' + res.retcode } onRecognize接口始终无法被调用,其他接口都可以正常使用,想知道这个接口如何使用以及是否还在维护?(预期是希望能一边录一边给出result)
05-21