RTCSessionDescription

The session description of one end of a connection.

class webrtc.models.rtc_session_description.RTCSessionDescription(type, sdp='')

A session description set on a connection, with its SDP and its role in the offer/answer exchange.

webrtc.RTCPeerConnection.local_description and the other description properties return it. The methods that set a description take an webrtc.RTCSessionDescriptionInit as well, so creating one is rarely needed. The type is checked on creation, but the SDP is only parsed once the description is set. Both are writable; a description already set on a connection doesn’t change. See MDN: RTCSessionDescription.

Parameters:
Raises:
to_json()

Returns the description as a JSON-serializable dictionary, to send to the remote peer.

webrtc.RTCSessionDescriptionInit.from_json() reads it back. See MDN: RTCSessionDescription/toJSON.

Returns:

dict – type (like 'offer') and sdp.

Return type:

dict[str, str]

property type: webrtc.RTCSdpType

The role of the description in the offer/answer exchange.

It can be set with a member or its value. See MDN: RTCSessionDescription/type.

Type:

webrtc.RTCSdpType

property sdp: str

The SDP of the description, which may be empty (like for a rollback).

See MDN: RTCSessionDescription/sdp.

Type:

str