kamiazya/ngx-speech-recognition

ReferenceError: SpeechRecognition is not defined

Aperta

#308 aperta il 9 ott 2019

 (4 commenti) (0 reazioni) (1 assegnatario)TypeScript (16 fork)auto 404
good first issuehelp wanted

Metriche repository

Star
 (25 stelle)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

According to documentation, I implemented the feature in my application. Everything works fine except get following error in terminal -

ReferenceError: SpeechRecognition is not defined at RxSpeechRecognitionService.SpeechRecognitionCommon

I think, there is some configuration I am missing.

Here is the providers I added in my component -

providers: [
		{
      provide: SpeechRecognitionLang,
      useValue: 'en-US',
    },
    {
      provide: SpeechRecognitionMaxAlternatives,
      useValue: 1,
    },
    SpeechRecognitionService,
		RxSpeechRecognitionService,
  ],

And initialized service from the method -

openVoiceRecognition(){
      this.service
      .listen()
      .pipe(resultList)
      .subscribe((list: SpeechRecognitionResultList) => {
        let message = list.item(0).item(0).transcript;
	this.operationWithVoice(message);
      });
	}

Thanks in advance!

Guida contributor