RTCConfiguration.iceTransportPolicy - Web APIs 编辑
The WebRTC Device API dictionary RTCConfiguration
's iceTransportPolicy
property is a string indicating the transport selection policy the ICE agent should use during negotiation of connections. Its value must come from the RTCIceTransportPolicy
enumerated type.
If this property isn't included in the RTCConfiguration
, the default value, all
, is used.
Syntax
let rtcConfiguration = { iceTransportPolicy: policy }; rtcConfiguration.iceTransportPolicy = policy; let policy = rtcConfiguration.iceTransportPolicy;
Value
A DOMString
which indicates what ICE candidate policy the ICE agent should use during the negotiation process, per the JSEP standard. The permitted values are:
all
- The ICE agent is permitted to use any kind of candidate, including both local and relay candidates. The agent—or the browser itself—may still perform some form of IP filtering on the incoming candidates for reasons including privacy and security, as well as to limit the number of candidates. This is the default.
relay
The ICE agent only considers media relay candidates when evaluating candidates. This includes, for example, those candidates relayed by a STUN or TURN server.
This can be used to prevent the remote endpoint from receiving the user's IP addresses, which may be important in some security situations. For example, in a video calling application, the app may want to prevent unknown callers from learning the callee's IP addresses until the callee has agreed to receive the call.
Examples
In this example, a new connection is configured to only accept relay candidates.
let config = {
iceServers: [
{
urls: [ "stun:stun.example.com" ]
},
],
iceTransportPolicy: "relay"
};
let pc = new RTCPeerConnection(config);
Specifications
Specification | Status | Comment |
---|---|---|
WebRTC 1.0: Real-time Communication Between Browsers The definition of 'RTCCandidate.iceTransportPolicy' in that specification. | Candidate Recommendation | Initial definition. |
Browser compatibility
BCD tables only load in the browser
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论