dom / latest / rtcsessiondescription.html /

RTCSessionDescription

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The RTCSessionDescription interface describes one end of a connection—or potential connection—and how it's configured. Each RTCSessionDescription consists of a description type indicating which part of the offer/answer negotiation process it describes and of the SDP descriptor of the session.

The process of negotiating a connection between two peers involves exchanging RTCSessionDescription objects back and forth, with each description suggesting one combination of connection configuration options that the sender of the description supports. Once the two peers agree upon a configuration for the connection, negotiation is complete.

Properties

The RTCSessionDescription interface doesn't inherit any properties.

RTCSessionDescription.type Read only

An enum describing the session description's type.

RTCSessionDescription.sdp Read only

A DOMString containing the SDP describing the session.

Methods

The RTCSessionDescription doesn't inherit any methods.

RTCSessionDescription() Deprecated

This constructor returns a new RTCSessionDescription. The parameter is a RTCSessionDescriptionInit dictionary containing the values to assign the two properties.

RTCSessionDescription.toJSON()

Returns a JSON description of the object. The values of both properties, type and sdp, are contained in the generated JSON.

Example

signalingChannel.onmessage = function (evt) {
  if (!pc) start(false);

  var message = JSON.parse(evt.data);
  if (message.sdp)
    pc.setRemoteDescription(
      new RTCSessionDescription(message),
      function () {
        // if we received an offer, we need to answer
        if (pc.remoteDescription.type == "offer")
          pc.createAnswer(localDescCreated, logError);
      },
      logError
    );
  else
    pc.addIceCandidate(
      new RTCIceCandidate(message.candidate),
      function () {},
      logError
    );
};

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
RTCSessionDescription
23
15
44
22
No
15
11
≤37
25
44
22
14
11
1.5
RTCSessionDescription
23
15
44
22
No
15
11
4.4
25
44
22
14
11
1.5
sdp
23
15
22
No
15
11
≤37
25
22
14
11
1.5
toJSON
43
15
24
No
30
11
43
43
24
30
11
4.0
type
23
15
22
No
15
11
≤37
25
22
14
11
1.5

See also

© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/RTCSessionDescription