Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SpeechSynthesisAnnouncer cannot be used before initialized #204

Closed
jessegreenberg opened this issue Jan 17, 2023 · 7 comments
Closed

SpeechSynthesisAnnouncer cannot be used before initialized #204

jessegreenberg opened this issue Jan 17, 2023 · 7 comments

Comments

@jessegreenberg
Copy link
Contributor

jessegreenberg commented Jan 17, 2023

@marlitas I'm not sure what is happening, but with mac + safari when I try to set the second locale, the sim freezes with this error:
Screenshot 2023-01-17 at 9 02 17 AM

When using mac + chrome, I can add the second locale and didn't notice any speech synthesis bugs.

Originally posted by @Nancy-Salpepi in #152 (comment)

@marlitas
Copy link
Contributor

I see this with Windows + firefox as well. Was working on #160 and got blocked by this.

@jessegreenberg
Copy link
Contributor Author

jessegreenberg commented Jan 17, 2023

This lazyLink is supposed to be preventing this exact issue from happening:

    // Voices may not be available on load or the list of voices may change - update if we get an indication that
    // the list of available voices has changed.
    this.voicesProperty.lazyLink( this.updateVoiceListener );

The voicesProperty changes in response to the onvoiceschanged event and on during initialization. I am guessing that we are hitting this while the SpeechSynthesisAnnouncer is being initialized. This may have been introduced in phetsims/utterance-queue#96 when voices became a Property.

jessegreenberg added a commit to phetsims/number-suite-common that referenced this issue Jan 17, 2023
@jessegreenberg
Copy link
Contributor Author

jessegreenberg commented Jan 17, 2023

OK, proposing the above commit to fix this. Instead of checking for populated voices we check to wait until the SpeechSynthesisAnnouncer has been initialized.

I am not sure when updateVoice needs to be called but if it has to be called on startup, you could also link it to the
SpeechSynthesisAnnouncer.isInitializedProperty as well.

EDIT:

if it has to be called on startup, you could also link it to the

That seemed right so I added it. @marlitas do you agree, anything else for this issue?

@pixelzoom
Copy link
Contributor

Over in phetsims/number-suite-common#33, I reported that both number-play and number-compare are currently failing to start in Chrome when run from phetmarks. This is blocking further development and top priority. @chrisklus seems to think this issue is the cause.

jessegreenberg added a commit to phetsims/number-suite-common that referenced this issue Jan 18, 2023
@jessegreenberg
Copy link
Contributor Author

Sorry about that! I guess I did not test phetsims/number-suite-common@3e1652f. Fixed with the above commit.

@marlitas
Copy link
Contributor

@jessegreenberg this looks good, thanks for the work here! @chrisklus over to you for final review and closure.

@marlitas marlitas assigned chrisklus and unassigned marlitas Jan 18, 2023
@chrisklus
Copy link
Contributor

Reviewed and discussed with @marlitas on Slack, changes look great and I tested on Safari and Chrome. Thanks @marlitas and @jessegreenberg! Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants