WebRTC
The RTCIceTransport interface provides access to information about the ICE transport layer over which the data is being sent and received.
This is particularly useful if you need to access state information about the connection.
Instance properties
The RTCIceTransport interface inherits properties from its parent, EventTarget. It also offers the following properties:
- RTCIceTransport.component
- : The ICE component being used by the transport. The value is one of the strings from the
RTCIceTransportenumerated type:RTPor"RTSP".
- : The ICE component being used by the transport. The value is one of the strings from the
- RTCIceTransport.gatheringState
- : A string indicating which current gathering state of the ICE agent:
"new","gathering", or"complete".
- : A string indicating which current gathering state of the ICE agent:
- RTCIceTransport.role
- : Returns a string whose value is either
"controlling"or"controlled"; this indicates whether the ICE agent is the one that makes the final decision as to the candidate pair to use or not.
- : Returns a string whose value is either
- RTCIceTransport.state
- : A string indicating what the current state of the ICE agent is. The value of
statecan be used to determine whether the ICE agent has made an initial connection using a viable candidate pair ("connected"), made its final selection of candidate pairs ("completed"), or in an error state ("failed"), among other states.
- : A string indicating what the current state of the ICE agent is. The value of
Instance methods
Also includes methods from EventTarget, the parent interface.
- RTCIceTransport.getLocalCandidates
- : Returns an array of RTCIceCandidate objects, each describing one of the ICE candidates that have been gathered so far for the local device. These are the same candidates which have already been sent to the remote peer by sending an RTCPeerConnection.icecandidate_event event to the RTCPeerConnection for transmission.
- RTCIceTransport.getLocalParameters
- : Returns a RTCIceParameters object describing the ICE parameters established by a call to the RTCPeerConnection.setLocalDescription() method. Returns
nullif parameters have not yet been received.
- : Returns a RTCIceParameters object describing the ICE parameters established by a call to the RTCPeerConnection.setLocalDescription() method. Returns
- RTCIceTransport.getRemoteCandidates
- : Returns an array of RTCIceCandidate objects, one for each of the remote device's ICE candidates that have been received by the local end of the RTCPeerConnection and delivered to ICE by calling RTCPeerConnection.addIceCandidate().
- RTCIceTransport.getRemoteParameters
- : Returns a RTCIceParameters object containing the ICE parameters for the remote device, as set by a call to RTCPeerConnection.setRemoteDescription(). If
setRemoteDescription()hasn't been called yet, the return value isnull.
- : Returns a RTCIceParameters object containing the ICE parameters for the remote device, as set by a call to RTCPeerConnection.setRemoteDescription(). If
- RTCIceTransport.getSelectedCandidatePair
- : Returns a RTCIceCandidatePair object that identifies the two candidates—one for each end of the connection—that have been selected so far. It's possible that a better pair will be found and selected later; if you need to keep up with this, watch for the RTCIceTransport.selectedcandidatepairchange_event event. If no candidate pair has been selected yet, the return value is
null.
- : Returns a RTCIceCandidatePair object that identifies the two candidates—one for each end of the connection—that have been selected so far. It's possible that a better pair will be found and selected later; if you need to keep up with this, watch for the RTCIceTransport.selectedcandidatepairchange_event event. If no candidate pair has been selected yet, the return value is
Events
Listen to these events using EventTarget.addEventListener or by assigning an event listener to the oneventname property of this interface.
- RTCIceTransport.gatheringstatechange_event
- : Sent to the
RTCIceTransportobject to indicate that the value of the RTCIceTransport.gatheringState property has changed, indicating a change in this transport's ICE candidate negotiation process. Also available through the RTCIceTransport.gatheringstatechange_event event handler property.
- : Sent to the
- RTCIceTransport.selectedcandidatepairchange_event
- : Sent to the
RTCIceTransportwhen a new, better pair of candidates has been selected to describe the connectivity between the two peers. This occurs during negotiation or renegotiation, including after an ICE restart, which reuses the existingRTCIceTransportobjects. The current candidate pair can be obtained using RTCIceTransport.getSelectedCandidatePair. Also available using the RTCIceTransport.selectedcandidatepairchange_event event handler property.
- : Sent to the
- RTCIceTransport.statechange_event
- : Sent to the
RTCIceTransportinstance when the value of the RTCIceTransport.state property has changed, indicating that the ICE gathering process has changed state. Also available through the RTCIceTransport.statechange_event event handler property.
- : Sent to the
Examples
tbd
Specifications
Browser compatibility
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
