cordova-plugin-speechrecognition在Adrioid上运作良好,但在iOS 13.3中失败

问题描述 投票:0回答:1

我创建了离子应用程序,并使用了cordova-plugin-speechrecognition进行语音到文本的转换。这在android mobile和ios模拟器中效果很好,但在IOS 13.3上不起作用]

    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,我还实现了停止监听并添加了NSMicrophoneUsageDescription权限ios的info.list中的NSSpeechRecognitionUsageDescription权限。

请帮助我。在此先感谢

ios iphone cordova-plugins speech-to-text ionic5
1个回答
0
投票

它实际上有效,但有延迟,因此无法识别其触发。

© www.soinside.com 2019 - 2024. All rights reserved.