From 3e439053218e071cf27a2ff458eabd0b4076b5db Mon Sep 17 00:00:00 2001 From: Huang Xin Date: Wed, 8 Jan 2025 15:18:58 +0100 Subject: [PATCH] Fix TTS paused after forward/backward (#123) --- apps/readest-app/src/services/tts/TTSController.ts | 4 +--- apps/readest-app/src/services/tts/WebSpeechClient.ts | 3 ++- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/apps/readest-app/src/services/tts/TTSController.ts b/apps/readest-app/src/services/tts/TTSController.ts index 854fb1a3..4a9d876b 100644 --- a/apps/readest-app/src/services/tts/TTSController.ts +++ b/apps/readest-app/src/services/tts/TTSController.ts @@ -27,7 +27,7 @@ export class TTSController extends EventTarget { if (!ssml) { this.#nossmlCnt++; // FIXME: in case we are at the end of the book, need a better way to handle this - if (this.#nossmlCnt < 100) { + if (this.#nossmlCnt < 10) { await this.view.next(1); this.forward(); } @@ -47,8 +47,6 @@ export class TTSController extends EventTarget { if (lastCode === 'end') { this.forward(); - } else { - this.state = 'paused'; } } diff --git a/apps/readest-app/src/services/tts/WebSpeechClient.ts b/apps/readest-app/src/services/tts/WebSpeechClient.ts index 21e06cab..6c47dc2d 100644 --- a/apps/readest-app/src/services/tts/WebSpeechClient.ts +++ b/apps/readest-app/src/services/tts/WebSpeechClient.ts @@ -72,7 +72,8 @@ function findMark(charIndex: number, marks: TTSMark[]) { async function* speakWithBoundary(ssml: string) { const lang = getXmlLang(ssml); const { plainText, marks } = parseSSMLMarks(ssml); - // console.log('text', ssml, plainText, marks); + // console.log('ssml', ssml, marks); + // console.log('text', plainText); const synth = window.speechSynthesis; const utterance = new SpeechSynthesisUtterance(plainText);