kamiazya/ngx-speech-recognition

ReferenceError: SpeechRecognition is not defined

Open

#308 opened on Oct 9, 2019

 (4 comments) (0 reactions) (1 assignee)TypeScript (16 forks)auto 404
good first issuehelp wanted

Repository metrics

Stars
 (25 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

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!

Contributor guide