RTCIceTransport: getRemoteCandidates() method

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

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 RTCPeerConnection.addIceCandidate() to add a received candidate to the ICE session, the ICE agent places it in the list returned by this function.

Syntax

js
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 RTCIceTransport.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.

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

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

Specifications

Specification
WebRTC: Real-Time Communication in Browsers
# dom-rtcicetransport-getremotecandidates

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
getRemoteCandidates
Chrome – Full support
Chrome 75 (Release date: 2019-06-04)
footnote Full support
Edge – Full support
Edge 13 (Release date: 2015-11-12)
footnote Full support
Firefox – No support
Firefox
footnote No support
Opera – Full support
Opera 62 (Release date: 2019-06-27)
footnote Full support
Safari – No support
Safari
footnote No support
Chrome Android – Full support
Chrome Android 75 (Release date: 2019-06-04)
footnote Full support
Firefox for Android – No support
Firefox for Android
footnote No support
Opera Android – Full support
Opera Android 54 (Release date: 2019-10-18)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote No support
Samsung Internet – Full support
Samsung Internet 11 (Release date: 2019-12-05)
footnote Full support
WebView Android – Full support
WebView Android 75 (Release date: 2019-06-04)
footnote Full support
WebView on iOS – No support
WebView on iOS
footnote No support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support