Movatterモバイル変換


[0]ホーム

URL:


MDN Web Docs

RTCPeerConnection: iceConnectionState property

BaselineWidely available

TheiceConnectionState read-only property of theRTCPeerConnection interface returns a string which state of theICE agent associated with theRTCPeerConnection:new,checking,connected,completed,failed,disconnected, andclosed.

It describes the current state of the ICE agent and its connection to the ICE server;that is, theSTUN orTURN server.

You can detect when this value has changed by watching for theiceconnectionstatechange event.

Value

The current state of the ICE agent and its connection. The value is one of the following strings:

new

The ICE agent is gathering addresses or is waiting to be given remote candidates through calls toRTCPeerConnection.addIceCandidate() (or both).

checking

The ICE agent has been given one or more remote candidates and is checking pairs of local and remote candidates against one anotherto try to find a compatible match, but has not yet found a pair which will allow the peer connection to be made.It is possible that gathering of candidates is also still underway.

connected

A usable pairing of local and remote candidates has been found for all components of the connection, and the connection has been established.It is possible that gathering is still underway, and it is also possible that the ICE agent is still checking candidates against one another looking for a better connection to use.

completed

The ICE agent has finished gathering candidates, has checked all pairs against one another, and has found a connection for all components.

failed

The ICE candidate has checked all candidates pairs against one another and has failed to find compatible matches for all components of the connection.It is, however, possible that the ICE agent did find compatible connections for some components.

disconnected

Checks to ensure that components are still connected failed for at least one component of theRTCPeerConnection.This is a less stringent test thanfailed and may trigger intermittently and resolve just as spontaneously on less reliable networks, or during temporary disconnections.When the problem resolves, the connection may return to theconnected state.

closed

The ICE agent for thisRTCPeerConnection has shut down and is no longer handling requests.

Examples

js
const pc = new RTCPeerConnection();const state = pc.iceConnectionState;

Specifications

Specification
WebRTC: Real-Time Communication in Browsers
# dom-peerconnection-ice-connection-state

Browser compatibility

See also

Help improve MDN

Learn how to contribute.

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp