这是
实验性技术
检查
浏览器兼容性表格
要小心谨慎在生产中使用这之前。
localService
只读特性在
SpeechSynthesisVoice
interface returns a
布尔
indicating whether the voice is supplied by a local speech synthesizer service (
true
), or a remote speech synthesizer service (
false
)。
This property is provided to allow differentiation in the case that some voice options are provided by a remote service; it is possible that remote voices might have extra latency, bandwidth or cost associated with them, so such distinction may be useful.
var amILocal = speechSynthesisVoiceInstance.localService;
A
布尔
.
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].localService);
option.setAttribute('data-lang', voices[i].lang);
option.setAttribute('data-name', voices[i].name);
voiceSelect.appendChild(option);
}
| 规范 | 状态 | 注释 |
|---|---|---|
|
Web 语音 API
The definition of 'localService' in that specification. |
草案 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
localService
|
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 |
完整支持
不支持
实验。期望将来行为有所改变。
用户必须明确启用此特征。