How saddysk/videopie works
Project type and purpose
• This is a full-stack, one-on-one video conferencing web application (“VideoPie”) built with WebRTC.
• It provides real-time video/audio calls, file transfer, live chat, screen sharing (Canvas), mute/unmute controls, and a timer.
• The Node.js server (server.js) acts as the WebRTC signaling server, and the client directories (peerA/ and peerB/) host the two endpoints.
File structure
Top-level:
• server.js – Node.js signaling (likely using WebSocket or Socket.io)
• index.html & style.css – landing or common client page
• peerA/peerA.html + sender.js – client A’s UI & signaling/client-side logic
• peerB/peerB.html + receiver.js – client B’s UI & logic
• Canvas/ – whiteboard or screen-share module (canvas/index.html, canvas.js, style.css)
• node_modules, package-lock.json – server dependencies
Key patterns:
• Separation of signaling (server.js) vs. media logic (sender.js/receiver.js)
• Modular front-end: main pages vs. Canvas submodule
README for additional insights
• Confirms WebRTC usage and features (file transfer, chat, screen share).
• No further architectural notes, so infer default WebRTC flows (offer/answer, ICE candidates, STUN/TURN).
Main components & interactions
a. Components:
1. Client A UI (peerA.html + sender.js)
2. Client B UI (peerB.html + receiver.js)
3. Signaling Server (server.js)
4. Canvas Module (Canvas/index.html + canvas.js)
5. STUN/TURN infrastructure (external service)
6. Optional: File-system (for file transfer buffering)
b. Relationships/Data Flow:
• Clients A & B load their HTML/CSS/JS from the Node.js server (static hosting).
• Upon “call” initiation, A sends an SDP offer → Signaling Server → B.
• B responds with SDP answer → Signaling Server → A.
• ICE candidates exchanged via Signaling Server.
• Peer connection established P2P for media (video/audio) streams & data channels (chat, file transfer).
• Screen sharing uses getDisplayMedia → Canvas Module for drawing or annotations.
c. Architectural Patterns/Principles:
• MVC-like separation on the client: UI (HTML/CSS), signaling logic (sender.js/receiver.js), media layer (WebRTC API).
• Single-page submodule (Canvas) detachable from main UI.
• Event-driven messaging via WebSocket/Socket.io.
d. Key technologies:
• Node.js + Express (serving static files + WebSocket signaling)
• WebRTC API (RTCPeerConnection, MediaStream, RTCDataChannel)
• HTML5 Canvas API (for screen share/annotation)
• CSS for styling
• (Possibly) Socket.io or ws library for signaling