下面的代码在Chrome DevTools中运行得很好,但是当我通过本地主机运行它时,allVoices返回一个空数组。tts = window.speechSynthesis
// from here code only works if put into DevTools, not from file or localhost
我在使用本机SpeechSynthesisUtterance时遇到了问题(或bug)。我构建了一个基本的函数“take”,它接受给定的字符串"text“,并将其发音。Your browser does not support HTML SpeechSynthesis.")}
这个函数在Safari中很好地工作,选择语音"Alex“,然后在该语音中发音给定的文本另一方面,