Ultra-low latency streaming via Cloudflare Calls edge network
How WebRTC compares to other streaming protocols
| Protocol | Typical Latency | Best For |
|---|---|---|
Traditional RTMP + HLS | 15-30 seconds | VOD, non-interactive |
Low-Latency HLS (LL-HLS) | 2-5 seconds | Most live streaming |
SRT | 0.5-2 seconds | Professional contribution |
WebRTC (WHIP/WHEP) Fastest | <500ms | Real-time interaction |
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();Features available when publishing via WebRTC
Publish streams directly from web browsers using getUserMedia API
OBS Studio 30+ has native WHIP support for WebRTC publishing
Native iOS and Android SDKs for mobile broadcasting with hardware encoding
Capture desktop, window, or browser tab via getDisplayMedia API
Separate audio tracks for mixing and language selection
Publish multiple quality layers for adaptive delivery (1080p, 720p, 360p)
WAVE automatically provides all ICE servers via Cloudflare - no configuration needed
Expert recommendations for production WebRTC deployments
Publish multiple quality layers (1080p, 720p, 360p) so viewers can adapt to their bandwidth without re-encoding
Impact: Reduces viewer buffering by 80%
WebRTC connections can drop. Implement automatic reconnection with exponential backoff (1s, 2s, 4s, 8s max)
Impact: Maintains 99.9% uptime
Use RTCPeerConnection.getStats() every 1-2 seconds to monitor packet loss, jitter, and round-trip time
Impact: Early warning for issues
Request camera/microphone permissions with clear UI. Handle denied permissions with fallbacks and instructions
Impact: Reduces support tickets 60%
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 on 4G, WiFi, corporate networks, and VPNs to ensure TURN relay works correctly in all scenarios
Impact: Improves reach to 99%+ users
Request keyframes (Picture Loss Indication) when packet loss is detected to quickly recover video quality
Impact: Reduces freeze time by 70%
Use ideal/min/max constraints for resolution and framerate to enable browser adaptation
Impact: Better quality matching
Common WebRTC issues and detailed solutions with debugging commands
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.
WHIPhttps://whip.wave.com/publish/YOUR_STREAM_IDwave_live_xxxxxHow industry leaders use WAVE WebRTC for real-time communication at scale
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.”
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.”
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.”