pbakondy / cordova-plugin-speechrecognition Goto Github PK
View Code? Open in Web Editor NEW:microphone: Cordova Plugin for Speech Recognition
License: MIT License
:microphone: Cordova Plugin for Speech Recognition
License: MIT License
Hi Peter,
I am using your plugin in cordova app,it give me error on simulator(error domain=kAFAssitantErrorDomainCode=1101"(null)")
and says missing permission in isListening function.
Also in device it give me error(error domain=kAFAssitantErrorDomainCode=216"(null)").
Kindly help.
Thanks in advance
Hi,
How can we add custom words or expressions programmaticaly to plugin's dictionnary ? in order to
be able to personalize recognition like "Ok Google" or "Hey Siri" ?
Once startListening() fires, there is no sound, even after stopListening(). Before that, anything is ok.
Does anyone knows something about it?
I also tryied to remove cordova-plugin-avaudiosession but nothing changed.
It should be possible to use google speech recognition api on Apple devices instead of native / apple apis.
Specifically, under HIPAA requirement we can use google speech api, while we can't use apple services.
i am new to ionic i want to use your plugin with ionic 2 but unable to do so as there is no type definition included it tried many solutions e.g declare var SpeechRecognition:any;
for calling the function but it's not recognizing them.
Really Sorry i know it's not the issue with your plugin but i am unable to find the solution i don't know where to ask so i am writing here.
Please help me i would be very thankful and please also update guide on your plugin too for ionic 2 it would help a lot of other peoples too thanks looking forward for your positive reply.
This happens on spamming the listening trigger
hi i wanna ask you how can i remove android popup same like ios so i can use my own design.
I don't know what is wrong but it always return error to me after recognition with no matches
message.
Any help is appreciated thanks.
i figured out that it requires network to work.
I add the plugin to app and build for ios platform with ionic v1. I getting error while to build. please help me for error code while to start button . (this device firmware: IOS 10.3.3) Can someone help , please
2017-08-15 15:17:28.652580+0300 speech[1243:266907] startListening()
2017-08-15 15:17:28.811608+0300 speech[1243:266907] THREAD WARNING: ['SpeechRecognition'] took '158.988037' ms. Plugin should use a background thread.
2017-08-15 15:18:32.519156+0300 speech[1243:266907] startListening() recognitionTask error: Error Domain=kAFAssistantErrorDomain Code=203 "Retry" UserInfo={NSLocalizedDescription=Retry, NSUnderlyingError=0x170250da0 {Error Domain=SiriSpeechErrorDomain Code=1 "(null)"}}
2017-08-15 15:18:32.528613+0300 speech[1243:266907] ERROR: Error Domain=kAFAssistantErrorDomain Code=203 "Retry" UserInfo={NSLocalizedDescription=Retry, NSUnderlyingError=0x170250da0 {Error Domain=SiriSpeechErrorDomain Code=1 "(null)"}}
Hi,
I just tried this plugin with Ionic 2.3 and Ionic Native 3, when I use the available function to check whether it is supported, I got "plugin-not-installed" error.
I followed the plugin installation instruction from Ionic docs here and configured it following instruction here
I am using Ionic View app to test my app.
My system info:
Cordova CLI: 6.5.0
Ionic Framework Version: 2.3.0
Ionic CLI Version: 2.2.2
Ionic App Lib Version: 2.2.1
Ionic App Scripts Version: 1.1.4
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 4.9
Node Version: v6.10.0
Xcode version: Not installed
Thank you for your help!
My app can run normally before. However the app froze at at finished loading of index page after installation of the plugin. Permission granted.
I didn't change any coding and have not yet initialized nor called the plugin, no error message in console.
Angular project
cordova version 6.4.0
cordova platform version - ios 3.9.1
ios 10.2.1
I have added onresult and onerror event listener to my SpeechRecognition object.
onresult callback is working fine but onerror is not.
when a onerror event fires, "event" object has only one information ["type":"error"].
There is no error details or message available.
First of all: big thanks for this plugin!
I have implemented this plugin successfully in my hybrid app project..It is working well on my iphone 6 and xiaomi redmi smartphones.
I have problem if i want to run my app on the Samsung SM-T235 tablet (Android version 5.1.1) ..I don't receive any error message, just the whole Phonegap library is not working. Without this plugin everything is fine.
I use the Phonegap Build Service (cli-6.5.0).
Any suggestions would be appreciated!
When i run startlistening, and stopping it without recording/speaking it produces error. Is this a correct behaviour ?
I have problem of ERROR_RECOGNIZER_BUSY or prompt paused on "Try again" once I got my first results and I call .startListening() again. I am using Ionic 2, but it is exactly the same using directly the cordova plugin.
I think you should manage better this kind of errors, here is what I found to solve this kind of issues :
https://stackoverflow.com/questions/13227105/speechrecognizer-not-connected-to-recognition-service
https://stackoverflow.com/questions/15759676/handling-recognitionlistener-errors
I would do :
sr.stopListening();
sr.cancel();
sr.destroy();
sr.startListening();
to be sure all is back again
For the moment, my work is stuck. no other workaround found
Hi,
Do you know if it's possible use the offline speech recognition on both platforms (android and ios)?
I read the documentation and I saw this plugin uses the online speech recognition APIs, so I want to know if you know another plugin, or even know if ios and android offers the offline api to thirty party apps.
Thanks.
Hello im getting an error in ios when i build it. the error is Speech/Speech.h file not found where can I find the speech.h? or the file of speech/speech.h?
Hi
I am fascinated with Cordova features. Now I want to add text recognition to my app. But current example is very unclear. I ask you to create simple but complete example (like those on Cordova home page) witch will show recognition process from click on button on web page to recognized text injection to some edit box. This will be great and will show strength both Cordova and yours. Maybe it is silly task, but challenge for beginner...
thank you and best regards
Jacek
I did try to test your plugin (i waiting for similar long time ago), but build is failed with the following error:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_SFSpeechAudioBufferRecognitionRequest", referenced from:
objc-class-ref in SpeechRecognition.o
"_OBJC_CLASS_$_SFSpeechRecognizer", referenced from:
objc-class-ref in SpeechRecognition.o
ld: symbol(s) not found for architecture i386
It's a simple Phonegap project, contains only this plugin. When i remove plugin, then project files compiled fine. What solutions are possible to solve this issue?
*** UPDATE ***
Cordova and Xcode re-install solved the problem, sorry.
When I run the code below, as soon as the beep sounds to start recording the mic, I get "Network error":
I have no idea what's wrong here. I've:
Here's my basic code, nothing special here:
setupSpeechRecognition() {
this.speechRecognition.requestPermission().then(() => {
this.speechRecognition.startListening().subscribe(
(matches) => {
// matches here...
},
(onerror) => {
alert("Error: " + JSON.stringify(onerror));
}
);
},
() => {}
);
}
And here's my AndroidManifest.xml for kicks:
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" package="io.ionic.starter" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:hardwareAccelerated="true" android:icon="@mipmap/icon" android:label="@string/app_name" android:supportsRtl="true">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">
<intent-filter android:label="@string/launcher_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver android:name="cordova.plugins.Diagnostic$LocationProviderChangedReceiver">
<intent-filter>
<action android:name="android.location.PROVIDERS_CHANGED" />
</intent-filter>
</receiver>
<receiver android:name="cordova.plugins.Diagnostic$NFCStateChangedReceiver">
<intent-filter>
<action android:name="android.nfc.action.ADAPTER_STATE_CHANGED" />
</intent-filter>
</receiver>
</application>
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="25" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest>
Any ideas?
Thanks.
Hi
is there any way to disable the beep sound on starting and stopping ?
I'm using Ionic 2 and building for Android.
I tried Media Plugin but it does not seem to be able to affect system sounds.
Thanks in advance.
Do you have a full working example app, ideally on an app store, that we can use to test how well the speech recognition works without having to build one? It would also be very helpful (and there's already an issue for this) to have full code for a simple working example (maybe using a voice command) available.
Thanks very much.
I would like to record the audio being transcribed.
Is it possible with the plugin?
I'm starting to get this error on Android 7.0, specifically on Galaxy S7 Edge.
java.lang.SecurityException:
at android.app.ContextImpl.bindServiceCommon (ContextImpl.java:1521)
at android.app.ContextImpl.bindService (ContextImpl.java:1475)
at android.content.ContextWrapper.bindService (ContextWrapper.java:688)
at android.speech.SpeechRecognizer.startListening (SpeechRecognizer.java:287)
at com.pbakondy.SpeechRecognition$2.run (SpeechRecognition.java:179)
at android.os.Handler.handleCallback (Handler.java:751)
at android.os.Handler.dispatchMessage (Handler.java:95)
at android.os.Looper.loop (Looper.java:154)
at android.app.ActivityThread.main (ActivityThread.java:6692)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1468)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1358)
Anyone knows what might be the issue?
Is it possible to have speechRecognition() only listen for 3 seconds in iOS?
I installed this plugin and am seeing the following error in xcode when trying to compile and run the app for ios. Does anyone know what I can do to fix this?
CDVPlugin class SpeechRecognition (pluginName: SpeechRecognition) does not exist.
ERROR: Plugin 'SpeechRecognition' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.
I ran the following commands to install the plugin. Maybe I missed something?
sudo npm install ionic-native --save
sudo cordova plugin add cordova-plugin-speechrecognition
The plugin seems to work an android, I'm only having issues with ios.
Any help is appreciated.
Hi @pbakondy, is there any possibility to use a bluetooth microphone to speech recognition? Eg. a car handsfree. Thank you.
I use text to speech along with speech recognition (on iOS). Whenever I invoke a speech recognition, the overall volume of the app decreases (the tts speech is hard to hear).Any ideas?
Option showPopup: false
causes errors in Android 6.
First use is OK - I get list of matches, but the second and every next try - it fails.
There is an immediate response: No match (it's not even waiting for me to stop talking).
Few times there was also RecognitionService busy info.
With showPopup: true
everything works just fine.
On Android 5 everything works fine in both cases. I was trying en-US and pl-PL.
I use the newest version of the plugin and Cordova.
Android 6 - Samsug Galaxy A5 model 2016 - Android 6.0.1
Android 5 - Samsung Galaxy S4 - Android 5.0.1
Never calls callbacks in requestPermission. No output in console. iOS.
It is NOT depended of
'NSMicrophoneUsageDescription permission'
'NSSpeechRecognitionUsageDescription permission'
in my .plist file.
window.plugins.speechRecognition.requestPermission(function () {
// never
}, function () { // never })
I have a problem, When I call function startListening . error is appear "No Activity found to handle Intent { act=android.speech.action.RECOGNIZE_SPEECH (has extras) }", any idea?
thank you so much for your plugin.
Hi,
Does speech recognition works continuously and offline also..
I was making one android app using cordova which has offline speech recognition capability and works continuously...
Also is there a way to implement "OK Google " like functionality which listens to some keyword and then starts the speech recognition..
Thanks.
I try to build my app which is use your SpeechRecognition plugin under iOS in Ionic cloud and get this error
"In file included from /Users/package/workspace/apps-25c2fea9-82/cordova/platforms/ios/CargoMessenger/Plugins/cordova-plugin-speechrecognition/SpeechRecognition.m:5:
/Users/package/workspace/apps-25c2fea9-82/cordova/platforms/ios/CargoMessenger/Plugins/cordova-plugin-speechrecognition/SpeechRecognition.h:2:9: fatal error: 'Speech/Speech.h' file not found
** import Speech/Speech.h**
** ^**
1 error generated.
BUILD FAILED "
under Android everything work good.
This plugin introduced in ionic 2 documentation, so I want to understand something wrong with plugin itself or something wrong with build process
On Android 7.0 the speech recognition dialog opens, however immediately stops and says try again and will not start listening. On iOS10 it works fine.
Tested with an empty Cordova "Hello World" app and the example code.
I am getting this issue on phonegap for the IOS build:
The following 3rd-party plugin is causing the build to fail and may need to be updated to a newer version: cordova-plugin-speechrecognition
The android build works.
My config.xml file in my ionic app has this line:
<gap:plugin name="cordova-plugin-speechrecognition" source="npm" />
I want to use it for one of my Cordova app and i am not able to figure out that is it free or paid?
Will you be adding dictationRecordingDidEnd() so we know when dictation ends and can call the stopListening method you've already implemented? This would help immensely and keep the user experience the same across ios and android platforms.
Hi, is it possible a Speech Recognition Continuos?
Thanks in advance!
I try to show the recognized Words with this code:
// Handle results
function startRecognition(){
window.plugins.speechRecognition.startListening(function(result){
// Show results in the console
console.log(result);
}, function(err){
console.error(err);
}, {
language: "de-DE",
showPopup: true
});
}
It is asking for Permission (so other code is working) and everything is okay, but the only result I get is:
Ongoing speech recognition
Why does not he show the words I have spoken? Has it perhaps to do with the matches? Is there an example? How is the right code to show the spoken results into the console.log?
On Android, with the option showPopup=true, Google's "microphone on" popup shows correctly. But after speech ends, another popup, that says "tap to speak" shows for a moment (as though it were behind the first popup) and then goes away. It does not affect recognition, which works just fine. Is there any way to avoid the "tap to speak" popup?
Hi
I have some problem with startListening() - it doesnt work.
My code:
`window.plugins.speechRecognition.isRecognitionAvailable(
function(){
window.plugins.speechRecognition.hasPermission(
function(){
alert("hello")
/*window.plugins.speechRecognition.startListening(
function(){
alert("recorded");
},
function(errorMsg){
alert(errorMsg);
},
{
String language = window.navigator.language,
Number matches = 1,
String prompt = "", // Android only
Boolean showPopup = false, // Android only
});*/
},
function(){alert("App doesn't have permissions granted.");});
},
function(){alert("Somethign went wrong.");}
);`
RIght now "hello" alert pops up before the recording" page is loaded - my first cordova project,
and if I uncomment startListening() the popup doesnt show up at all and nothing happens.
This code should run after pushing a button in "home_page" but after loading "add_page". Am i also not sure if Function successCallback should be function(result){ //result = array ?}. I would really apprecieate help or working example.
Thanks
Hi,
I have previously used Web Speech API but since I don't know how to make it work on cordova android i have tried this plugin. It all works great but for some reason it recognizes English words despite language being set to pl-PL. eg "Raz dwa" (one two) is sometimes recognized as "France 2". Is there any way of tweaking options?
Thanks!
thanks for your work ! I hope android language can support 'zh-CN'.
Im using this plugin on cordova.
I have this code:
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
alert("pronto");
window.plugins.speechRecognition.hasPermission(Function successCallback2, Function errorCallback)
}
function successCallback(){
alert("foi");
}
function errorCallback(){
alert("deu erro");
}
function successCallback2(){
alert("tem permissao");
let options = {
String "pt-BR",
Number 5,
String "rola viado", // Android only
Boolean true
}
window.plugins.speechRecognition.startListening(Function successCallback, Function errorCallback, Object options)
}
Im using Android 7.1
I had to install this plugin using:
cordova plugin add https://github.com/pbakondy/cordova-plugin-speech-recognition
the id cordova-plugin-speech-recognition is already being used by an older plugin.
I add this plugin into my ionic3 project, but I got a blank screen on my iphone.
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?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.