Firefox Tomorrow

web api instance method

RTCIceTransport: getRemoteCandidates() method

View on MDN ↗

The getRemoteCandidates() method of the RTCIceTransport interface returns an array that contains one RTCIceCandidate for each of the candidates that have been received from the remote peer so far during the current ICE gathering session.

Each time your signaling code calls addIceCandidate() to add a received candidate to the ICE session, the ICE agent places it in the list returned by this function.

Syntax

getRemoteCandidates()

Parameters

None.

Return value

An array containing one RTCIceCandidate object for each candidate that has been received so far from the remote peer during the current ICE candidate gathering session.

It’s important to keep in mind that there’s no way to correlate these remote candidates with compatible local candidates. To find the best match found so far, call getSelectedCandidatePair().

Example

This simple example gets the remote candidate list from the RTCIceTransport for the first RTCRtpSender on the RTCPeerConnection, then outputs to the console all of the candidates in the list.

const remoteCandidates = pc
  .getSenders()[0]
  .transport.transport.getRemoteCandidates();

remoteCandidates.forEach((candidate, index) => {
  console.log(`Candidate ${index}: ${candidate.candidate}`);
});

Specifications

SpecificationsStandards references are available on the canonical MDN page.

Browser compatibility

Browser compatibilityCompatibility data is available on the canonical MDN page.