Something different in RC3/4 vs RC2 in declaration?


#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 (https://github.com/macdonst/SpeechRecognitionPlugin) 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.


Speech Recognition (SOLVED)
Speech Recognition (SOLVED)
#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


#4

Tim,

I just got Node 6.9.2, but same error…

Pietro


#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.


#6

Someone can made it works on IOS?

My ios code doesnt works =(

Same erro


#7

Sorry. I didn’t code for IOS.


#8

For me it is ok on Android.

My question is, It is possible to have a continuous recognition? Now it stops after few seconds.


#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.


#10

Yes it stops if no one is speaking.
But I’d like to have the recognition in the background. It is possible?


#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).


#12

Thank you @pimol, I’ll take a look for google speech api.


#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