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

The read-only property RTCPeerConnection.iceGatheringState returns an enum of type RTCIceGatheringState that describes connection's ICE gathering state. This lets you detect, for example, when collection of ICE candidates has finished.

You can detect when the value of this property changes by watching for an event of type icegatheringstatechange .

句法

 var state = RTCPeerConnection.iceGatheringState;
					

The possible values are those of an enum of type RTCIceGatheringState .

RTCIceGatheringState enum

RTCIceGatheringState enum defines string constants which reflect the current status of ICE gathering, as returned using the RTCPeerConnection.iceGatheringState property. You can detect when this value changes by watching for an event of type icegatheringstatechange .

常量 描述
"new" The peer connection was just created and hasn't done any networking yet.
"gathering" The ICE agent is in the process of gathering candidates for the connection.
"complete" The ICE agent has finished gathering candidates. If something happens that requires collecting new candidates, such as a new interface being added or the addition of a new ICE server, the state will revert to "gathering" to gather those candidates.

范例

var pc = new RTCPeerConnection();
var state = pc.iceGatheringState;
					

规范

规范 状态 注释
WebRTC 1.0: Real-time Communication Between Browsers
The definition of 'RTCPeerConnection.iceGatheringState' in that specification.
候选推荐 最初的规范。

浏览器兼容性

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
iceGatheringState Chrome 25 Edge 15 Firefox 22 IE No Opera 43
43
Promise-based version.
不支持 37 — 43
Safari 11 WebView Android Yes Chrome Android 25 Firefox Android 44 Opera Android 43
43
Promise-based version.
不支持 37 — 43
Safari iOS Yes Samsung Internet Android 6.0

图例

完整支持

完整支持

不支持

不支持

见实现注意事项。

另请参阅

元数据

  • 最后修改: