Skip to content

Commit

Permalink
Fix TTS paused after forward/backward (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrox authored Jan 8, 2025
1 parent 89b2eba commit 3e43905
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 1 addition & 3 deletions apps/readest-app/src/services/tts/TTSController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand All @@ -47,8 +47,6 @@ export class TTSController extends EventTarget {

if (lastCode === 'end') {
this.forward();
} else {
this.state = 'paused';
}
}

Expand Down
3 changes: 2 additions & 1 deletion apps/readest-app/src/services/tts/WebSpeechClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

1 comment on commit 3e43905

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for readest-web ready!

✅ Preview
https://readest-czfv70p9x-readest.vercel.app

Built with commit 3e43905.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.