The rtcpeerconnection-shim package (v1.2.15) is a JavaScript library that provides a polyfill/shim implementing the W3C RTCPeerConnection API on top of the ORTC (Object RTC) API, which is used by Microsoft Edge (pre-Chromium). It allows developers to use the standard WebRTC RTCPeerConnection interface in environments that only support ORTC. The project is in maintenance mode, with its last release in 2018. It offers a compatibility layer, but it is limited compared to native WebRTC support. Key differentiator: it enables RTCPeerConnection in legacy Edge; however, it is no longer needed in modern browsers and has subtle API differences.
npm install rtcpeerconnection-shimVerified import paths — ran on the pinned version, not inferred.
Creates an RTCPeerConnection, gets user media, creates an offer, and logs ICE candidates.
Test extensively on target browsers; consider using adapter.js for cross-browser support.
Remove this dependency if targeting only modern browsers; use standard WebRTC API directly.
Use `new RTCIceCandidate({ candidate: 'candidate string' })` instead of passing a string directly.Ensure the shim is loaded before creating any connections: import the module at the entry point of your app.
Check the signaling state (pc.signalingState) before setting descriptions. Typical flow: createOffer -> setLocalDescription -> wait for answer.
Import 'rtcpeerconnection-shim' at the top of your script. For Node.js, ensure it's bundled correctly.