Google Chrome: TTS speeds through passages when tab is muted
Description
What problem are we solving? What does the experience look like today? What are the symptoms? How can one reproduce the problem?
When TTS is active and the tab containing Bookreader is muted (right click tab -> 'Mute site'), the TTS skips over passages rapidly which speeds through the book. When unmuted the current passage will begin reading normally.
Evidence / Screenshot (if possible)
Include evidence of the problem or provide a screenshot.
Expectation
What should be happening? What will it look like / how will it behave when fixed?
TTS will continue progressing at the same rate without audio when tab is muted.
Context
What operating system? What browser type and version?
Windows, Google Chrome 116.0.5845.188 (Official Build) (64-bit)
NOT an issue on Firefox
Proposal & Constraints
What is the proposed solution / implementation? Is there a precedent of this approach succeeding elsewhere?
Stakeholders
@-tag any stakeholders of this bug
@cdrini I detected site mute in Chrome using AudioContext.state. The (window.AudioContext || window.webkitAudioContext)() ensures cross-browser support. If audioContext.state is 'suspended', I trigger a timeout.
Right now, it's a fixed 5s per chunk, but the plan is to set it dynamically based on the number of words in each chunk and the read-aloud speed. This will ensure the highlighted chunk stays visible for the exact duration it takes to read. If the speed changes, the timeout should adjust accordingly to keep everything in sync.
I also need to handle edge cases like muting/unmuting mid-chunk. Basic timeout logic works in Chrome. No issues in Firefox. Need to test other browsers. Is this a good approach to follow?
I cannot reproduce this on Chrome + Windows. Muting the tab has no effect when I try to reproduce. Would someone be able to upload a video of what they're observing?
@cdrini , I was able reproduce this on chrome+ windows as well as chrome+Linux
https://github.com/user-attachments/assets/3c7d6658-56c4-4c16-b3b3-cda3b6d93751