为什么同声传译onStop事件不触发?

发布于 6 年前作者 chaoyi9082 次浏览最后编辑 6 年前来自 issues

const plugin = requirePlugin("WechatSI");

let manager = plugin.getRecordRecognitionManager();


// Events

const INPUT_COMPLETE = "inputComplete"


// io/voice.js

Component({

 /**

  * Component properties

  */

 properties: {

   lang: {

     type: String,

     value: 'zh_CN'

   }

 },


 created: function() {

   console.log('created')


   let that = this

   manager.onStart = function(res) {

     console.log("manager.Start", res)

     that.triggerEvent(INPUT_COMPLETE, 'start')

   }


   // 识别结束事件

   manager.onStop = function(res) {

     console.log("manager.onStop")

   }


   manager.onError = function(res) {

     console.log('manager.onError')

   }

 },


 /**

  * Component initial data

  */

 data: {


 },


 /**

  * Component methods

  */

 methods: {

   recordStart() {

     let lang = this.properties.lang

     manager.start({

       lang,

     })

   },


   recordEnd() {

     console.log('recordEnd')

     manager.stop()

   }

 }

})



自定义了一个语音输入的组件,在开发工具中测试时发现可以看到“recordEnd”消息,不能看到"manager.onStop"信息。这里我还遗漏了某些设置吗?如果没有。manager.onStop为什么不触发呢?

4 回复
fmeng
fmeng1 楼6 年前

麻烦提供能复现问题的代码片段https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html

nayin
nayin2 楼6 年前

同问,我为什么也不执行onStart()方法

yangjin
yangjin3 楼6 年前

你的现在解决了吗?

xiulan66
xiulan664 楼4 年前

同问