SpeechSynthesisUtterance
SpeechSynthesisUtterance
<!DOCTYPE html> <meta charset="utf-8"> <p>This page immediately calls speechSynthesis.speak(new SpeechSynthesisUtterance("hello world")) <button onclick="speak();">Press to manually speak</button> <script> function speak() { //speechSynthesis.speak(new SpeechSynthesisUtterance("在做项目的过程中,经常会遇到场景是客户要求播放语音的场景,所以将JS实现文字转语音播放的各种实现方式做统一整理。")); var u = new SpeechSynthesisUtterance(); u.text = "在做项目的过程中,经常会遇到场景是客户要求播放语音的场景,所以将"; u.lang = 'zh'; u.rate = 0.7; speechSynthesis.speak(u); } speak(); </script>
##########################################
QQ 3087438119