首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >cordova-plugin-speechrecognition在adrioid上运行良好,但在iOS13.3中失败

cordova-plugin-speechrecognition在adrioid上运行良好,但在iOS13.3中失败
EN

Stack Overflow用户
提问于 2020-04-17 12:32:11
回答 1查看 348关注 0票数 0

我已经创建了ionic应用程序,并使用cordova-plugin- speech进行语音到文本的转换。这在android手机和ios模拟器中运行良好,但在IOS 13.3上不起作用

代码语言:javascript
复制
    initSpeech() {
this.speechRecognition.hasPermission()
  .then((hasPermission: boolean) => {
    console.log(hasPermission)
    if (!hasPermission) {
      this.speechRecognition.requestPermission()
        .then(
          () => console.log('granted'),
          () => console.log('Denied')
        )
    }
  })
  }

 start() {
// Start the recognition process
this.speechRecognition.startListening()
  .subscribe(
    (matches: Array<string>) => { this.voicetext = matches[0]; this.mainForm.controls['comments'].setValue(matches[0]); },
    (onerror) => console.log('error:', onerror)
  )
  }

//stop listening for(ios only)
      stop() {
    this.speechRecognition.stopListening();

  }

在链接https://ionicframework.com/docs/native/speech-recognition中指定的代码就是我使用的代码。

对于IOS,我也实现了stop listening,并在ios的info.list中增加了NSMicrophoneUsageDescription permission NSSpeechRecognitionUsageDescription权限。

请帮我弄一下这个。提前感谢

EN

回答 1

Stack Overflow用户

发布于 2020-05-18 15:39:11

它实际上是工作的,但是有延迟,所以无法识别它被触发了。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61264214

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档