HTML:标记语言
CSS:样式语言
JavaScript:脚本语言
Web API:编程接口
所有 Web 技术
学习 Web 开发
发现我们的工具
更好地了解 MDN
此功能已成熟,并可在多种设备和浏览器版本上使用。自 2018 年 9 月以来,它已在各种浏览器中推出。
charIndex 是 SpeechSynthesisEvent 接口的一个只读属性,它返回当事件被触发时,正在被朗读的字符在 SpeechSynthesisUtterance.text 中的索引位置。
charIndex
SpeechSynthesisEvent
SpeechSynthesisUtterance.text
一个数字。
utterThis.onpause = (event) => { const char = event.utterance.text.charAt(event.charIndex); console.log( `Speech paused at character ${event.charIndex} of "${event.utterance.text}", which is "${char}".`, ); };
加载中…