This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for the proper prefixes to use in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the spec changes.
The read-only property RTCPeerConnection.iceConnectionState
returns an enum of type RTCIceConnectionState
that describes the ICE connection state for the connection.
Syntax
var state = peerConnection.iceConnectionState;
Value
The possible values are those of an enum of type RTCIceConnectionState
:
"new"
: the ICE agent is gathering addresses or waiting for remote candidates (or both)."checking"
: the ICE agent has remote candidates, on at least one component, and is check them, though it has not found a connection yet. At the same time, it may still be gathering candidates."connected"
: the ICE agent has found a usable connection for each component, but is still testing more remote candidates for a better connection. At the same time, it may still be gathering candidates."completed"
: the ICE agent has found a usable connection for each component, and is no more testing remote candidates."failed"
: the ICE agent has checked all the remote candidates and didn't find a match for at least one component. Connections may have been found for some components."disconnected"
: liveness check has failed for at least one component. This may be a transient state, e. g. on a flaky network, that can recover by itself."closed"
: the ICE agent has shutdown and is not answering to requests.
Example
var pc = new RTCPeerConnection(); var state = pc.iceConnectionState;
Specifications
Specification | Status | Comment |
---|---|---|
WebRTC 1.0: Real-time Communication Between Browser The definition of 'RTCPeerConnection.iceConnectionState' in that specification. |
Working Draft | Initial specification. |
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | (Yes) [1] | (Yes) [1] | Not supported | (Yes) | ? |
Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | ? | ? | ? | Not supported | ? | ? |
[1] Though this property is not prefixed, the interface it belongs to is.