W3cubDocs

/Web APIs

RTCPeerConnection: signalingstatechange event

A signalingstatechange event is sent to an RTCPeerConnection to notify it that its signaling state, as indicated by the signalingState property, has changed.

This event is not cancelable and does not bubble.

Syntax

Use the event name in methods like addEventListener(), or set an event handler property.

js

addEventListener("signalingstatechange", (event) => {});

onsignalingstatechange = (event) => {};

Event type

A generic Event.

Examples

Given an RTCPeerConnection, pc, and an updateStatus() function that presents status information to the user, this code sets up an event handler to let the user know when the ICE negotiation process finishes up.

js

pc.addEventListener(
  "signalingstatechange",
  (ev) => {
    switch (pc.signalingState) {
      case "stable":
        updateStatus("ICE negotiation complete");
        break;
    }
  },
  false,
);

Using onsignalingstatechange, it looks like this:

js

pc.onsignalingstatechange = (ev) => {
  switch (pc.signalingState) {
    case "stable":
      updateStatus("ICE negotiation complete");
      break;
  }
};

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
signalingstatechange_event 28 15 36
24–36Although the onsignalingstatechange property is supported, the signalingstatechange event is not fired as an Event object. See bug 1075133.
No 15 11 4.4 28 36
24–36Although the onsignalingstatechange property is supported, the signalingstatechange event is not fired as an Event object. See bug 1075133.
15 No 1.5

See also

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