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 of type RTCSdpType describing the session description's type.
RTCSessionDescription.sdp Read only
A DOMString containing the SDP describing the session.

Constants

RTCSdpType

This enum defines strings that describe the current state of the session description, as used in the type property. The session description's type will be specified using one of these values.

Value Description
answer The SDP contained in the sdp property is the definitive choice in the exchange. In other words, this session description describes the agreed-upon configuration, and is being sent to finalize negotiation.
offer The session description object describes the initial proposal in an offer/answer exchange. The session negotiation process begins with an offer being sent from the caller to the callee.
pranswer The session description object describes a provisional answer; that is, it's a response to a previous offer or provisional answer.
rollback This special type with an empty session description is used to roll back to the previous stable state.

Methods

The RTCSessionDescription doesn't inherit any methods.

RTCSessionDescription()
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

Specification Status Comment
WebRTC 1.0: Real-time Communication Between Browsers
The definition of 'RTCSessionDescription' in that specification.
Candidate Recommendation Initial definition.

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung Internet
Basic support
Experimental
Chrome Full support YesEdge Full support YesFirefox Full support Yes
Prefixed
Full support Yes
Prefixed
Prefixed Requires the vendor prefix: -moz-
IE No support NoOpera ? Safari ? WebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android ? Opera Android ? Safari iOS ? Samsung Internet Android Full support Yes
type
Experimental
Chrome Full support YesEdge Full support 15Firefox Full support Yes
Prefixed
Full support Yes
Prefixed
Prefixed Requires the vendor prefix: -moz-
IE No support NoOpera ? Safari ? WebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android ? Opera Android ? Safari iOS ? Samsung Internet Android Full support Yes
sdp
Experimental
Chrome Full support YesEdge Full support 15Firefox Full support Yes
Prefixed
Full support Yes
Prefixed
Prefixed Requires the vendor prefix: -moz-
IE No support NoOpera ? Safari ? WebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android ? Opera Android ? Safari iOS ? Samsung Internet Android Full support Yes
RTCSessionDescription() constructor
ExperimentalDeprecated
Chrome Full support YesEdge Full support YesFirefox Full support Yes
Prefixed
Full support Yes
Prefixed
Prefixed Requires the vendor prefix: -moz-
IE No support NoOpera ? Safari ? WebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android ? Opera Android ? Safari iOS ? Samsung Internet Android Full support Yes
toJSON
Experimental
Chrome Full support YesEdge Full support 15Firefox Full support Yes
Prefixed
Full support Yes
Prefixed
Prefixed Requires the vendor prefix: -moz-
IE No support NoOpera ? Safari ? WebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android ? Opera Android ? Safari iOS ? Samsung Internet Android Full support Yes

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown
Experimental. Expect behavior to change in the future.
Experimental. Expect behavior to change in the future.
Deprecated. Not for use in new websites.
Deprecated. Not for use in new websites.
Requires a vendor prefix or different name for use.
Requires a vendor prefix or different name for use.

See also

Document Tags and Contributors

Last updated by: mmckenziedev,