<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body onload="myFunction()">
<script>
function myFunction() {
// Create the utterance object setting the chosen parameters
var utterance = new SpeechSynthesisUtterance();
var myarray = new Array(4);
myarray[0] = "Move Bay from door 10 to 20";
utterance.text = myarray[0];
utterance.lang = "ar-uk";
speechSynthesis.speak(utterance);
}
</script>
</body>
</html>
将文本传递给语音合成属性文本,然后尝试将文本转换为语音
最佳答案
看这里:SpeechSynthesisUtterance Docs
IE不支持。