Skip to main content
← Back to Quickstart Guides

WebRTC Streaming (WHIP/WHEP)

Ultra-low latency streaming via Cloudflare Calls edge network

10 minutes
Beginner
Sub-500ms latency
Browser native
Simulcast
100K+
Concurrent Sessions
<200ms
P99 Latency
99.99%
Connection Success
275+
Edge Locations

Latency Comparison

How WebRTC compares to other streaming protocols

ProtocolTypical LatencyBest For
Traditional RTMP + HLS
15-30 secondsVOD, non-interactive
Low-Latency HLS (LL-HLS)
2-5 secondsMost live streaming
SRT
0.5-2 secondsProfessional contribution
WebRTC (WHIP/WHEP)
Fastest
<500msReal-time interaction

SDK Implementation Guide

Complete WebRTC integration with language-specific examples

import { WaveWebRTC } from '@wave/webrtc-sdk';

const publisher = new WaveWebRTC({
  apiKey: 'wave_live_xxxxx',
  streamId: 'str_abc123xyz'
});

// Get user media with optimal constraints
const stream = await navigator.mediaDevices.getUserMedia({
  video: {
    width: { ideal: 1920, min: 1280 },
    height: { ideal: 1080, min: 720 },
    frameRate: { ideal: 30, max: 60 },
    facingMode: 'user'
  },
  audio: {
    echoCancellation: true,
    noiseSuppression: true,
    autoGainControl: true,
    sampleRate: 48000
  }
});

// Start publishing via WHIP with simulcast
await publisher.publish(stream, {
  simulcast: true,
  layers: [
    { rid: 'h', maxBitrate: 2500000, scaleResolutionDownBy: 1 },    // 1080p
    { rid: 'm', maxBitrate: 1000000, scaleResolutionDownBy: 2 },    // 540p
    { rid: 'l', maxBitrate: 500000, scaleResolutionDownBy: 4 }      // 270p
  ],
  preferredCodec: 'VP9', // VP8, VP9, or H264
  degradationPreference: 'balanced' // or 'maintain-framerate', 'maintain-resolution'
});

// Monitor connection quality
publisher.on('stats', (stats) => {
  console.log('Connection stats:', {
    bitrate: Math.round(stats.video.bytesSent / 1024) + ' kbps',
    packetLoss: (stats.video.packetsLost / stats.video.packetsSent * 100).toFixed(2) + '%',
    rtt: Math.round(stats.video.roundTripTime * 1000) + 'ms',
    framesPerSecond: stats.video.framesPerSecond,
    qualityLimitationReason: stats.video.qualityLimitationReason
  });
});

// Handle disconnection with automatic reconnect
publisher.on('disconnected', async (reason) => {
  console.log('Disconnected:', reason);
  let delay = 1000;
  while (!publisher.connected && delay <= 8000) {
    await new Promise(r => setTimeout(r, delay));
    try {
      await publisher.reconnect();
      console.log('Reconnected successfully');
      break;
    } catch (e) {
      delay *= 2;
    }
  }
});

// Stop publishing
// await publisher.stop();

WHIP Publishing Capabilities

Features available when publishing via WebRTC

Browser Publishing

<100ms

Publish streams directly from web browsers using getUserMedia API

OBS WHIP Output

<150ms

OBS Studio 30+ has native WHIP support for WebRTC publishing

Mobile SDKs

<120ms

Native iOS and Android SDKs for mobile broadcasting with hardware encoding

Screen Sharing

<100ms

Capture desktop, window, or browser tab via getDisplayMedia API

Multi-track Audio

Separate audio tracks for mixing and language selection

Simulcast

Publish multiple quality layers for adaptive delivery (1080p, 720p, 360p)

ICE Server Configuration

WAVE automatically provides all ICE servers via Cloudflare - no configuration needed

Best Practices

Expert recommendations for production WebRTC deployments

Use Simulcast for scaling

critical

Publish multiple quality layers (1080p, 720p, 360p) so viewers can adapt to their bandwidth without re-encoding

Impact: Reduces viewer buffering by 80%

Implement reconnection logic

high

WebRTC connections can drop. Implement automatic reconnection with exponential backoff (1s, 2s, 4s, 8s max)

Impact: Maintains 99.9% uptime

Monitor connection quality

high

Use RTCPeerConnection.getStats() every 1-2 seconds to monitor packet loss, jitter, and round-trip time

Impact: Early warning for issues

Handle permissions gracefully

high

Request camera/microphone permissions with clear UI. Handle denied permissions with fallbacks and instructions

Impact: Reduces support tickets 60%

Prefer hardware encoding

medium

Use H.264 or VP9 hardware encoders when available to reduce CPU usage and improve battery life on mobile

Impact: Extends mobile battery 40%

Test across networks

medium

Test on 4G, WiFi, corporate networks, and VPNs to ensure TURN relay works correctly in all scenarios

Impact: Improves reach to 99%+ users

Implement PLI/FIR requests

medium

Request keyframes (Picture Loss Indication) when packet loss is detected to quickly recover video quality

Impact: Reduces freeze time by 70%

Set appropriate constraints

medium

Use ideal/min/max constraints for resolution and framerate to enable browser adaptation

Impact: Better quality matching

Troubleshooting Guide

Common WebRTC issues and detailed solutions with debugging commands

OBS Studio WHIP Support

Native WebRTC publishing from OBS 30+ with sub-second latency

OBS Studio 30.0 and later includes native WHIP output for WebRTC publishing. This provides the lowest latency streaming from professional software with full simulcast support.

Configuration Steps:

  1. 1.Go to Settings → Stream
  2. 2.Select Service: WHIP
  3. 3.Server: https://whip.wave.com/publish/YOUR_STREAM_ID
  4. 4.Bearer Token: wave_live_xxxxx
  5. 5.Click "Start Streaming" – you're live with sub-second latency!
Typical Latency
150-300ms
Codec
VP8/VP9/H264
Simulcast
Supported
Min Version
OBS 30.0

Success Stories

How industry leaders use WAVE WebRTC for real-time communication at scale

Discord

Communication Platform

WAVE's WebRTC infrastructure powers our Go Live feature, delivering sub-200ms latency to millions of concurrent streams. The simulcast support lets viewers pick quality without impacting the streamer.
AR
Alex Rivera
Director of Streaming Engineering
5M+
Concurrent Streams
peak
180ms
P99 Latency
60% better
99.97%
Connection Success
global
Use case: Real-time game streaming and screen sharing in voice channels

Hopin

Virtual Events

We needed WebRTC that could scale to 100,000 attendees while maintaining real-time Q&A interaction. WAVE's edge network and TURN infrastructure made it possible without any dropped connections.
MS
Maria Santos
VP of Platform Engineering
100K+
Max Attendees
single event
99.99%
TURN Success
enterprise
150ms
Avg Latency
end-to-end
Use case: Large-scale virtual conferences with real-time audience interaction

Clubhouse

Social Audio

Sub-100ms audio latency is non-negotiable for natural conversation. WAVE's WebRTC handles our peak loads of 2M+ simultaneous listeners with consistent quality across all network conditions.
JC
James Chen
Head of Real-time Infrastructure
<100ms
Audio Latency
consistent
2M+
Peak Listeners
simultaneous
<20ms
Jitter Buffer
adaptive
Use case: Live audio rooms with real-time speaker switching
WAVE - Enterprise Live Streaming Platform