这是
实验性技术
检查
浏览器兼容性表格
要小心谨慎在生产中使用这之前。
voiceURI
只读特性在
SpeechSynthesisVoice
interface returns the type of URI and location of the speech synthesis service for this voice.
var myVoiceURI = speechSynthesisVoiceInstance.voiceURI;
A
DOMString
representing the URI of the voice. This is a generic URI and can point to local or remote services, e.g. it could be a proprietary system URN or a a URL to a remote service.
for(i = 0; i < voices.length ; i++) {
var option = document.createElement('option');
option.textContent = voices[i].name + ' (' + voices[i].lang + ')';
if(voices[i].default) {
option.textContent += ' -- DEFAULT';
}
console.log(voices[i].voiceURI);
// On Mac, this returns URNs, for example 'urn:moz-tts:osx:com.apple.speech.synthesis.voice.daniel'
option.setAttribute('data-lang', voices[i].lang);
option.setAttribute('data-name', voices[i].name);
voiceSelect.appendChild(option);
}
| 规范 | 状态 | 注释 |
|---|---|---|
|
Web 语音 API
The definition of 'voiceURI' in that specification. |
草案 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
voiceURI
|
Chrome 33 | Edge 14 | Firefox 49 | IE No | Opera 21 | Safari 7 | WebView Android 4.4.3 | Chrome Android 33 |
Firefox Android
62
|
Opera Android No | Safari iOS 7 | Samsung Internet Android 3.0 |
完整支持
不支持
实验。期望将来行为有所改变。
用户必须明确启用此特征。
SpeechSynthesisVoice
default
lang
localService
名称
voiceURI