# RCWeb Video Chat App

The **RCWeb Video Chat App** (`app/chat-rtc`) is a multi-user video chat room for the RCWeb ecosystem. It follows the **Symmetric Pattern**: everyone opens the same app in the same room, RCWeb distributes signaling messages, and each browser sends audio and video directly to the other browsers with WebRTC.

![icon](pwa-512x512.png "Video Chat App Icon")

## What it does

- **Multi-user room video chat**: Each participant can join the same room URL and appear in a responsive video grid.
- **Direct browser-to-browser media**: The app uses WebRTC peer connections for audio and video, so RCWeb is only used for signaling.
- **Per-user device controls**: Everyone can choose a display name, mute or unmute their microphone, and turn their camera on or off.
- **Room presence**: Participants automatically discover each other inside the room and clean up tiles when someone leaves.

## How it works

- **RCWeb signaling**: `script.js` uses `rc.sendFunctionCall(...)` to broadcast presence, request the current room roster, and exchange WebRTC offers, answers, and ICE candidates.
- **Mesh topology**: Each browser creates one `RTCPeerConnection` per remote participant, producing a simple peer-to-peer mesh that works well for smaller group calls.
- **Perfect-negotiation style handling**: The signaling code guards against offer collisions so multiple peers can join and renegotiate safely.
- **Live media state**: Camera and microphone state are reflected in the UI and shared with peers as lightweight presence metadata.

## Notes

- Browser camera and microphone access typically requires **HTTPS** or **localhost**.
- The app includes public **STUN** servers for ICE discovery, but it does **not** include a TURN relay. Very restrictive networks may still need extra infrastructure for every participant to connect reliably.
