Please note, this is a STATIC archive of website developer.mozilla.org from November 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

RTCPeerConnection.onsignalingstatechange

This article needs a technical review. How you can help.

This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for usage 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 specification changes.

The RTCPeerConnection.onsignalingstatechange property is an EventHandler which specifies a function to be called when the signalingstatechange event occurs on an RTCPeerConnection interface. The function receives as input the event object, of type Event; this event is sent when the value of RTCPeerConnection.signalingState changes, as the result of a call to either setLocalDescription() or setRemoteDescription().

Syntax

RTCPeerConnection.onsignalingstatechange = errorHandler;

Value

Set this to a function which you provide that receives an Event object as input; this contains the signalingstatechange event. This event object doesn't provide details about what changed, but you can examine the signalingState property to determine what the new state is.

Example

pc.onsignalingstatechange = function(event) {
  if (pc.signalingState === "have-local-pranswer") {
    // setLocalDescription() has been called with an answer
  }
};

Specifications

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

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support (Yes) 24 (24)[1]
36.0 (36.0)[2]
No support (Yes) ?
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support ? ? 24 (24)[1]
36.0 (36.0)[2]
No support ? ?

[1] Though this property isn't prefixed, the RTCPeerConnection interface of which it's a member was prefixed (as MozRTCPeerConnection) until Firefox 44.

[2] Before Firefox 36, the event handler was passed the signaling state value (one of the values in the RTCSignalingState enum) instead of the event as required by the specification. This has been fixed.

See also

Document Tags and Contributors

 Contributors to this page: Sheppy, Sebastianz, teoli
 Last updated by: Sheppy,