一行代码纯前端播放文本内容

window.speechSynthesis.speak(new window.SpeechSynthesisUtterance('你好,世界!'))

* 可以复制到控制台试听效果

更多资料请见:

https://www.zhangxinxu.com/wordpress/2017/01/html5-speech-recognition-synthesis-api/

https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisUtterance/SpeechSynthesisUtterance

猜你喜欢

转载自blog.csdn.net/byc233518/article/details/91643005