RTCIceCandidateStats

The WebRTC API's RTCIceCandidateStats dictionary provides statistics related to an RTCIceCandidate.

Properties

RTCIceCandidateStats is based upon the RTCStats dictionary, so it includes those properties in addition to the ones below.

address Optional
A string containing the address of the candidate. This value may be an IPv4 address, an IPv6 address, or a fully-qualified domain name. This property was previously named ip and only accepted IP addresses.
candidateType Optional
A string matching one of the values in the RTCIceCandidateType enumerated type, indicating what kind of candidate the object provides statistics for.
deleted Optional
A Boolean value indicating whether or not the candidate has been released or deleted; the default value is false. For local candidates, it's value is true if the candidate has been deleted or released. For host candidates, true means that any network resources (usually a network socket) associated with the candidate have already been released. For TURN candidates, the TURN allocation is no longer active for deleted candidates. This property is not present for remote candidates.
networkType Optional
A string from the RTCNetworkType enumerated type which indicates the type of interface used for a local candidate. This property is only present for local candidates.
port Optional
The network port number used by the candidate.
priority Optional
The candidate's priority, corresponding to RTCIceCandidate.priority.
protocol Optional
A string specifying the protocol (tcp or udp) used to transmit data on the port.
relayProtocol Optional
A string identifying the protocol used by the endpoint for communicating with the TURN server; valid values are tcp, udp, and tls. Only present for local candidates.
transportId Optional
A string uniquely identifiying the transport object that was inspected in order to obtain the RTCTransportStats associated with the candidate correspondin to these statistics.
url Optional
For local candidates, the url property is the URL of the ICE server from which the candidate was received. This URL matches the one included in the RTCPeerConnectionIceEvent object representing the icecandidate event that delivered the candidate to the local peer.

Example

This example features a function, isUsableNetworkType(), whose job it is to look at an RTCIceCandidateStats object's networkType and determine whether or not the type of network is acceptable for use.

This function is then called for RTCStats objects whose type is local-candidate, indicating that the object is in fact an RTCIceCandidateStats with information about a local ICE candidate.

const isUsableNetworkType = stats => {
  switch(stats.networkType) {
    case "ethernet":
    case "vpn":
      return true;

    case "bluetooth":
    case "cellular":
    case "wimax":
    case "unknown":
    default:
      return false;
  }
}

if (rtcStats && rtcStats.type === "local-candidate") {
  if (!isUsableNetworkType(rtcStats)) {
    abortConnection();
    return;
  }
}

This code calls a function called abortConnection() if the RTCStats object represents information about a local candidate is which would be using a network connection other than Ethernet or a VPN.

Specifications

Specification Status Comment
Identifiers for WebRTC's Statistics API
The definition of 'RTCIceCandidateStats' in that specification.
Candidate Recommendation Initial specification.

Browser compatibility

DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
RTCIceCandidateStatsChrome No support NoEdge No support NoFirefox Full support 27IE No support NoOpera ? Safari ? WebView Android No support NoChrome Android No support NoFirefox Android Full support 27Opera Android ? Safari iOS ? Samsung Internet Android No support No
addressChrome No support NoEdge No support NoFirefox Full support 65
Full support 65
Full support 27
Alternate Name
Alternate Name Uses the non-standard name: ipAddress
IE No support NoOpera ? Safari ? WebView Android No support NoChrome Android No support NoFirefox Android Full support 65
Full support 65
Full support 27
Alternate Name
Alternate Name Uses the non-standard name: ipAddress
Opera Android ? Safari iOS ? Samsung Internet Android No support No
candidateTypeChrome No support NoEdge No support NoFirefox Full support 27IE No support NoOpera ? Safari ? WebView Android No support NoChrome Android No support NoFirefox Android Full support 27Opera Android ? Safari iOS ? Samsung Internet Android No support No
componentId
Non-standard
Chrome No support NoEdge No support NoFirefox Full support 29
Notes
Full support 29
Notes
Notes componentId is a Firefox-specific property and should not be used in production code.
IE No support NoOpera ? Safari ? WebView Android No support NoChrome Android No support NoFirefox Android Full support 29
Notes
Full support 29
Notes
Notes componentId is a Firefox-specific property and should not be used in production code.
Opera Android ? Safari iOS ? Samsung Internet Android No support No
deletedChrome No support NoEdge No support NoFirefox No support NoIE No support NoOpera ? Safari ? WebView Android No support NoChrome Android No support NoFirefox Android No support NoOpera Android ? Safari iOS ? Samsung Internet Android No support No
networkType
DeprecatedNon-standard
Chrome No support NoEdge No support NoFirefox No support NoIE No support NoOpera ? Safari ? WebView Android No support NoChrome Android No support NoFirefox Android No support NoOpera Android ? Safari iOS ? Samsung Internet Android No support No
portChrome No support NoEdge No support NoFirefox Full support 27
Alternate Name
Full support 27
Alternate Name
Alternate Name Uses the non-standard name: portNumber
IE No support NoOpera ? Safari ? WebView Android No support NoChrome Android No support NoFirefox Android Full support 27
Alternate Name
Full support 27
Alternate Name
Alternate Name Uses the non-standard name: portNumber
Opera Android ? Safari iOS ? Samsung Internet Android No support No
priorityChrome No support NoEdge No support NoFirefox No support NoIE No support NoOpera ? Safari ? WebView Android No support NoChrome Android No support NoFirefox Android No support NoOpera Android ? Safari iOS ? Samsung Internet Android No support No
protocolChrome No support NoEdge No support NoFirefox Full support 64
Full support 64
Full support 31
Alternate Name
Alternate Name Uses the non-standard name: mozLocalTransport
IE No support NoOpera ? Safari ? WebView Android No support NoChrome Android No support NoFirefox Android Full support 64
Full support 64
Full support 31
Alternate Name
Alternate Name Uses the non-standard name: mozLocalTransport
Opera Android ? Safari iOS ? Samsung Internet Android No support No
relayProtocolChrome No support NoEdge No support NoFirefox Full support 64
Full support 64
Full support 31
Alternate Name
Alternate Name Uses the non-standard name: mozLocalTransport
IE No support NoOpera ? Safari ? WebView Android No support NoChrome Android No support NoFirefox Android Full support 64
Full support 64
Full support 31
Alternate Name
Alternate Name Uses the non-standard name: mozLocalTransport
Opera Android ? Safari iOS ? Samsung Internet Android No support No
transportIdChrome No support NoEdge No support NoFirefox Full support 31
Alternate Name
Full support 31
Alternate Name
Alternate Name Uses the non-standard name: transport
IE No support NoOpera ? Safari ? WebView Android No support NoChrome Android No support NoFirefox Android Full support 31
Alternate Name
Full support 31
Alternate Name
Alternate Name Uses the non-standard name: transport
Opera Android ? Safari iOS ? Samsung Internet Android No support No
urlChrome No support NoEdge No support NoFirefox No support NoIE No support NoOpera ? Safari ? WebView Android No support NoChrome Android No support NoFirefox Android No support NoOpera Android ? Safari iOS ? Samsung Internet Android No support No

Legend

Full support
Full support
No support
No support
Compatibility unknown
Compatibility unknown
Non-standard. Expect poor cross-browser support.
Non-standard. Expect poor cross-browser support.
Deprecated. Not for use in new websites.
Deprecated. Not for use in new websites.
See implementation notes.
See implementation notes.
Uses a non-standard name.
Uses a non-standard name.