RTCIceCandidate () constructor creates and returns a new RTCIceCandidate object, which can be configured to represent a single ICE candidate.

句法

candidate = new RTCIceCandidate([candidateInfo]);
					

参数

candidateInfo 可选
An optional RTCIceCandidateInit object providing information about the candidate; if this is provided, the candidate is initialized configured to represent the described candidate.

返回值

A newly-created RTCIceCandidate object, optionally configured based on the specified object based on the RTCIceCandidateInit 字典。

candidateInfo is provided, the new RTCIceCandidate is initialized as follows:

注意: Parsing of the candidate string is performed using the candidate-attribute grammar from the WebRTC Specification.

异常

TypeError
指定 RTCIceCandidateInit has values of null in both the sdpMid and sdpMLineIndex 特性。

用法注意事项

This constructor does not do complete validation of the specified candidateInfo object or string.

规范

规范 状态 注释
WebRTC 1.0: Real-time Communication Between Browsers
The definition of 'RTCIceCandidate()' in that specification.
候选推荐 初始定义。

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
RTCIceCandidate() 构造函数 Chrome Yes Edge ≤18 Firefox 22
22
Before Firefox 68, the constructor's 选项 parameter was required.
IE No Opera Yes Safari ? WebView Android Yes Chrome Android Yes Firefox Android Yes
Yes
Before Firefox 68, the constructor's 选项 parameter was required.
Opera Android Yes Safari iOS ? Samsung Internet Android Yes

图例

完整支持

完整支持

不支持

不支持

兼容性未知 ?

兼容性未知

见实现注意事项。

另请参阅

元数据

  • 最后修改: