Closed joelpurra closed 7 years ago
Unless I've broken something else, I can't seem to get background-to-background iframe to prevent suspension. Will investigate more.
The v3.0.0 fix did not seem to work properly. For this reason it has not been published to the chrome web store nor firefox add-ons publicly. Reopening.
The problem seemed to be related to be (what I presume is) related to memory management/garbage collection, and keeping references to utterance objects. Basically logging, which has recently been reduced (see #7), prevented the speech synthesis from loosing weak references to individual utterances after the garbage collector killed the popup (which triggers speech when clicking the Talkie button) objects/memory.
This seems to be related to long-standing bugs in Chrome; see comments in code example (//IMPORTANT!! Do not remove: Logging the object out fixes some onend firing issues.
).
https://bugs.chromium.org/p/chromium/issues/detail?id=335907#c34
Either way, keeping attaching a reference to the current const utterance = new window.SpeechSynthesisUtterance(textPart);
on the background's window
object (despite it being created from there) seems to prevent problems after the popup (where the speech was triggered from) has been unloaded.
Reported by @rob--w: