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
Specification |
---|
WebRTC: Real-Time Communication in Browsers # event-signalingstatechange |
Browser compatibility
BCD tables only load in the browser