使用SpeechSynthesisUtterance API 时可以选择正在读取的单词吗?
我可以用来获取当前语音和光标位置的事件吗?
这是我到目前为止的内容:
var msg = new SpeechSynthesisUtterance();
var voices = window.speechSynthesis.getVoices();
msg.voice = voices[10]; // Note: some voices don't support altering params
msg.voiceURI = 'native';
msg.volume = 1; // 0 to 1
msg.rate = 1; // 0.1 to 10
msg.pitch = 2; //0 to 2
msg.text = 'Hello World';
msg.lang = 'en-US';
msg.onend = function(e) {
console.log('Finished in ' + event.elapsedTime + ' seconds.');
};
speechSynthesis.speak(msg);
Run Code Online (Sandbox Code Playgroud)
这里的例子。