kamiazya / ngx-speech-recognition

Angular 5+ speech recognition service (based on browser implementation such as Chrome).
https://ngx-speech-recognition.stackblitz.io/
MIT License
25 stars 17 forks source link

Speech Recognition is not defined on Firefox #546

Closed aborderon closed 4 years ago

aborderon commented 4 years ago

Hello,

I'm reporting a problem, I integrated ngx-speech-recognition in my Angular application.

I use the following configuration:

Everything works fine on Chrome no problem, I know that speech recognition does not work on Firefox but I have an error message which breaks the application:

image

Do you have a solution to offer me?

Thank you.

kamiazya commented 4 years ago

@aborderon

Hi,

Thanks for using my library!

As a premise, this library is designed to be dependent on the browser implementation.

So there is no plan for this library to do anything to support FireFox.

However, if you look at the browser support status, the following annotations are attached to FireFox's voice recognition API.

Firefox currently has a media.webspeech.recognition.enable flag in about:config for this, but actual support is waiting for permissions to be sorted out.

There is also a blog, so it might be better to try it while referring to this.

Thank you.

aborderon commented 4 years ago

Hello, thank you for your return.

Yes I know that it is not supported on firefox.

I do not wish to use it on firefox I just wish that it does not break the application because it works well on chrome.

Is there no way to ignore it on Firefox?

kamiazya commented 4 years ago

@aborderon

How about using polyfill?

Like a ...

However, since the code needs to be called without the first argument as shown below, the interface needs to be changed.

https://github.com/kamiazya/ngx-speech-recognition/blob/master/projects/ngx-speech-recognition/src/lib/service/speech-recognition.common.ts#L7

I'm sorry, but I can't suggest any other way.

Thanks.

ghachemsaif commented 4 years ago

@aborderon You can make a parent component with :

declare var SpeechRecognition; // in top with the imports
  CheckIfSupproted(){
      if(SpeechRecognition){
        return true
      }
      return false
    }