示例
<script type="text/javascript">
//文本合成语音,并播放
function speechSynthesisSpeak(lang, text) {
if (!window.speechSynthesis || !window.speechSynthesis.getVoices || !window.SpeechSynthesisUtterance) {
console.error("浏览器不支持文本合成语音,请更换浏览器使用!");
return;
}
//播放合成语音
function speak(lang, text) {
getSpeech(lang).then