首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ionic cordova语音识别插件在android上运行良好,但在ios上失败

ionic cordova语音识别插件在android上运行良好,但在ios上失败
EN

Stack Overflow用户
提问于 2020-04-20 13:59:48
回答 1查看 400关注 0票数 1

我已经创建了ionic应用程序,并使用cordova-plugin- speech进行语音到文本的转换。

应用程序中使用的代码如下:

代码语言: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();

 }

这段代码在android上运行良好,google speech Api就是在android上调用的。当我在iOS上运行它时,我做了必要的更改,比如在ios的info.plist中添加了NSSpeechRecognitionUsageDescription权限。

不确定,但语音识别不能在iOS13.3上工作,当我通过苹果开发人员帐户测试飞行应用程序测试它时。

提前感谢

EN

回答 1

Stack Overflow用户

发布于 2021-02-04 15:26:55

很抱歉,"speechRecognition“只能在网络上使用。我试着在手机上运行了2-3天,但不起作用。

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

https://stackoverflow.com/questions/61315995

复制
相关文章

相似问题

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