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

SpecificationStatusComment
WebRTC 1.0: Real-time Communication Between Browsers
The definition of 'RTCCandidate.iceTransportPolicy' in that specification.
Candidate RecommendationInitial definition.

Browser compatibility

BCD tables only load in the browser

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:95 次

字数:3744

最后编辑:7年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文