这是 实验性技术
检查 浏览器兼容性表格 要小心谨慎在生产中使用这之前。

getDefaultIceServers() 方法在 RTCPeerConnection interface returns an array of objects based on the RTCIceServer dictionary, which indicates what, if any, ICE servers the browser will use by default if none are provided to the RTCPeerConnection 在其 RTCConfiguration . However, browsers are not required to provide any default ICE servers at all.

句法

 var defaultIceServers = RTCPeerConnection.getDefaultIceServers();
					

返回值

An array of ICE servers, specified as objects based on RTCIceServer , which the browser will use if none are specified in the configuration of the RTCPeerConnection . If there are no defaults provided by the browser, the returned array is empty; this property's value is never null .

范例

var pc = new RTCPeerConnection();
var iceServers = pc.getDefaultIceServers();
if (iceServers.length === 0) {
  // Deal with the lack of default ICE servers, possibly by using our own defaults
}
					

规范

规范 状态 注释
WebRTC Extensions

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
getDefaultIceServers Chrome No Edge No Firefox ? IE No Opera ? Safari ? WebView Android No Chrome Android No Firefox Android ? Opera Android ? Safari iOS ? Samsung Internet Android No

图例

不支持

不支持

兼容性未知 ?

兼容性未知

另请参阅

元数据

  • 最后修改: