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 |
瀏覽器相容性
載入中…