Dont use ssml as firefox reads the markup aloud

This commit is contained in:
Kovid Goyal 2021-08-05 10:33:53 +05:30
parent 211c182462
commit 911e2b22e9
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -28,7 +28,6 @@ class Client:
max_rate = 2 max_rate = 2
def __init__(self): def __init__(self):
self.escape_for_xml = escaper()
self.stop_requested_at = None self.stop_requested_at = None
self.status = {'synthesizing': False, 'paused': False} self.status = {'synthesizing': False, 'paused': False}
self.queue = v'[]' self.queue = v'[]'
@ -133,7 +132,7 @@ class Client:
nonlocal buf, size nonlocal buf, size
text = buf.join('') text = buf.join('')
if text.length: if text.length:
self.create_utterance(text, True) self.create_utterance(text)
buf = v'[]' buf = v'[]'
size = 0 size = 0
@ -145,17 +144,16 @@ class Client:
# markup = '<mark name="' + x + '"/>' # markup = '<mark name="' + x + '"/>'
continue continue
else: else:
markup = self.escape_for_xml(x) if x.length > limit:
if markup.length > limit:
commit() commit()
while x.length: while x.length:
self.create_utterance(self.escape_for_xml(x[:4096]), True) self.create_utterance(x[:limit])
x = x[4096:] x = x[limit:]
continue continue
if size + markup.length > limit: if size + x.length > limit:
commit() commit()
buf.push(markup) buf.push(x)
size += markup.length size += x.length
commit() commit()
if self.queue.length: if self.queue.length:
window.speechSynthesis.speak(self.queue[0]) window.speechSynthesis.speak(self.queue[0])