RTCSessionDescription

by 2 contributors:

This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for the proper prefixes to use in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the spec changes.

The RTCSessionDescription interface represents the parameters of a session. It consists of the kind of description, which part of a offer/answer negotiation it describes and of the SDP descriptor of the session.

Properties

The RTCSessionDescription doesn't inherit any property.

RTCSessionDescription.type
Is an enum of type RTCSdpType describing the type of the description. It can be one of the following values:
  • "offer", the description is the initial proposal in an offer/answer exchange.
  • "answer", the description is the definitive choice in an offer/answer exchange.
  • "pranswer", the description is a provisional answer and may be changed when the definitive choice will be given.
RTCSessionDescription.sdp
Is a DOMString containing the SDP format describing the session.

Methods

The RTCSessionDescription doesn't inherit any method.

RTCSessionDescription()
Returns a new RTCSessionDescription. The parameter is a RTCSessionDescriptionInit dictionary containing the (optional) values for the two properties. If one of these value, or the whole parameter, is not given, the relevant property will be initiated to null.
RTCSessionDescription.toJSON()
Is a jsonifier, that is a method generating a JSON description of the object. Both properties, type and {domxref("RTCSessionDescription.sdp", "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.sdp), 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 Browser
The definition of 'RTCSessionDescription' in that specification.
Working Draft Initial definition.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support (Yes) (Yes) -moz- Not supported (Yes) ?
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support ? ? ? Not supported ? ?

See also

Document Tags and Contributors

Contributors to this page: teoli, wesj
Last updated by: teoli,