mozilla
Your Search Results

    RTCPeerConnection.setLocalDescription()

    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 RTCPeerConnection.setLocalDescription() method changes the local description associated with the connection. The description defines the properties of the connection like its codec. The connection is affected by this change and must be able to support both old and new descriptions. The method takes three parameters, a RTCSessionDescription object to set, and two callbacks, one called if the change of description succeeds, another called if it failed.

    If the connection signalingState is "closed", the InvalidStateError exception will be raised. Also if the RTCSessionDescription is not valid, the InvalidSessionDescriptionError will be raised.

    The method returns instantaneously without waiting for the actual setting to be done: in case of success, the successCallback will be called; in case of failure, the errorCallback will be called.

    Syntax

    pc.setLocalDescription(sessionDescription, successCallback, errorCallback);
    

    There is no return value for this method.

    Parameters

    sessionDescription
    Is a RTCSessionDescription is the description of the parameters to be applied to the local session.
    successCallback
    Is a Function without parameter which will be called when the description has been successfully set. At this point, one can send the offer to a remote server that can forward it to a remote client
    errorCallback
    Is a RTCPeerConnectionErrorCallback which will be called if the description can't be set. It takes the following parameter:
    • errorInformation which is a DOMString describing the reason why the description has not been set.

    Example

    var pc = new PeerConnection();
    pc.addStream(video);
    pc.createOffer(function(desc) {
      pc.setLocalDescription(desc, function() {
        // send the offer to a server that can negotiate with a remote client
      });
    }); 
    

    Specifications

    Specification Status Comment
    WebRTC 1.0: Real-time Communication Between Browser
    The definition of 'RTCPeerConnection.setLocalDescription()' in that specification.
    Working Draft Initial specification.

    Browser compatibility

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

    [1] Though this property is not prefixed, the interface it belongs to is.

    See also

    Document Tags and Contributors

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