RTCSessionDescription: phương thức toJSON()
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2017.
Phương thức RTCSessionDescription.toJSON() tạo ra một mô tả JSON của đối tượng. Cả hai thuộc tính, type và sdp, đều được chứa trong JSON được tạo.
Cú pháp
js
toJSON()
Tham số
Không có.
Giá trị trả về
Một đối tượng JSON chứa các thuộc tính sau:
type-
Một trong các giá trị sau:
"offer","answer","pranswer"hoặcnull. sdp-
Hoặc
nullhoặc chuỗi thông báo SDP tương ứng với thuộc tínhRTCSessionDescription.sdp.
Ví dụ
js
// sd là một RTCSessionDescription
alert(JSON.stringify(sd)); // Lệnh này gọi phương thức toJSON() đằng sau hậu trường.
Đặc tả kỹ thuật
| Specification |
|---|
| WebRTC: Real-Time Communication in Browsers> # dom-rtcsessiondescription-tojson> |