RTCIceCandidatePair

RTCIceCandidatePair dictionary describes a pair of ICE candidates which together comprise a description of a viable connection between two WebRTC endpoints. It is used as the return value from RTCIceTransport.getSelectedCandidatePair() to identify the currently-selected candidate pair identified by the ICE agent.

特性

local
An RTCIceCandidate describing the configuration of the local end of the connection.
remote
RTCIceCandidate describing the configuration of the remote end of the connection.

范例

In this example, an event handler for selectedcandidatepairchange is set up to update an on-screen display showing the protocol used by the currently selected candidate pair.

var iceTransport = pc.getSenders()[0].transport.iceTransport;
var localProto = document.getElementById("local-protocol");
var remoteProto = document.getElementById("remote-protocol");
iceTransport.onselectedcandidatepairchange = function(event) {
  var pair = iceTransport.getSelectedCandidatePair();
  localProtocol.innerText = pair.local.protocol.toUpperCase();
  remoteProtocol.innerText = pair.remote.protocol.toUpperCase();
}
					

规范

规范 状态 Comment
WebRTC 1.0: Real-time Communication Between Browsers
The definition of 'RTCIceCandidatePair' in that specification.
候选推荐 Initial specification.

浏览器兼容性

No compatibility data found. Please contribute data for "api.RTCIceCandidatePair" (depth: 1) to the MDN 兼容性数据存储库 .