js 调用edge浏览器 read aloud 功能

180it 2023-04-11 PM 455℃ 0条
<script>

const voices = speechSynthesis.getVoices()
function speakbyvoice(text, voice) {
    var utter = new SpeechSynthesisUtterance(text)
    for (let v of voices) {
        if (v.name.includes(voice)) {
            utter.voice = v
            break
        }
    }
    speechSynthesis.speak(utter)
    return utter
}
speakbyvoice("你好中国", "Xiaoxiao")

</script>
支付宝打赏支付宝打赏 微信打赏微信打赏

如果文章或资源对您有帮助,欢迎打赏作者。一路走来,感谢有您!

标签: none

js 调用edge浏览器 read aloud 功能