The RTCIceCandidate
()
constructor creates and returns a new RTCIceCandidate
object, which can be configured to represent a single ICE candidate.
candidate = new RTCIceCandidate([candidateInfo]);
candidateInfo
Optional
RTCIceCandidateInit
object providing information about the candidate; if this is provided, the candidate is initialized configured to represent the described candidate.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:
RTCIceCandidateInit
object is initialized to the value of the property by the same name from RTCIceCandidateInit
. This includes the candidate
, sdpMid
, sdpMLineIndex
, and usernameFragment
properties.candidate
string (which is SDP text) is parsed; each property found is stored in the corresponding field in the RTCIceCandidate
. If any of the fields is invalid, parsing of the string silently aborts without throwing an exception.null
if they are not included in the RTCIceCandidate.candidate
property: foundation
, component
, priority
, ip
, protocol
, port
, type
, tcpType
, relatedAddress
, and relatedPort
.Note: Parsing of the candidate
string is performed using the candidate-attribute grammar from the WebRTC Specification.
TypeError
RTCIceCandidateInit
has values of null
in both the sdpMid
and sdpMLineIndex
properties.This constructor does not do complete validation of the specified candidateInfo
object or string.
Specification | Status | Comment |
---|---|---|
WebRTC 1.0: Real-time Communication Between Browsers The definition of 'RTCIceCandidate()' in that specification. | Candidate Recommendation | Initial definition. |
Desktop | ||||||
---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
Basic support | Yes | Yes | 22 | ? | Yes | ? |
Mobile | |||||||
---|---|---|---|---|---|---|---|
Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
Basic support | Yes | Yes | Yes | ? | Yes | ? | Yes |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/RTCIceCandidate/RTCIceCandidate