kamiazya / ngx-speech-synthesis

Angular 7+ speech synthesis service (based on browser implementation such as Chrome).
https://kamiazya.github.io/ngx-speech-synthesis/
MIT License
3 stars 3 forks source link

Wait for "onvoiceschanged" in Chrome #549

Open stefan-niedermann opened 4 years ago

stefan-niedermann commented 4 years ago

According to the MDN docs one needs to wait in Chrome browsers for the onvoiceschanged event. This does not work on Firefox, therefore Mozilla suggests this approach:

var voices = [];

function populateVoiceList() {
  voices = synth.getVoices();
  // Now we have the voices.
}

populateVoiceList();
if (speechSynthesis.onvoiceschanged !== undefined) {
  speechSynthesis.onvoiceschanged = populateVoiceList;
}

It would be nice if the SpeechSynthesisService.getVoices() would return a Promise or an Observable.

issue-label-bot[bot] commented 4 years ago

Issue Label Bot is not confident enough to auto-label this issue. See dashboard for more details.