RTCSessionDescription: toJSON() 方法
RTCSessionDescription.toJSON() 方法会生成一个对象的 JSON 描述。生成的 JSON 中包含了 type 和 sdp 这两个属性。
语法
js
toJSON()
参数
无。
返回值
一个包含以下属性的 JSON 对象
type-
以下值之一:
"offer"、"answer"、"pranswer"或null。 SDP-
null或与RTCSessionDescription.sdp属性对应的 SDP 消息字符串。
示例
js
// sd is a RTCSessionDescriptor
alert(JSON.stringify(sd)); // This call the toJSON() method behind the scene.
规范
| 规范 |
|---|
| WebRTC:浏览器中的实时通信 # dom-rtcsessiondescription-tojson |
浏览器兼容性
加载中…