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.
addressOptional- 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
ipand only accepted IP addresses. candidateTypeOptional- A string matching one of the values in the
RTCIceCandidateTypeenumerated type, indicating what kind of candidate the object provides statistics for. deletedOptional- 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 istrueif the candidate has been deleted or released. For host candidates,truemeans 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. networkTypeOptional- A string from the
RTCNetworkTypeenumerated type which indicates the type of interface used for a local candidate. This property is only present for local candidates. portOptional- The network port number used by the candidate.
priorityOptional- The candidate's priority, corresponding to
RTCIceCandidate.priority. protocolOptional- A string specifying the protocol (
tcporudp) used to transmit data on theport. relayProtocolOptional- A string identifying the protocol used by the endpoint for communicating with the TURN server; valid values are
tcp,udp, andtls. Only present for local candidates. transportIdOptional- A string uniquely identifiying the transport object that was inspected in order to obtain the
RTCTransportStatsassociated with the candidate correspondin to these statistics. urlOptional- For local candidates, the
urlproperty is the URL of the ICE server from which the candidate was received. This URL matches the one included in theRTCPeerConnectionIceEventobject representing theicecandidateevent 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
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
RTCIceCandidateStats | Chrome No support No | Edge No support No | Firefox Full support 27 | IE No support No | Opera ? | Safari ? | WebView Android No support No | Chrome Android No support No | Firefox Android Full support 27 | Opera Android ? | Safari iOS ? | Samsung Internet Android No support No |
address | Chrome No support No | Edge No support No | Firefox
Full support
65
| IE No support No | Opera ? | Safari ? | WebView Android No support No | Chrome Android No support No | Firefox Android
Full support
65
| Opera Android ? | Safari iOS ? | Samsung Internet Android No support No |
candidateType | Chrome No support No | Edge No support No | Firefox Full support 27 | IE No support No | Opera ? | Safari ? | WebView Android No support No | Chrome Android No support No | Firefox Android Full support 27 | Opera Android ? | Safari iOS ? | Samsung Internet Android No support No |
componentId | Chrome No support No | Edge No support No | Firefox
Full support
29
| IE No support No | Opera ? | Safari ? | WebView Android No support No | Chrome Android No support No | Firefox Android
Full support
29
| Opera Android ? | Safari iOS ? | Samsung Internet Android No support No |
deleted | Chrome No support No | Edge No support No | Firefox No support No | IE No support No | Opera ? | Safari ? | WebView Android No support No | Chrome Android No support No | Firefox Android No support No | Opera Android ? | Safari iOS ? | Samsung Internet Android No support No |
networkType | Chrome No support No | Edge No support No | Firefox No support No | IE No support No | Opera ? | Safari ? | WebView Android No support No | Chrome Android No support No | Firefox Android No support No | Opera Android ? | Safari iOS ? | Samsung Internet Android No support No |
port | Chrome No support No | Edge No support No | Firefox
Full support
27
| IE No support No | Opera ? | Safari ? | WebView Android No support No | Chrome Android No support No | Firefox Android
Full support
27
| Opera Android ? | Safari iOS ? | Samsung Internet Android No support No |
priority | Chrome No support No | Edge No support No | Firefox No support No | IE No support No | Opera ? | Safari ? | WebView Android No support No | Chrome Android No support No | Firefox Android No support No | Opera Android ? | Safari iOS ? | Samsung Internet Android No support No |
protocol | Chrome No support No | Edge No support No | Firefox
Full support
64
| IE No support No | Opera ? | Safari ? | WebView Android No support No | Chrome Android No support No | Firefox Android
Full support
64
| Opera Android ? | Safari iOS ? | Samsung Internet Android No support No |
relayProtocol | Chrome No support No | Edge No support No | Firefox
Full support
64
| IE No support No | Opera ? | Safari ? | WebView Android No support No | Chrome Android No support No | Firefox Android
Full support
64
| Opera Android ? | Safari iOS ? | Samsung Internet Android No support No |
transportId | Chrome No support No | Edge No support No | Firefox
Full support
31
| IE No support No | Opera ? | Safari ? | WebView Android No support No | Chrome Android No support No | Firefox Android
Full support
31
| Opera Android ? | Safari iOS ? | Samsung Internet Android No support No |
url | Chrome No support No | Edge No support No | Firefox No support No | IE No support No | Opera ? | Safari ? | WebView Android No support No | Chrome Android No support No | Firefox Android No support No | Opera 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.
