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

MacOS Chrome中Speech Synthesis API无法工作,求验证兼容性

Chrome 113在MacOS 13.2.1中无法运行JSFiddle内的Speech Synthesis代码,但本地应用及其他浏览器正常

我遇到了语音合成功能的异常问题:

  • 在MacOS 13.2.1系统的Chrome 113.0.5672.63浏览器中,一段JSFiddle里的Speech Synthesis代码完全没有语音输出,且代码中的onend事件也不触发(控制台无对应日志)
  • 同一Chrome实例中,我自行开发的Web应用里的语音合成功能运行正常
  • 这段代码在同一设备的Safari和Firefox浏览器中可以正常运行

我现在想确认:其他Chrome用户运行这段代码是否能正常工作?这会帮我决定要投入多少精力排查这个问题。

代码如下:

var wordsToSpeak = [
  'Hello! This text should be longer than sixty or may be more symbols. Please see console log.',
  'Now end event is fired!',
  'You can use global variables to store utterance object.'
];
// this object for storing utterances globally
window.utterances = []; 

function speak(text) {
  var utterance = new SpeechSynthesisUtterance(text);
  utterance.lang = 'en-US';
  utterance.onend = function() {
    // this code is not called
    console.log(text);
  };

  // if you will comment this line, end event will not work!
  utterances.push(utterance);
  
  speechSynthesis.speak(utterance);
}

for (var i = 0; i < wordsToSpeak.length; i++) {
  speak(wordsToSpeak[i])
}

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.22 09:27:28