SpeechSynthesisVoice:voiceURI 属性
SpeechSynthesisVoice 接口的 voiceURI 只读属性返回此语音的语音合成服务的 URI 类型和位置。
值
一个表示语音 URI 的字符串。这是一个通用 URI,可以指向本地或远程服务,例如,它可能是专有系统 URN 或远程服务的 URL。
示例
js
for (const voice of voices) {
const option = document.createElement("option");
option.textContent = `${voice.name} (${voice.lang})`;
if (voice.default) {
option.textContent += " — DEFAULT";
}
console.log(voice.voiceURI);
// On Mac, this returns URNs, for example 'urn:moz-tts:osx:com.apple.speech.synthesis.voice.daniel'
option.setAttribute("data-lang", voice.lang);
option.setAttribute("data-name", voice.name);
voiceSelect.appendChild(option);
}
规范
| 规范 |
|---|
| Web Speech API # dom-speechsynthesisvoice-voiceuri |
浏览器兼容性
加载中…