Registry / http-networking / rtcpeerconnection-shim

rtcpeerconnection-shim

JSON →
library1.2.15jsnpmunverified

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-shim
INSTALL
IMPORT
SIG · RTCPEERCONNECTION-
R
rtcpeerconnection-shim
http-networkingjavascriptv1.2.15
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

RTCPeerConnection
import { RTCPeerConnection } from 'rtcpeerconnection-shim'
const RTCPeerConnection = require('rtcpeerconnection-shim')
ESM named export; CommonJS require works but TypeScript may require esModuleInterop.
RTCSessionDescription
import { RTCSessionDescription } from 'rtcpeerconnection-shim'
import RTCSessionDescription from 'rtcpeerconnection-shim'
Named export, not default.
RTCIceCandidate
import { RTCIceCandidate } from 'rtcpeerconnection-shim'
Also a named export; required for constructing ICE candidates.

Creates an RTCPeerConnection, gets user media, creates an offer, and logs ICE candidates.

import { RTCPeerConnection, RTCSessionDescription, RTCIceCandidate } from 'rtcpeerconnection-shim'; const pc = new RTCPeerConnection({ iceServers: [{ urls: 'stun:stun.l.google.com:19302' }] }); pc.onicecandidate = (e) => { if (e.candidate) { console.log('ICE candidate:', e.candidate.candidate); } }; navigator.mediaDevices.getUserMedia({ audio: true, video: true }) .then((stream) => { stream.getTracks().forEach((track) => pc.addTrack(track, stream)); return pc.createOffer(); }) .then((offer) => pc.setLocalDescription(offer)) .catch((err) => console.error(err));
Debug
Known issues
breakingThe peerconnection may behave differently than native WebRTC, e.g., no support for unified plan or some SDP attributes.
fix
Test extensively on target browsers; consider using adapter.js for cross-browser support.
affects: >=1.0.0
deprecatedThis shim is no longer needed for Edge Chromium (2020+). Modern Edge uses Chromium with native WebRTC.
fix
Remove this dependency if targeting only modern browsers; use standard WebRTC API directly.
affects: >=1.0.0
gotchaThe RTCIceCandidate constructor may not accept strings like in standard WebRTC; use object format.
fix
Use `new RTCIceCandidate({ candidate: 'candidate string' })` instead of passing a string directly.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: Cannot read property 'createOffer' of null
RTCPeerConnection not properly initialized or underlying ORTC not available.
fix
Ensure the shim is loaded before creating any connections: import the module at the entry point of your app.
Failed to set local offer sdp: Called in wrong state: kStable
Attempting to call setLocalDescription multiple times without proper signaling state management.
fix
Check the signaling state (pc.signalingState) before setting descriptions. Typical flow: createOffer -> setLocalDescription -> wait for answer.
ReferenceError: RTCPeerConnection is not defined
The shim was not imported or loaded before use, or environment doesn't support the shim.
fix
Import 'rtcpeerconnection-shim' at the top of your script. For Node.js, ensure it's bundled correctly.
Upgrade
Version history
1.2.15latest on npm
Audit
Dependencies
sdp-jingle-jsonrequiredUsed for SDP-to-Jingle conversion required by ORTC
ortc-adapterrequiredAdapter for ORTC API compatibility
Agent activity
18 hits · last 30 days
node
17
OpenAI (training)
1
Resources
rtcpeerconnection-shim — npm install rtcpeerconnection-shim · libregistry