Web APIs
The shim installs the WebRTC classes on window with W3C shapes and event ordering. This page lists what each one does and where it differs from a browser.
Installed classes
RTCPeerConnection (also as webkitRTCPeerConnection), RTCSessionDescription, RTCIceCandidate, RTCDataChannel, RTCPeerConnectionIceEvent, RTCDataChannelEvent, RTCTrackEvent, RTCRtpSender, RTCRtpReceiver, RTCRtpTransceiver, RTCDTMFSender, RTCDTMFToneChangeEvent and RTCRtpScriptTransform. Worker is wrapped so that transform workers get RTCRtpScriptTransformer.
RTCPeerConnection
| Member | Notes |
|---|---|
createOffer, createAnswer, setLocalDescription, setRemoteDescription | Full JSEP, including pranswer, explicit rollback and the implicit rollback that perfect negotiation relies on. An offer on an unchanged session is still an offer. A local description may be re-serialised (line order, candidates, codec parameters) but not edited structurally. |
addIceCandidate, icecandidate | Trickle both ways, end-of-candidates, mDNS .local candidates |
restartIce() | The next offer restarts ICE |
addTrack, removeTrack, addTransceiver, getTransceivers, getSenders, getReceivers | W3C transceiver reuse and association with remote media sections; msid stream ids |
createDataChannel, datachannel | See below |
getStats() | Candidate pairs, candidates and transport (with tlsGroup) from the engine; inbound-rtp and outbound-rtp from the shim's media pipes. A track selector filters by kind. |
| State attributes and events | Signalling, ICE gathering, ICE connection and connection states, with their *statechange events; negotiationneeded; canTrickleIceCandidates |
getConfiguration, setConfiguration | setConfiguration records new iceServers for getConfiguration; the engine keeps the servers it was created with |
sctp | maxMessageSize 262144 bytes |
generateCertificate() | Rejects with NotSupportedError. Each connection has its own ECDSA P-256 certificate. |
Configuration
iceServers (stun:, turn: with ?transport=udp|tcp, turns:), iceTransportPolicy and bundlePolicy behave as in browsers. One member is not W3C: postQuantum, on Post-quantum.
RTCDataChannel
ordered,maxRetransmits,maxPacketLifeTime,protocol,negotiatedwithid.send()takes strings,ArrayBuffer, typed arrays andBlobs;binaryTypeisarraybufferorblob.bufferedAmount,bufferedAmountLowThresholdandbufferedamountlow.
Senders, receivers and transceivers
direction,currentDirection,stop(),mid.RTCRtpSender.replaceTrack()swaps the source without renegotiation.getParametersandsetParameters:active,maxBitrateandscaleResolutionDownByapply to the encoder.setCodecPreferences()reorders and filters codecs;getCapabilities(kind)lists what the page can encode.RTCRtpSender.dtmfon audio senders.
Codecs
Audio is Opus. Video is VP8 always, and H.264 when WebCodecs in the webview can encode and decode it; the shim probes that before the first offer. Encoding runs in the page, so the webview's WebCodecs decides what is available.
Simulcast
A sender given several sendEncodings sends one layer: the active encoding with the least downscaling. SFUs such as LiveKit accept that and forward it to every subscriber.
RTCDTMFSender
insertDTMF(tones, duration, interToneGap), toneBuffer, canInsertDTMF and tonechange, as in the spec. Tones go out as RFC 4733 telephone events; a comma pauses for two seconds.
Encoded transforms
RTCRtpScriptTransform, the WebKit and Firefox shape of insertable streams, on senders and receivers for audio and video. Construct it with a Worker; the worker receives rtctransform events with readable and writable streams of RTCEncodedVideoFrame and RTCEncodedAudioFrame. LiveKit's end-to-end encryption runs through it unchanged.
Under a CSP that forbids blob: workers, the shim withdraws RTCRtpScriptTransform instead of letting media stall. See CSP and frames.
Not yet
- VP9 and AV1.
- Receiving simulcast layers.
- Changing ICE servers on a live connection.
RTCPeerConnection.generateCertificate()and thecertificatesconfiguration member.- The Chromium-style
createEncodedStreams(); useRTCRtpScriptTransform.