Web/API/RTCIceCandidate/RTCIceCandidate

From Get docs


The RTCIceCandidate() constructor creates and returns a new RTCIceCandidate object, which can be configured to represent a single ICE candidate.

Syntax

candidate = new RTCIceCandidate([candidateInfo]);

Parameters

candidateInfo Optional
An optional RTCIceCandidateInit object providing information about the candidate; if this is provided, the candidate is initialized configured to represent the described candidate.

Return value

A newly-created RTCIceCandidate object, optionally configured based on the specified object based on the RTCIceCandidateInit dictionary.

If candidateInfo is provided, the new RTCIceCandidate is initialized as follows:

Note: Parsing of the candidate string is performed using the candidate-attribute grammar from the WebRTC Specification.


Exceptions

TypeError
The specified RTCIceCandidateInit has values of null in both the sdpMid and sdpMLineIndex properties.

Usage notes

This constructor does not do complete validation of the specified candidateInfo object or string.

Specifications

Specification Status Comment
WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCIceCandidate()' in that specification. Candidate Recommendation Initial definition.

Browser compatibility

Update compatibility data on GitHub

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
RTCIceCandidate() constructor Chrome

Full support Yes

Edge

Full support ≤18

Firefox Full support 22

Notes'

Full support 22

Notes'

Notes' Before Firefox 68, the constructor's options parameter was required.

IE

No support No

Opera

Full support Yes

Safari

?

WebView Android

Full support Yes

Chrome Android

Full support Yes

Firefox Android Full support Yes

Notes'

Full support Yes

Notes'

Notes' Before Firefox 68, the constructor's options parameter was required.

Opera Android

Full support Yes

Safari iOS

?

Samsung Internet Android

Full support Yes

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown
See implementation notes.'
See implementation notes.


See also