Movatterモバイル変換


[0]ホーム

URL:


MDN Web Docs

RTCIceCandidateStats

BaselineWidely available *

TheRTCIceCandidateStats dictionary of theWebRTC API is used to report statistics related to anRTCIceCandidate.

The statistics can be obtained by iterating theRTCStatsReport returned byRTCPeerConnection.getStats() until you find a report with thetype oflocal-candidate.

Instance properties

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 namedip and only accepted IP addresses.Corresponds toRTCIceCandidate.address.

candidateType

A string matching one of the values inRTCIceCandidate.type, indicating what kind of candidate the object provides statistics for.

deleted

A boolean indicating whether or not the candidate has been deleted or released.

foundationOptionalExperimental

A string that uniquely identifies the candidate across multiple transports.Corresponds toRTCIceCandidate.foundation.

portOptional

The network port number used by the candidate.Corresponds toRTCIceCandidate.port.

priorityOptional

The candidate's priority.Corresponds toRTCIceCandidate.priority.

protocolOptional

A string specifying the protocol (tcp orudp) used to transmit data on theport.Corresponds toRTCIceCandidate.protocol.

relayProtocol

A string specifying the protocol being used by a localICE candidate to communicate with theTURN server.

transportId

A string uniquely identifying the transport object that was inspected in order to obtain theRTCTransportStats associated with the candidate corresponding to these statistics.

urlOptional

A string specifying the URL of theICE server from which the described candidate was obtained. This property isonly available for local candidates.

usernameFragmentOptionalExperimental

A string containing the ICE username fragment ("ice-ufrag").Corresponds toRTCIceCandidate.usernameFragment.

Common instance properties

The following properties are common to all WebRTC statistics objects.

id

A string that uniquely identifies the object that is being monitored to produce this set of statistics.

timestamp

ADOMHighResTimeStamp object indicating the time at which the sample was taken for this statistics object.

type

A string with the value"local-candidate", indicating the type of statistics that the object contains.

Examples

Given a variablemyPeerConnection, which is an instance ofRTCPeerConnection, the code below usesawait to wait for the statistics report, and then iterates it usingRTCStatsReport.forEach().It then filters the dictionaries for just those reports that have the type oflocal-candidate and logs the result.

js
const stats = await myPeerConnection.getStats();stats.forEach((report) => {  if (report.type === "local-candidate") {    // Log the ICE candidate information    console.log(report);  }});

Specifications

Specification
Identifiers for WebRTC's Statistics API
# dom-rtcstatstype-local-candidate

Browser compatibility

Help improve MDN

Learn how to contribute.

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp