Closed LUCIANOSOLER closed 7 years ago
sadly Apple provides poor support for Speech API. Just look at the official forum: https://forums.developer.apple.com/search.jspa?q=kAFAssistantErrorDomain
I really not able to tell you what could be the problem. It works on my device and I can not reproduce this error.
I understand, can you send me your project? maybe some configuration of your project can be different and work here.
I'm also receiving Error Domain=kAFAssistantErrorDomain Code=1 "(null)"
. In some circumstances recognition works, but only after idling for several minutes. More in this picture.
Edit: This was after calling voiceSearch a second time. See my code below.
voiceSearch() {
SpeechRecognition.isRecognitionAvailable()
.then((available: boolean) => {
SpeechRecognition.requestPermission()
.then(
() => {
SpeechRecognition.startListening()
.subscribe(
(matches: Array<string>) => {
this.query = matches[0];
this.getResponse();
console.log(matches[0]);
},
(onerror) => console.log('error:', onerror)
);
console.log('Granted');
},
() => console.log('Denied')
)
})
}
I should mention the above also works flawlessly on Android.
Same error here, with your plugin and with this one: https://github.com/macdonst/SpeechRecognitionPlugin tested on iOS 10 and both do not work with same error. On android, no problem.
Please check last release
How can we update from Ionic?
edit: npm install ionic-native@latest --save --save-exact
I am still experiencing issues with using the code that I provided above. Here are the steps I took:
edit: Forgot to include the log. Can you please provide a function similar to mine that works on both ios and android? Currently the function voiceSearch that I listed above works fine on android. If it's impossible to write a function that works for both platforms, can you provide a snippet that works for ios only?
Thank you!
@aurothic, How long did you wait? Seems that needs to wait for about 1 minute for a response back, can you try?
@aurothic you don't need to update ionic-native package. You have to update the cordova plugin itself.
cordova plugin rm cordova-plugin-speechrecognition
cordova plugin add cordova-plugin-speechrecognition
Thanks @pbakondy now works ...
Great! Can we close the issue?
This worked for me as well. However, there still is the matter of waiting for a 1 minute timeout before displaying the results. Android detects when the user stops talking, is there any such way to do this on IOS?
For ios use stopListening method.
Yes, but when should I call it? Currently I have a button that starts the listening process. This works very well on android, does it not carry over to ios?
You need use plugin "Platform" to knows if you are on android or ios. https://ionicframework.com/docs/v2/api/platform/Platform/
On my app I put timer when i call startListening for ios ( 5 seconds ) when time over, the program calls stopListening
Seems like bad practice. Perhaps this plugin could be used with DB Meter.
With Ionic 4 not working on IOS. Getting below error. TypeError: Object(WEBPACK_IMPORTED_MODULE_1ionic_native_core["cordova"]) is not a function. (In 'Object(__WEBPACK_IMPORTED_MODULE_1ionic_native_core["cordova"])(this, "isRecognitionAvailable", {}, arguments)', 'Object(WEBPACK_IMPORTED_MODULE_1ionic_native_core["cordova"])' is an instance of Object)
I implemented functions in this order and works ok on Android, but startListening doesn't works on iOS 10.
Functions Avaliable - (works on android and iOS) HasPermition - (works on android and iOS) RequestPermition - (works on android and iOS)
But startListening - (works on android, but not works on iOS 10)
I already given permission on NSMicrophoneUsageDescription and NSSpeechRecognitionUsageDescription with its string value in info.plist
I call permissions before i call startListening, but doesn´t works on iOS.
I am with: Cordova CLI: 6.5.0 Ionic Framework Version: 2.0.1 Ionic CLI Version: 2.1.18 Ionic App Lib Version: 2.1.9 Ionic App Scripts Version: 1.0.0 ios-deploy version: 1.9.1 ios-sim version: 5.0.13 OS: macOS Sierra Node Version: v6.9.2 Xcode version: Xcode 8.2.1 Build version 8C1002
The erros that appears to me is --> error domain=kAFAssistantErrorDomain, same as others issues.
Can you have some idea why this is happen?