此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

View in English Always switch to English

RTCPeerConnectionIceEvent

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2018年9月.

RTCPeerConnectionIceEvent 接口表示与交互式连接建立候选目标(通常是 RTCPeerConnection)相关的事件。

只有一个事件属于这种类型:icecandidate

Event RTCPeerConnectionIceEvent

实例属性

RTCPeerConnectionIceEventEvent,该事件还实现了这些属性。

RTCPeerConnectionIceEvent.candidate 只读

包含与事件相关联的 RTCIceCandidate 候选项,如果此事件指示没有更多的候选项,则为 null

构造函数

RTCPeerConnectionIceEvent()

返回新的 RTCPeerConnectionIceEvent。它接收两个参数,第一个是表示事件类型的字符串;第二个包含它所引用的 RTCIceCandidate 的字典。

实例方法

RTCPeerConnectionIceEventEvent,因此该事件也实现了以下属性。没有特定的 RTCDataChannelEvent 方法。

示例

js
pc.onicecandidate = (ev) => {
  console.log(
    `交互式连接候选地址(传输地址:“${ev.candidate.candidate}”)已添加到连接中。`,
  );
};

规范

Specification
WebRTC: Real-Time Communication in Browsers
# rtcpeerconnectioniceevent

浏览器兼容性

参见