4.6 Session Description Model

4.6.1 RTCSdpType

The RTCSdpType enum describes the type of an RTCSessionDescriptionInit, RTCLocalSessionDescriptionInit, or RTCSessionDescription instance.

  1. WebIDLenum RTCSdpType {
  2. "offer",
  3. "pranswer",
  4. "answer",
  5. "rollback"
  6. };
Enumeration description
offer

An RTCSdpType of “offer“ indicates that a description MUST be treated as an [SDP] offer.

pranswer

An RTCSdpType of “pranswer“ indicates that a description MUST be treated as an [SDP] answer, but not a final answer. A description used as an SDP pranswer may be applied as a response to an SDP offer, or an update to a previously sent SDP pranswer.

answer

An RTCSdpType of “answer“ indicates that a description MUST be treated as an [SDP] final answer, and the offer-answer exchange MUST be considered complete. A description used as an SDP answer may be applied as a response to an SDP offer or as an update to a previously sent SDP pranswer.

rollback

An RTCSdpType of “rollback“ indicates that a description MUST be treated as canceling the current SDP negotiation and moving the SDP [SDP] offer back to what it was in the previous stable state. Note the local or remote SDP descriptions in the previous stable state could be null if there has not yet been a successful offer-answer negotiation. An “answer“ or “pranswer“ cannot be rolled back.

4.6.2 RTCSessionDescription Class

The RTCSessionDescription class is used by RTCPeerConnection to expose local and remote session descriptions.

  1. WebIDL[Exposed=Window]
  2. interface RTCSessionDescription {
  3. constructor(RTCSessionDescriptionInit descriptionInitDict);
  4. readonly attribute RTCSdpType type;
  5. readonly attribute DOMString sdp;
  6. [Default] object toJSON();
  7. };
Constructors

constructor()

The RTCSessionDescription() constructor takes a dictionary argument, description, whose content is used to initialize the new RTCSessionDescription object. This constructor is deprecated; it exists for legacy compatibility reasons only.

Attributes

type of type RTCSdpType, readonly

The type of this session description.

sdp of type DOMString, readonly, defaulting to ""

The string representation of the SDP [SDP].

Methods

toJSON()

When called, run [WEBIDL]‘s default toJSON steps.

  1. WebIDLdictionary RTCSessionDescriptionInit {
  2. required RTCSdpType type;
  3. DOMString sdp = "";
  4. };
Dictionary RTCSessionDescriptionInit Members

type of type RTCSdpType, required

The type of this session description.

sdp of type DOMString

The string representation of the SDP [SDP]; if type is “rollback“, this member is unused.

  1. WebIDLdictionary RTCLocalSessionDescriptionInit {
  2. RTCSdpType type;
  3. DOMString sdp = "";
  4. };
Dictionary RTCLocalSessionDescriptionInit Members

type of type RTCSdpType

The type of this description. If not present, then setLocalDescription will infer the type based on the RTCPeerConnection‘s signaling state.

sdp of type DOMString

The string representation of the SDP [SDP]; if type is “rollback“, this member is unused.