This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
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()
.
RTCPeerConnection.onsignalingstatechange = errorHandler;
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.
pc.onsignalingstatechange = function(event) { if (pc.signalingState === "have-local-pranswer") { // setLocalDescription() has been called with an answer } };
Specification | Status | Comment |
---|---|---|
WebRTC 1.0: Real-time Communication Between Browsers The definition of 'RTCPeerConnection.onsignalingstatechange' in that specification. | Working Draft | Initial specification. |
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic support | (Yes) [1] | (Yes) |
24 (24)[2] 36.0 (36.0)[3] | No support | (Yes) | ? |
Feature | Android | Chrome for Android | Edge | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|---|
Basic support | (Yes) [1] | (Yes) [1] | (Yes) |
24 (24)[2] 36.0 (36.0)[3] | No support | ? | ? |
[1] Though this property is not prefixed, the interface it belongs to was until Chrome 56.
[2] Though this property isn't prefixed, the RTCPeerConnection
interface of which it's a member was prefixed (as MozRTCPeerConnection
) until Firefox 44.
[3] 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.
signalingstatechange
event and its type, Event
.
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/onsignalingstatechange