收藏
回答

使用同声传译插件录音时报错

问题类型 插件 AppID 插件版本号 AppID 操作系统 微信版本 基础库版本
Bug wx069ba97219f66d99 0.3.5 wx86a246b292dd42fa Android 8.0.47 3.3.5

调用start方法后报下面错误

backgroundfetch privacy fail {"errno":101,"errMsg":"private_getBackgroundFetchData:fail private_getBackgroundFetchData:fail:jsapi invalid request data"}

//识别语音 -- 初始化 initRecord: function () { const that = this; // 有新的识别内容返回,则会调用此事件 manager.onRecognize = function (res) { console.log(res,'6789765678') } // 正常开始录音识别时会调用此事件 manager.onStart = function (res) { console.log("成功开始录音识别", res) } // 识别错误事件 manager.onError = function (res) { console.error("error msg", res) } //识别结束事件 manager.onStop = function (res) { console.log(res,'99999999999') console.log('..............结束录音') console.log('录音临时文件地址 -->' + res.tempFilePath); console.log('录音总时长 -->' + res.duration + 'ms'); console.log('文件大小 --> ' + res.fileSize + 'B'); console.log('语音内容 --> ' + res.tempFilePath); if (res.tempFilePath == '') { wx.showModal({ title: '提示', content: '听不清楚,请重新说一遍!', showCancel: false, success: function (res) {} }) return; } //var text = that.data.content + res.result; var text = res.result; console.log('语音内容 -->text ' + text); console.log('语音内容 -->that.data.flag ' + that.data.flag); if(that.data.flag == 1){ that.setData({ recordStatus: 1, waiding:0,//等待提示 content: text, inputValue:text, }) that.bindSays(); //that.readAiText(); } } }, //语音 --按住说话 touchStart: function (e) { var flag = Number(e.currentTarget.dataset.flag) console.log("touchStart.e:" , e) let detail = e.detail || {} let buttonItem = detail.buttonItem || {} if (!startOver){ endEnable = false; return; }else{ startOver = false; endEnable = true; } // manager.stop(); startTime = new Date().getTime(); console.log("点击开始:" + startTime) recordState=true; setTimeout(function(){ if (!recordState){ console.log("时间小于0.5秒,认为误点,不进行录音"); startOver = true; return; } console.log("开始录音,调用manager.start()") manager.start({ duration:60000, lang: 'zh_CN',// 识别的语言,目前支持zh_CN en_US zh_HK sichuanhua }); console.log("开始录音,调用manager.start完成") startOver = true; },500) this.setData({ recordStatus: 0, recording: true, waiding:1,//等待提示 waidingMSG: '让我想想..', recordState: true, //录音状态 flag:flag }) // 语音开始识别 //manager.start({ duration: 30000, lang: "zh_CN" }) }, //语音 --松开结束 touchEnd: function (e) { console.log("touchEnd.e:" ,e) let detail = e.detail || {} // 自定义组件触发事件时提供的detail对象 let buttonItem = detail.buttonItem || {} // 防止重复触发stop函数 if(!this.data.recording || this.data.recordStatus != 0) { console.warn("has finished!"); return } // 语音结束识别 manager.stop(); this.setData({ bottomButtonDisabled: true, recordState: false, }) },
回答关注问题邀请回答
收藏

2 个回答

  • 贝壳
    贝壳
    星期五 17:16

    这个问题推到体验版和正式版就不会了。只要能识别出来就不用管他。

    星期五 17:16
    有用
    回复
  • 问道红尘
    问道红尘
    04-07

    04-07
    有用
    回复
登录 后发表内容