pimol
December 17, 2016, 6:20pm
1
I upgrade an app from RC2 to RC4, following the instructions in the changeLog.
In that apps I have been used the speech-to-text plugin SpeechRecognition (GitHub - macdonst/SpeechRecognitionPlugin: W3C Web Speech API - Speech Recognition plugin for PhoneGap ) and it run perfectly.
As soon as I upgrade, II got this error (console from devices):
EXCEPTION: Uncaught (in promise): ReferenceError: SpeechRecognition is not defined
In my page I have:
.....
declare var SpeechRecognition: any;
.....
speechToText() {
this.platform.ready().then(() => {
this.recognition = new SpeechRecognition();
this.recognition.lang = 'it-IT';
this.recognition.onnomatch = (event => {
this.showAlert('No match found.');
});
this.recognition.onerror = (event => {
this.showAlert('Error happens.');
});
this.recognition.onresult = (event => {
if (event.results.length > 0) {
this.loadWords(event.results[0][0].transcript);
}
});
this.recognition.start();
});
}
Ionic Info:
Your system information:
ordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.4
Ionic CLI Version: 2.1.17
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 0.0.47
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v4.6.1
Xcode version: Not installed
My test device is a S4 mini, Android 4.4
P.
tja2353
December 18, 2016, 11:40am
2
Hi
I would update node
see [http://ionicframework.com/docs/v2/setup/installation/ ]
(http://ionicframework.com/docs/v2/setup/installation/ )
To create Ionic 2 projects, you’ll need to install the latest version of the CLI and Cordova. Before you do that, you’ll need a recent version of Node.js. Download the installer for Node.js 6 or greater and then proceed to install the Ionic CLI and Cordova for native app development:
hth
Tim
pimol
December 22, 2016, 9:39am
4
Tim,
I just got Node 6.9.2, but same error…
Pietro
pimol
December 26, 2016, 8:49pm
5
I fixed it.
Declaration in package.json. config.xml, android.json was missing. In RC2 that doesn’t matter?!?
android.json: add
"org.apache.cordova.speech.speechrecognition": {
"PACKAGE_NAME": "com.ionicframework.listaspesa928347"
}
config.xml: add (check the release in plugin.xml, I had 0.1.2)
<plugin name="org.apache.cordova.speech.speechrecognition" spec="0.1.2" />
package.json: add in cordovaPlugins the record:
"org.apache.cordova.speech.speechrecognition"
PS: may be that only the update of android.json is actually a must.
soler
February 4, 2017, 4:07pm
6
Someone can made it works on IOS?
My ios code doesnt works =(
Same erro
pimol
February 4, 2017, 4:37pm
7
Sorry. I didn’t code for IOS.
For me it is ok on Android.
My question is, It is possible to have a continuous recognition? Now it stops after few seconds.
pimol
March 6, 2017, 11:18am
9
I imagine it stops if no one is speaking… in my mind is a property of server side (google).
I try to speak for several seconds, but it doesn’t stop.
Yes it stops if no one is speaking.
But I’d like to have the recognition in the background. It is possible?
pimol
March 6, 2017, 1:02pm
11
You have to implement this api: https://cloud.google.com/speech/
(I didn’t, but the test in this page seems to be what you are looking for).
Thank you @pimol , I’ll take a look for google speech api.
jigar
September 21, 2017, 3:48am
13
Hi,
I am trying to use speech recognition cordova plugin in ionic v1.
Can anyone here who know how to use in iOS?
Thanks