RTCIceCandidate 方法 toJSON() converts the RTCIceCandidate on which it's called into JSON in the form of an RTCIceCandidateInit 对象。

句法

json = rtcIceCandidate.toJSON();
					

返回值

An object conforming to the RTCIceCandidateInit dictionary, whose members' values are set to the corresponding values in the RTCIceCandidate 对象。

You can then get a stringified version of the object by calling stringify() on the returned object. See the 范例 下文。

范例

This simple example obtains a JSON string representing an RTCIceCandidate found in the variable candidate .

var jsonString = candidate.toJSON().stringify();
					

规范

规范 状态 注释
WebRTC 1.0: Real-time Communication Between Browsers
The definition of 'RTCIceCandidate.toJSON()' 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
toJSON Chrome 45 Edge 15 Firefox 27 IE 不支持 No Opera 32 Safari Yes WebView Android 45 Chrome Android 45 Firefox Android 27 Opera Android 32 Safari iOS Yes Samsung Internet Android 5.0

图例

完整支持

完整支持

不支持

不支持

元数据

  • 最后修改: