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

特性

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

address 可选
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 可选
A string matching one of the values in the RTCIceCandidateType enumerated type, indicating what kind of candidate the object provides statistics for.
deleted 可选
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 可选
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 可选

The network port number used by the candidate.

priority 可选
The candidate's priority, corresponding to RTCIceCandidate.priority .
协议 可选
A string specifying the protocol ( tcp or udp ) used to transmit data on the port .
relayProtocol 可选
A string identifying the protocol used by the endpoint for communicating with the TURN server; valid values are tcp , udp ,和 tls . Only present for local candidates.
transportId 可选
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 可选
For local candidates, the url property is the URL 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.

范例

This example features a function, isUsableNetworkType() , whose job it is to look at an RTCIceCandidateStats 对象的 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":
    默认:
      return false;
  }
}
if (rtcStats && rtcStats.type === "local-candidate") {
  if (!isUsableNetworkType(rtcStats)) {
    abortConnection();
    return;
  }
}
					

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

规范

规范 状态 注释
Identifiers for WebRTC's Statistics API
The definition of 'RTCIceCandidateStats' 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
RTCIceCandidateStats Chrome No Edge No Firefox 27 IE No Opera ? Safari ? WebView Android No Chrome Android No Firefox Android 27 Opera Android ? Safari iOS ? Samsung Internet Android No
address Chrome No Edge No Firefox 65
65
27 Alternate Name
Alternate Name Uses the non-standard name: ipAddress
IE No Opera ? Safari ? WebView Android No Chrome Android No Firefox Android 65
65
27 Alternate Name
Alternate Name Uses the non-standard name: ipAddress
Opera Android ? Safari iOS ? Samsung Internet Android No
candidateType Chrome No Edge No Firefox 27 IE No Opera ? Safari ? WebView Android No Chrome Android No Firefox Android 27 Opera Android ? Safari iOS ? Samsung Internet Android No
componentId 非标 Chrome No Edge No Firefox 29
29
componentId is a Firefox-specific property and should not be used in production code.
IE No Opera ? Safari ? WebView Android No Chrome Android No Firefox Android 29
29
componentId is a Firefox-specific property and should not be used in production code.
Opera Android ? Safari iOS ? Samsung Internet Android No
deleted Chrome No Edge No Firefox No IE No Opera ? Safari ? WebView Android No Chrome Android No Firefox Android No Opera Android ? Safari iOS ? Samsung Internet Android No
networkType 弃用 非标 Chrome No Edge No Firefox No IE No Opera ? Safari ? WebView Android No Chrome Android No Firefox Android No Opera Android ? Safari iOS ? Samsung Internet Android No
port Chrome No Edge No Firefox 27 Alternate Name
27 Alternate Name
Alternate Name Uses the non-standard name: portNumber
IE No Opera ? Safari ? WebView Android No Chrome Android No Firefox Android 27 Alternate Name
27 Alternate Name
Alternate Name Uses the non-standard name: portNumber
Opera Android ? Safari iOS ? Samsung Internet Android No
priority Chrome No Edge No Firefox No IE No Opera ? Safari ? WebView Android No Chrome Android No Firefox Android No Opera Android ? Safari iOS ? Samsung Internet Android No
协议 Chrome No Edge No Firefox 64
64
31 Alternate Name
Alternate Name Uses the non-standard name: mozLocalTransport
IE No Opera ? Safari ? WebView Android No Chrome Android No Firefox Android 64
64
31 Alternate Name
Alternate Name Uses the non-standard name: mozLocalTransport
Opera Android ? Safari iOS ? Samsung Internet Android No
relayProtocol Chrome No Edge No Firefox 64
64
31 Alternate Name
Alternate Name Uses the non-standard name: mozLocalTransport
IE No Opera ? Safari ? WebView Android No Chrome Android No Firefox Android 64
64
31 Alternate Name
Alternate Name Uses the non-standard name: mozLocalTransport
Opera Android ? Safari iOS ? Samsung Internet Android No
transportId Chrome No Edge No Firefox 31 Alternate Name
31 Alternate Name
Alternate Name Uses the non-standard name: transport
IE No Opera ? Safari ? WebView Android No Chrome Android No Firefox Android 31 Alternate Name
31 Alternate Name
Alternate Name Uses the non-standard name: transport
Opera Android ? Safari iOS ? Samsung Internet Android No
url Chrome No Edge No Firefox No IE No Opera ? Safari ? WebView Android No Chrome Android No Firefox Android No Opera Android ? Safari iOS ? Samsung Internet Android No

图例

完整支持

完整支持

不支持

不支持

兼容性未知 ?

兼容性未知

非标。预期跨浏览器支持较差。

非标。预期跨浏览器支持较差。

弃用。不要用于新网站。

弃用。不要用于新网站。

见实现注意事项。

使用非标名称。

元数据

  • 最后修改: