Most WebRTC tutorials show one getUserMedia stream with audio+video, one RTCPeerConnection, and a happy path. I shipped Peer — a no-account 1:1 call app with screen sharing — and the interesting work was everything the tutorials skip: camera, mic, and screen as separate toggles on a single peer connection, with renegotiation on every flip, and telling screen from camera on the receiving end.

Here's the condensed version.

The model: three streams, one connection

Instead of one combined local stream, keep three:

let screenStream: MediaStream | null = null; // getDisplayMedia