RTCPeerConnectionIceEvent

Baseline Widely available *

This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.

* Some parts of this feature may have varying levels of support.

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

浏览器兼容性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
RTCPeerConnectionIceEvent
RTCPeerConnectionIceEvent() constructor
candidate
url

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
Uses a non-standard name.
Has more compatibility info.

参见