Fix TTS paused after forward/backward (#123)
This commit is contained in:
@@ -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';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user