javascriptwebrtc

Why connectionState property of RTCPeerConnection object is not accesssible?


enter image description hereAccording to the MDN manual, RTCPeerConnection has a property connectionState (Indicates the current state of the peer connection by returning one of the strings).

But my program (javascript) does not see it. Developer tools (console in Firefox) do not show this property too - see curPeerConnection variable in the screenshot.

Why I do not see it ?


Solution

  • As MDN says connectionState only shipped in Firefox 113. You may want to use the adapter.js polyfill which approximates connectionState based on the iceConnectionState which is somewhat correct and lets you write code that uses connectionState and the connectionStateChange event.

    Note that 112 is quite old, even Firefox ESR is at 115 now so you may want to think about what to do with users on old versions