freecoding.school100% FREE · NO SIGNUP
API ArcadeISSUE #4 of 23

webrtc · peer-to-peer media

ApiaVSLegacy Larry
Apia saysWebRTC enables direct peer-to-peer audio, video, and data between browsers.

WebRTC connects two browsers directly (low-latency calls, screen share, P2P data) via RTCPeerConnection. It needs a signaling server only to exchange connection info, then media flows peer-to-peer. The API is complex (offers/answers, ICE candidates, STUN/TURN), so libraries and platforms usually wrap it.

Power-ups you unlock

Legacy Larry attacks — common mistakes

Boss battleUnderstand the WebRTC flow: signaling → offer/answer → ICE → P2P media.

Example code

<!doctype html><html><head><meta charset="utf-8"></head>
<body style="background:#06040d;color:#e6e0ff;font-family:monospace;padding:20px"><pre>const pc = new RTCPeerConnection();
pc.onicecandidate = e => sendToPeer(e.candidate);   // via signaling
const offer = await pc.createOffer();
await pc.setLocalDescription(offer);
// peer answers → media flows directly</pre></body></html>
▶ Open the interactive comic issue
‹ Web Audio Api · Oscillators · Gain · ContextMedia Devices · GetUserMedia ›