Next.js project (App Router, TypeScript) with voice and 1:1 video call (WebRTC + Socket.IO).
npm installEmotion from camera (optional): Set GEMINI_API_KEY in .env.local; emotion uses the Gemini vision API (see .env.example).
npm run devThis starts the custom server (Next.js + Socket.IO signaling) on http://localhost:3000. The app and the signaling server run on the same port.
- Video call page: http://localhost:3000/video
npm run dev– dev server (Next.js + Socket.IO)npm run build– production buildnpm run start– run production server (runnpm run buildfirst)npm run lint– run ESLint
Two users can join the same room code and see each other’s live camera and hear audio. No external video SDKs; uses raw WebRTC and Socket.IO for signaling.
-
Same network (e.g. laptop + phone on same Wi‑Fi)
- On both devices, open
http://<your-pc-ip>:3000/video(replace with your computer’s local IP). - Enter the same room code (e.g.
room1) and click Join room on both. - On the device that sees “You are caller”, click Start call.
- You should see and hear each other.
- On both devices, open
-
Different networks (e.g. phone on cellular, laptop at home)
-
You need a TURN server so peers can connect through NAT/firewalls.
-
Set these env vars (create a
.env.localnext topackage.json):NEXT_PUBLIC_TURN_URL=turn:your-turn-server:3478 NEXT_PUBLIC_TURN_USERNAME=your-username NEXT_PUBLIC_TURN_CREDENTIAL=your-password
-
Restart
npm run dev, then open the app from both devices (e.g. deploy to a public URL or use a tunnel like ngrok for the laptop, and open that URL on the phone). -
Same steps: same room code → Join → Start call (on caller device).
-
- STUN (default): Google’s public STUN server is used so peers on the same or friendly networks can discover their public IP and connect.
- TURN: If you set
NEXT_PUBLIC_TURN_URL,NEXT_PUBLIC_TURN_USERNAME, andNEXT_PUBLIC_TURN_CREDENTIAL, the app will add that TURN server to the ICE config. Use TURN when devices are on different networks (e.g. different Wi‑Fi or mobile data) and direct connection fails.