RTCPeerConnectionIceEvent: candidate 屬性

Baseline 已廣泛支援

此功能已成熟,並可在多種裝置和瀏覽器版本上使用。自 2018 年 9 月以來,它已在各種瀏覽器中推出。

RTCPeerConnectionIceEvent 介面的只讀 candidate 屬性會返回與事件關聯的 RTCIceCandidate 物件。

一個 RTCIceCandidate 物件,表示已收到的 ICE 候選,或者 null 表示此協商會話不再有候選。

示例

js
pc.onicecandidate = (ev) => {
  alert(
    `The ICE candidate (transport address: '${ev.candidate.candidate}') has been added to this connection.`,
  );
};

規範

規範
WebRTC:瀏覽器中的即時通訊
# dom-rtcpeerconnectioniceevent-candidate

瀏覽器相容性

另見