微信同声传译插件和实时音视频插件冲突问题?
发布于 7 年前 作者 xiuyingyuan 9830 次浏览 来自 官方Issues

当页面使用了实时音视频插件,同时引用了微信同声传译插件,部分机型,会无法启动微信同声传译的录音功能呢,具体报错为code=30001,主要产生问题的机型有华为,vivo,oppo等机型微信同声传译部分代码如下

manager = plugin.getRecordRecognitionManager()
    // 检测是否有语音并进行识别
    manager.onRecognize = function (res) {
      manager.stop()
    }
    manager.onStart = function (res) {
      console.log('录音状态==', res.msg)
    }
    // 录音结束时,再次启动录音
    manager.onStop = function (res) {
      console.log(res)
      if (res.result !== '') {
        console.log('发送了消息')
        // 如果语音识别内容为空时
        if (_this.isVideo === 1) {
          console.log('发送语音')
          _this.sendMessage(res.result)
        } else {
          _this.sendJudicialMessage(res.result)
        }
      }
      // 判断是否需要重启识别,调解员关闭录制,停止语音识别,管理员开启录制,即可开启语音识别,语音识别也可单独控制
      if (_this.isIdentify) {
        manager.start({ duration: 30000, lang: 'zh_CN' })
      }
    }
    manager.onError = function (res) {
      if (_this.isIdentify) {
        manager.start({ duration: 30000, lang: 'zh_CN' })
      }
      console.error('error msg', res.msg)
    }
1 回复

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

回到顶部