Giter VIP home page Giter VIP logo

Comments (3)

EddyVerbruggen avatar EddyVerbruggen commented on May 27, 2024

Interesting find.. so I guess adding an onPause listener to the plugin that stops listening would fix it.

Did you try to invoke stopListening from a pause event to prevent the problem?

from nativescript-speech-recognition.

GrEg00z avatar GrEg00z commented on May 27, 2024

Yes I tried to call stopListening inside the 'suspend' event listener of my nativescript app :

application.on(application.suspendEvent, (args: application.ApplicationEventData) => {
      if(this.isStarted)
           this.speechRecognition.stopListening();
});

but it doesnt fix it, and I also get an Error 5 : ERROR_CLIENT (from onError listener).

Also I must have 'isStarted' flag to prevent application crash, because if startListening event has not been already called, the app crash with error : Cannot read property 'stopListening' of undefined

I have also tried to call stopListening directly in speech-recognition plugin code, inside 'onEndOfSpeech' event callback.
No error are throw but nothing changes too

Last thing is if I do not invoke startListening before suspend app, then when I resume the app the plugin works.
But the next suspend event will provoke the same error as explain in my first post

from nativescript-speech-recognition.

EddyVerbruggen avatar EddyVerbruggen commented on May 27, 2024

Thanks for those great pointers!

  • I've added the error logging, and invoke reject when it's called.
  • I've added a guard to stopListening so you no longer need to track it with a boolean (isStarted) yourself.
  • And most importantly, suspend/resume now works without problems: with version 1.2.0 the plugin will handle this automatically for you.

from nativescript-speech-recognition.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.