RTCIceCandidate
interface's read-only
协议
property is a string which indicates whether the candidate uses
UDP
or
TCP
as its transport protocol.
协议
is
null
by default if not specified properly in the SDP, but this is an error condition and will result in a thrown exception when you call
RTCPeerConnection.addIceCandidate()
.
协议
property's value is set when the
RTCIceCandidate()
constructor is used. The value is automatically extracted from the
candidate
a-line, if it's formatted properly.
var protocol = RTCIceCandidate.protocol;
A
DOMString
which indicates what network protocol the candidate uses, UDP or TCP. These values are defined by the enumerated type
RTCIceProtocol
:
tcp
tcpType
property provides additional information about the kind of TCP candidate represented by the object.
udp
注意:
若
协议
is
null
— and
协议
is supported by the
用户代理
— passing the candidate to
addIceCandidate()
will fail, throwing an
OperationError
异常。
Here's an example candidate a-line from an ICE transaction:
a=candidate:4234997325 1 udp 2043278322 192.168.0.56 44323 typ host
The third field,
"udp"
, is the protocol type, indicating that the candidate would use the UDP transport protocol.
This code snippet examines the value of
协议
to decide if it should look at the value of
tcpType
to see if it's a
simultaneous-open
(
S-O
) candidate.
if (candidate.protocol == "tcp") {
if (candidate.tcpType == "so") {
adjustForSimultaneousOpen(candidate);
}
| 规范 | 状态 | 注释 |
|---|---|---|
|
WebRTC 1.0: Real-time Communication Between Browsers
The definition of 'RTCIceCandidate.protocol' in that specification. |
候选推荐 | 初始定义。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
协议
|
Chrome 74 | Edge ≤18 | Firefox 不支持 No | IE 不支持 No | Opera 不支持 No | Safari ? | WebView Android 74 | Chrome Android 74 | Firefox Android 不支持 No | Opera Android 不支持 No | Safari iOS ? | Samsung Internet Android 11.0 |
完整支持
不支持
兼容性未知
RTCIceCandidate
MediaDevices.getUserMedia()
Navigator.mediaDevices
RTCCertificate
RTCDTMFSender
RTCDTMFToneChangeEvent
RTCDataChannel
RTCDataChannelEvent
RTCDtlsTransport
RTCErrorEvent
RTCIceTransport
RTCPeerConnection
RTCPeerConnectionIceErrorEvent
RTCPeerConnectionIceEvent
RTCRtpReceiver
RTCRtpSender
RTCRtpTransceiver
RTCSctpTransport
RTCSessionDescription
RTCStatsEvent
RTCStatsReport
RTCTrackEvent