You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

React中SpeechSynthesis API朗读15秒停止及分块朗读停顿问题求助

关于SpeechSynthesis API的两个问题求助

我是前端开发者,在React项目中使用SpeechSynthesis API处理长文本朗读时遇到了两个棘手的问题:

  • 最初为了处理长文本,我把内容分割成了150字符左右的片段,但最近发现API存在15秒朗读时长限制,到点就会自动停止。网上搜的旧方案比如设置14秒超时调用resume()已经完全失效。
  • 后来我改成逐个朗读片段的方式,虽然能完整读完全部内容,但片段之间存在明显的停顿,影响朗读流畅度。当前实现代码如下:
let readingText = ["all of my strings", "", ""]; // 存储拆分后的文本片段
const synthesis = speechSynthesis;

readingText.forEach((text, index) => {
    console.log(index, text)
    let utterance = new SpeechSynthesisUtterance(text);
    this.speechSynthesisConfig(utterance);
    synthesis.speak(utterance);
})

想问问有没有人遇到过这个15秒限制的问题并找到了解决办法?或者有什么优化方案能消除片段朗读时的停顿?

提前感谢大家的帮助!


内容的提问来源于stack exchange,提问作者MattiaGiacchini

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.11 22:10:50