Closed zepumph closed 2 years ago
I haven't observed this myself, but I think I noticed a reference to this while investigating https://github.com/phetsims/number-play/issues/138! I think it is another Chrome bug. https://bugs.chromium.org/p/chromium/issues/detail?id=679437
That thread suggests a workaround where you call pause
and resume
intermittently to get the engine running again. Reports say it works in Chrome but breaks in other browsers.
I ran into this while working on https://github.com/phetsims/quadrilateral/issues/75.
Concerned that if we do the pause/resume workaround that may send end
events through the Announcer/UtteranceQueue to dispose of the Utterance. Haven't done any testing.
Perhaps we can solve this in the purely on the announcer side. Because we can manage the end event there and conditionally "restart" the speech or send things back to the queue. I'm just floating ideas though. I'm not sure.
Some notes:
pause
/resume
to trigger start
or end
events since they have their own events called pause
and resume
. So the workaround may not interfere with listeners currently on our SpeechSynthesisUtterance.pause
/resume
workaround is working great in Windows 10 Chrome.pause
/resume
workaround breaks in Android Chrome. Speech stops and it does not resume. We never get a cancel
or end
event.synth.resume
in a setTimeout
for 1 and 15 ms to fix on Android Chrome but it did nothing.synth.cancel()
. I don't want to remove all SpeechSynthesisUtterances though, we would never hear anything in the queue.resume()
without a cancel()
. A response says it used to work but doesn't anymore. I confirmed it does not work in Win 10 Chrome.Have to stop for tonight, but maybe breaking it up into multiple SpeechSynthesisUtterances wouldn't be too bad. Alternatively, I am NOT seeing this issue on my Android Chrome device, so maybe a platform specific if( platform.chromium && !platform.android )
?
@zepumph and I discussed and agreed to go with the quicker pause
/resume
workaround for now with a platform check. We agreed that breaking up the SpeechSynthesisUtterance into several could work but would require a lot of code to get it working and there are still some open questions about how to get it working?
Utterance.priorityProperty
changes?After this fix, we should make sure that everything still works on all chromium browsers (including Edge!!) as well as all browsers that can be installed on a Chromebook.
I was just about ready to commit this when I removed to the workaround to verify that behavior was improved only to find that I can no longer reproduce the problem in Chrome with any voice. I am on version Version 100.0.4896.75 (Official Build) (64-bit). Did Chrome fix this in the last 7 days?
Here is the patch I was about to commit:
@zepumph @BLFiedler or @terracoda can you please try the toolbar buttons in ratio-and-proportion in Chrome and see if you are still seeing this? If you do, can you please report your Chrome version? I heard continuous speech for ~30 seconds in ratio-and-proportion with all available voices.
I can consistently get this to reproduce with the "Google US English" but I cannot reproduce with any microsoft voice (mark david zira). When it occurs, it is pretty much right at 15 seconds. I reproduced with a voice rate of .75, 1, and 1.25.
OK thanks @zepumph! Can you please post your chrome version?
Good catch, @zepumph ! I have discovered it's the same for me. Google US English cuts out at 15 seconds, but all other voices play out the full overview just fine.
My Chrome version (on Win10): Version 100.0.4896.75 (Official Build) (64-bit)
OK thanks for checking! For some reason I am still not seeing this with 100.0.4896.75 (Official Build) (64-bit) with "Google US English" voice. I timed it speaking for 29 seconds and it never cut out. Ill try applying the workaround and check-in again with @zepumph or @BLFiedler to see if it is fixed.
@jessegreenberg can you still not reproduce this?
I just tested again and cannot reproduce this. Using 'Google US English' I heard speech for 21 seconds.
I committed the change proposed in https://github.com/phetsims/utterance-queue/issues/60#issuecomment-1093327856. @samreid helped me test since I haven't been able to reproduce this bug. On his Mac with Chrome we observed the problem before the fix and verified that the problem was gone after https://github.com/phetsims/utterance-queue/commit/6d5b3c1eb4129811e3f4ffccc0f5eba1fed891e5.
@zepumph can you please also verify the fix and review the change?
That is so interesting that you couldn't I added a console log inside the code block that paused and resumed speech. I then put on Google US English voice at .75x speed. I saw that the first screen overview button in Ratio and Proportion used the workaround 2+ times to complete the sentence, but it did complete it. I then used a Microsoft voice in the same parameters and saw it complete the whole overview without entering the code block (no console logs).
I also tested from an unbuilt sim on my android phone, and the single available voice completed the overview on the first screen of RAP also.
This is superb. Thank you @jessegreenberg and @samreid.
It breaks SpeechSynthesis on android
It took me a couple of back-and-forths to come to the conclusion that "It" is the workaround, not the bug. I'm still not positibe though. Can you will in that pronoun?
Yes, I can see how that was confusing. Is that better?
@terracoda and I found this while reviewing the overview button in Ratio and Proportion (https://github.com/phetsims/ratio-and-proportion/issues/363).
Basically, at 1x speed, the overview button stops part way through speaking. This is the text:
At 1x, it stops around
As you move the hands up and down
.@terracoda tested this on safari, and I on Firefox, and those browsers spoke the whole thing. I would like to talk to @jessegreenberg about how to proceed here.