Prompt

How do I set up 1:1 video calls in a web app?

Technology / API Platforms1 observationLast seen Nov 2, 2026

Latest observation

Nov 2, 2026OpenAI APIWeb search: off

To set up 1:1 video calls in a web app, you typically use WebRTC for the media connection and a signaling server to help two browsers find each other and exchange connection info.

High-level pieces

  1. Frontend app

    • Gets camera/mic access
    • Creates the WebRTC connection
    • Shows local and remote video
  2. Signaling server

    • Not part of WebRTC itself
    • Usually uses WebSocket, Socket.IO, or similar
    • Exchanges:
      • SDP offer/answer
      • ICE candidates
      • Call state events (join, accept, hang up)
  3. STUN/TURN servers

    • STUN helps peers discover their public network addresses
    • TURN relays media if direct peer-to-peer fails, which is important for real-world reliability

Typical call flow

1. Get media

Use getUserMedia() to access camera and microphone.

const localStream = await navigator.mediaDevices.getUserMedia({
  video: true,
  audio: true
});
localVideo.srcObject = localStream;

2. Create RTCPeerConnection

Configure STUN/TURN servers.

const pc = new RTCPeerConnection({
  iceServers: [
    { urls: "stun:stun.l.google.com:19302" },
    // For production:
    // { urls: "turn:turn.example.com:3478", username: "user", credential: "pass" }
  ]
});

3. Add local tracks

localStream.getTracks().forEach(track => pc.addTrack(track, localStream));

4. Exchange signaling data

You need a server to send messages between the two users:

  • Caller creates an offer
  • Callee receives it and creates an answer
  • Both sides exchange ICE candidates

5. Attach remote stream

pc.ontrack = (event) => {
  remoteVideo.srcObject = event.streams[0];
};

Minimal example structure

Caller side

const localStream = await navigator.mediaDevices.getUserMedia({ video: true, audio: true });
localVideo.srcObject = localStream;

const pc = new RTCPeerConnection({
  iceServers: [{ urls: "stun:stun.l.google.com:19302" }]
});

localStream.getTracks().forEach(track => pc.addTrack(track, localStream));

pc.ontrack = (e) => {
  remoteVideo.srcObject = e.streams[0];
};

pc.onicecandidate = (e) => {
  if (e.candidate) signalingSocket.send(JSON.stringify({
    type: "ice-candidate",
    candidate: e.candidate
  }));
};

const offer = await pc.createOffer();
await pc.setLocalDescription(offer);

signalingSocket.send(JSON.stringify({
  type: "offer",
  sdp: offer
}));

Callee side

const localStream = await navigator.mediaDevices.getUserMedia({ video: true, audio: true });
localVideo.srcObject = localStream;

const pc = new RTCPeerConnection({
  iceServers: [{ urls: "stun:stun.l.google.com:19302" }]
});

localStream.getTracks().forEach(track => pc.addTrack(track, localStream));

pc.ontrack = (e) => {
  remoteVideo.srcObject = e.streams[0];
};

pc.onicecandidate = (e) => {
  if (e.candidate) signalingSocket.send(JSON.stringify({
    type: "ice-candidate",
    candidate: e.candidate
  }));
};

signalingSocket.onmessage = async (msg) => {
  const data = JSON.parse(msg.data);

  if (data.type === "offer") {
    await pc.setRemoteDescription(data.sdp);
    const answer = await pc.createAnswer();
    await pc.setLocalDescription(answer);

    signalingSocket.send(JSON.stringify({
      type: "answer",
      sdp: answer
    }));
  }

  if (data.type === "ice-candidate") {
    await pc.addIceCandidate(data.candidate);
  }
};

Signaling server example idea

Using WebSocket/Socket.IO, you can route messages by room or user ID:

  • User A joins room call-123
  • User B joins room call-123
  • Server forwards offer, answer, and ice-candidate messages between them

This server does not handle video itself; only coordination.


Important production considerations

1. Use TURN for reliability

Many users are behind NATs/firewalls. Without TURN, some calls won’t connect.

2. Secure everything

  • Use HTTPS
  • Use WSS for signaling
  • Authenticate users before allowing calls

3. Handle lifecycle

  • Mute/unmute
  • Camera on/off
  • Hang up
  • Reconnect if network changes
  • Clean up tracks and peer connections

4. Mobile/browser quirks

  • Safari and mobile browsers can behave differently
  • Test autoplay policies and permissions

5. Scaling

For pure 1:1 calls, WebRTC peer-to-peer is usually enough. If you later need group calls or recording, you may want an SFU.


Recommended stack

A common setup:

  • Frontend: React/Vue/Next.js
  • Signaling: Node.js + Socket.IO
  • Media: WebRTC
  • NAT traversal: STUN + TURN (e.g. coturn)

Best way to start

  1. Build a simple two-page demo
  2. Add WebSocket signaling
  3. Connect two tabs/devices
  4. Add TURN server
  5. Add call UI and cleanup logic

If you want, I can give you:

  • a complete working example with frontend + Node.js signaling server, or
  • a React version of a 1:1 video call app.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.