I have created ionic app and used cordova-plugin-speechrecognition for speech to text conversion.
The Code used in the apps is as follows:
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();
}
This code runs well on android where the google speech Api gets called. When I ran it on iOS , I made the required changes like adding NSSpeechRecognitionUsageDescription permission in info.plist of ios .
Not sure but speech recognition doesn't work on ios 13.3 when I am testing it through the apple developer account test flight app.
Thanks in advance