SpeechSynthesis.speak(在Web Speech API中)在Google Chrome中几秒钟后总是停止 [英] SpeechSynthesis.speak (in Web Speech API) always stops after a few seconds in Google Chrome

查看:4254
本文介绍了SpeechSynthesis.speak(在Web Speech API中)在Google Chrome中几秒钟后总是停止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当在Web Speech API中使用 speak 功能时,在Chrome中,发言停止几秒钟后,在提供给它的文本中间突然停止,看似随机的地方(没有达到最终)。
这只发生在Chrome浏览器(适用于Firefox),在两台不同的计算机/系统上进行测试。



看看这个jsfiddle看看/听:
https://jsfiddle.net/fv9ochpq/



在停止说话之后,您可以看到 SpeechSynthesis 对象 .speaking 标志停留在(true) 。



我没有看到任何传递给话语的文字限制。
这是Google Chrome的错误吗?
顺便说一下,自2014年以来我就已经知道这一点 - 当时我正在尝试为我制作的浏览器扩展添加语音功能(当时的Chrome扩展可以使用TTS API,同样的事情也发生在那里) ,但最终没有这样做,因为这个明显的错误。
现在我想克服这个 - 如果这是一个错误,我会感激任何指导我到最好的地方去报告它的人。

编辑:约15秒后它似乎停止。运行 .resume(),每隔14秒添加一个时间间隔,似乎可以修复这一点。请参阅: https://jsfiddle.net/fv9ochpq/1/

但这是一个黑客。

解决方案

你问哪里报告这个问题。对于程序员,我认为这个论坛是最好的地方。事实上, Chrome语音合成与更长的文本发生了相当多的讨论。但我相信它大部分错误地集中在SpeechSynthesis允许的允许的单词数量,而不是持续时间。实际上,您的解决方案对我来说似乎是最实用的。

Google有一个错误报告功能,并且已报告此问题为语音合成在没有警告的情况下对长文本失败并且阻止API 。它目前共有3份报告,这给了它3颗明星。我们可以通过向这个Chromium Bug添加报告来注意这个问题(我已经添加了一个)。



这个Bug的当前状态是Untriaged;也有趣的是与Chrome SpeechSynthesis相关的其他几个问题


When using the speak function in the Web Speech API, in Chrome the speaking stops abruptly after a few seconds, in the middle of the text given to it, in a seemingly random place (without reaching the end). This only happens in Chrome (works well on Firefox), tested on two different computers/systems.

Have a look at this jsfiddle to see/listen: https://jsfiddle.net/fv9ochpq/

You can see that the SpeechSynthesis object .speaking flag stays on(true) after it stops speaking.

I haven't seen any documented limit to the text passed to the utterance. Is this a Google Chrome bug? BTW, I've known about this since 2014 - when I was trying to add a speech feature to a browser extension I made (back then it was the TTS API available to chrome extensions - same thing happened there as well), but eventually didn't do it because of this apparent bug. Now I want to overcome this - if this is a bug, I will appreciate anyone directing me to the best place to report it.

EDIT: It seem to stop after about 15 seconds. Adding an interval every 14 seconds running .resume() seem to "fix" this. See: https://jsfiddle.net/fv9ochpq/1/
But this is a hack.

解决方案

You asked where to report this problem. For programmers, I think this forum is the best place. In fact considerable discussion has occurred at Chrome Speech Synthesis with longer texts. But I believe much of it mistakenly focuses on the number of words allowed by SpeechSynthesis rather than on duration has you do here. In fact, your solution seems to me the most practical of all.

Google has a bug reporting facility, and the issue has been reported as speechSynthesis fails for long text without warning and blocks the API. It currently has a total of 3 reports, which give it 3 "stars." We may be able to bring attention to the issue by adding reports to this Chromium Bug (I have added one).

Current status of this Bug is "Untriaged;" also of interest are several other reported issues related to Chrome SpeechSynthesis.

这篇关于SpeechSynthesis.speak(在Web Speech API中)在Google Chrome中几秒钟后总是停止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆