leaonline/easy-speech

Microsoft voices only loading on browser refresh in Chrome on Windows

Opened this issue · 3 comments

[X] I have read the FAQ section and have checked
that none of it describe the issue I'm about to report.

Describe the bug
A clear and concise description of what the bug is.

On the initial load of the page in latest Chrome on Windows 10 (not mobile), all the google voices available load, but not the 3 microsoft voices. But if users refresh the page, the 3 microsoft voices appear.

Additional context
[Add any other context about the problem here]

(https://longislandcw.github.io/morsebrowser/easysp23/).
Click/expand More Settings accordion-> check expert settings, check voice, and then see the list in "choose speaker..." (note that all non-english google voices are hidden from the user).

Brave and Edge seem ok, ie the microsoft voices load without need to refresh.

also this is how I use the library:

EasySpeech.init({ maxTimeout: 10000, interval: 250 }).then((e) => {
      this.logToFlaggedWords(`easyspeechinit: ${e}`)
      this.populateVoiceList()
    }).catch((e) => {
      this.logToFlaggedWords(`error in easyspeechinit: ${e}`)
    })

well, a little workaround, the workflow for the page allows us to wait to call init until something is pressed. I am not sure if it is time, or the fact that user has clicked on something that enables the microsoft voices to be available.

@RandyLoeb sorry I missed this one in the last month. So here is the issue: all voices should have been loaded when init is complete as the underlying event voiceschanged is usually the only source of "truth" we can get.

One thing to try though, would be to see, if voiceschanged fired multiple times in your specific case:

  • first once most voices have loaded
  • second once the three MS voices have loaded

The code would be fairly easy to check:

const synth = window.speechSynthesis;

synth.addEventListener("voiceschanged", () => {
  // log output of synth.getVoices()
});

synth.getVoices() // sometimes required to initially trigger the voice list to update