Skip to content

Commit

Permalink
Deploy hot fix for speech not starting in Chrome
Browse files Browse the repository at this point in the history
  • Loading branch information
vivek-nexus committed Oct 26, 2024
1 parent 1c295b9 commit c0fc5ae
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/components/Player/PlayerControls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,24 @@ export default function PlayerControls() {
setSpeakingSentenceIndex(0)
setPlayerState("playing")

// [TEMPORARY FIX] Chrome desktop suddenly has a new issue — does not start speaking at once. Seems to require a pause/play to start speaking. Need to figure out real reason.
const timeOut1 = setTimeout(() => {
speechSynthesis.cancel()
setPlayerState("paused")
}, 100)

const timeOut2 = setTimeout(() => {
setPlayerState("playing")
}, 500)

// Cancel active speech and reset state variables
return (() => {
speechSynthesis.cancel()
setPlayerState("complete")
setSpeakingSentenceIndex(0)

clearTimeout(timeOut1)
clearTimeout(timeOut2)
})
}, [])

Expand Down

0 comments on commit c0fc5ae

Please sign in to comment.