Skip to content
Open
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
3170c73
fix: resumeInfinity/onresume interaction
tuncayuk Nov 26, 2025
15614f1
chore: ensure target is a SpeechSynthesisUtterance in resumeInfinity …
tuncayuk Dec 2, 2025
f35ab5e
fix: ensure infinityTimer is checked against null in clear and resume…
tuncayuk Dec 2, 2025
910df0c
fix: ensure resumeFromKeepAlive is strictly checked for true in onres…
tuncayuk Dec 2, 2025
ecb2ddc
fix: improve utterance management and error handling in speech synthesis
tuncayuk Dec 3, 2025
d43ee72
chore: add placeholder for getVoices method in speech synthesis
tuncayuk Dec 3, 2025
3e56c9d
chore: improve error handling in speak function of speech synthesis
tuncayuk Dec 3, 2025
d2721b6
chore: enhance queue management and debounce handling in announcer
tuncayuk Dec 3, 2025
6aa4a19
fix: add optional chaining to safely check timer state in resumeInfin…
tuncayuk Dec 3, 2025
a1ebc94
fix: enhance stop and clear functions to ensure clean state in speech…
tuncayuk Dec 3, 2025
9910a08
fix: add double-check for utterance existence before resuming in resu…
tuncayuk Dec 3, 2025
624604f
fix: add early return in clear function to handle non-existent state
tuncayuk Dec 4, 2025
fa88731
chore: remove unused pause event handling in speak function
tuncayuk Dec 4, 2025
4fb38de
fix: add cancelPrevious option to AnnouncerUtterance for managing spe…
tuncayuk Dec 4, 2025
cc30b5e
chore: simplify stop api
tuncayuk Dec 4, 2025
3a1a66e
fix: increase debounce duration in processQueue to improve performance
tuncayuk Dec 5, 2025
7d842ee
fix: add waitForSynthReady function to ensure speech synthesis engine…
tuncayuk Dec 5, 2025
41aa289
fix: add enableUtteranceKeepAlive option to improve speech synthesis …
tuncayuk Dec 5, 2025
6f3a1ae
fix: remove previous resolve function in clear method
tuncayuk Dec 8, 2025
2c5255f
fix: remove redundant utterances.delete calls in clear and startKeepA…
tuncayuk Dec 8, 2025
8e9d109
fix: log result of speaking in processQueue for better debugging
tuncayuk Dec 8, 2025
4dc14df
fix: include result in onend callback of speak function for better ha…
tuncayuk Dec 8, 2025
8441944
Removed unneeded variable assignments.
michielvandergeest Dec 23, 2025
9959d92
Removed debug log.
michielvandergeest Dec 23, 2025
1d4884e
Removed debug log and renamed variable.
michielvandergeest Dec 23, 2025
6e128c3
fix: update clear function to accept cancelPrevious option for better…
tuncayuk Jan 2, 2026
0be466c
fix: replace optional chaining with explicit null checks for timer in…
tuncayuk Jan 2, 2026
eea2d60
fix: remove invalid utterance check in startKeepAlive function
tuncayuk Jan 2, 2026
ab06ead
fix: ensure initialized is set to false when speech synthesis API is …
tuncayuk Jan 2, 2026
3cc5d28
fix: change log level from warn to debug for speech synthesis readiness
tuncayuk Jan 2, 2026
560067e
fix: refactor enableUtteranceKeepAlive option to use a constant for b…
tuncayuk Jan 7, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion src/announcer/speechSynthesis.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,24 @@ const clear = () => {
}
}

let resumeFromKeepAlive = false

const resumeInfinity = (target) => {
if (!target || infinityTimer) {
// If the utterance is gone, just stop the keep-alive loop.
if (!target) {
return clear()
}

// We only ever want ONE keep-alive timer running per utterance.
// If there's an existing timer, cancel it and start a fresh one below.
if (infinityTimer) {
clearTimeout(infinityTimer)
infinityTimer = null
}

syn.pause()
setTimeout(() => {
resumeFromKeepAlive = true
syn.resume()
}, 0)

Expand Down Expand Up @@ -78,6 +89,13 @@ const speak = (options) => {
}

utterance.onresume = () => {
// Ignore resume events that we *know* came from our own keep-alive (the pause()/resume() in resumeInfinity).
if (resumeFromKeepAlive) {
resumeFromKeepAlive = false
return
}

// For any other real resume event (e.g. user or platform resuming a previously paused utterance).
resumeInfinity(utterance)
}
}
Expand Down