Skip to content
This repository has been archived by the owner on Aug 14, 2019. It is now read-only.

onAudioEvent() not triggering when pagacking the Cognitive Speech Libary in a cordova plugin #75

Open
roymasad opened this issue Mar 21, 2018 · 4 comments

Comments

@roymasad
Copy link

roymasad commented Mar 21, 2018

Let me explain

I managed to wrap the entire Cognitive Speech Library in a cordova plugin. ( .aar sdk file and .so native library arm files)

It works, i can initialize and start listening on the mic normally getting results back on onFinalResponseReceived() and sending them back to the webview cordova app.

All works well, apart from onAudioEvent(), when packaged as cordova plugin, that function doesnt fire, so i cant detect when speech recognition is/stopped working.

The problem isnt that i cant send results back, no in the native plugin code itself onAudioEvent() no longer triggers.

this is my class relevant parts

public class BingSpeechPlugin extends CordovaPlugin implements ISpeechRecognitionServerEvents

        this.micClient = SpeechRecognitionServiceFactory.createMicrophoneClient(
          cordova.getActivity(),
          mode,
          language,
          this,
          bingkey);

the same code works fine and onAudioEvent() triggers properly if run directly as a native app from android studio without the cordova plugin package.

startMicAndRecognition() works fine in cordova plugin mode and i do get results on onFinalResponseReceived()

onAudioEvent() on the other hand doesnt seem to auto trigger anymore

@roymasad
Copy link
Author

UPDATE:

Looking at logcat i found that

onAudioEvent() triggers once when audio recognition starts

But doesnt triggering again after i get an 'I/NLPLAT: ERROR: No Reco'

When run in complete native mode, without cordova plugin interface, onAudioEvent() runs again after that error

@roymasad
Copy link
Author

in logcat this appears in normal mode but not in cordova plugin mode

I/NLPLAT: signaling OnAudioEvent(AUDIO_EVENT_RECORD_STOP)

@roymasad
Copy link
Author

roymasad commented Apr 9, 2018

anything?

@pallaviMN
Copy link

@redphoenix2k , can you please share the cordova plugin created by you, because even i need to use it in my hybrid app. So instead of reinventing the wheel, if you provide the plugin already created then would reduce our development time. If possible, please try to attach zip file of it

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants