【发布时间】:2021-10-22 23:56:34
【问题描述】:
点击按钮我想说blue skyen-US语言
此代码导致utterThis.voice 行出错
请帮忙
var synth = window.speechSynthesis;
$('button').on('click', function(){
var utterThis = new SpeechSynthesisUtterance('blue sky');
utterThis.rate = 1;
utterThis.pitch = 1;
utterThis.voice = {voiceURI: 'Google US English', name: 'Google US English', lang: 'en-US', localService: false, default: false};
synth.speak(utterThis);
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<button>CLICK</button>
【问题讨论】:
标签: javascript jquery text-to-speech webapi