Skip to main content
← Back to Quickstart Guides

Multi-Protocol Streaming

One source, multiple protocols, global reach

20 minutes
Intermediate
Universal Compatibility

Create Multi-Protocol Stream

Enable all protocols with one API call

import { WaveClient } from '@wave/sdk';

import { DesignTokens, getContainer, getSection } from '@/lib/design-tokens';
const wave = new WaveClient({
  apiKey: process.env.WAVE_API_KEY
});

// Create multi-protocol stream
const stream = await wave.streams.create({
  title: 'Global Event Stream',
  protocols: ['webrtc', 'srt', 'rtmp', 'ndi'],
  settings: {
    // WebRTC for browser viewers (<500ms latency)
    webrtc: {
      quality: 'uhd',
      codec: 'vp9',
      enable_simulcast: true
    },
    // SRT for reliable contribution (<2s latency)
    srt: {
      latency_ms: 1000,
      encryption: true,
      mode: 'caller'
    },
    // RTMP for legacy compatibility (<5s latency)
    rtmp: {
      codec: 'h264',
      bitrate: '5000k'
    },
    // NDI for production workflows (<100ms)
    ndi: {
      source_name: 'WAVE-MULTI',
      enable_tally: true,
      bandwidth: 'high'
    }
  }
});

console.log('WebRTC URL:', stream.webrtc_url);
console.log('SRT URL:', stream.srt_url);
console.log('RTMP URL:', stream.rtmp_url);
console.log('NDI Source:', stream.ndi_source);

Protocol Comparison

Choose the right protocol for each use case

ProtocolLatencyBest ForQualityBusiness Value
WebRTC<500msBrowser viewers, real-time interactionHD to UHD42% more engagement with sub-500ms latency. Enables interactive monetization (polls, auctions)
SRT1-3sContribution feeds, unreliable networksBroadcast qualitySave $100K+/yr on backup infrastructure. 99.99% uptime without expensive redundancy
RTMP3-10sLegacy encoders, social platformsSD to HDZero encoder changes. Works with 100+ legacy systems. Drop-in replacement for existing setups
NDI<100msProduction, studio workflowsUncompressedEliminate $20K-50K transcoding infrastructure. Reduce production setup by 12+ hours

Advanced: Protocol-Specific Viewers

Serve optimized streams based on viewer capabilities

// Smart protocol selection based on viewer
async function getOptimalPlaybackUrl(
  streamId: string,
  viewerContext: ViewerContext
) {
  const stream = await wave.streams.get(streamId);

  // Browser with WebRTC support
  if (viewerContext.browser && viewerContext.webrtc_supported) {
    return stream.webrtc_url; // <500ms latency
  }

  // Professional broadcast equipment
  if (viewerContext.equipment === 'broadcast') {
    return stream.ndi_source; // <100ms, full quality
  }

  // Reliable connection needed
  if (viewerContext.network_reliability < 0.8) {
    return stream.srt_url; // FEC enabled
  }

  // Fallback to RTMP for legacy
  return stream.rtmp_url;
}

Monitoring Multi-Protocol Streams

Track performance across all protocols

// Get analytics for all protocols
const analytics = await wave.analytics.get(streamId, {
  breakdown_by: 'protocol',
  metrics: ['viewers', 'latency', 'bitrate', 'errors']
});

analytics.protocols.forEach(protocol => {
  console.log(`${protocol.name}:`);
  console.log(`  Viewers: ${protocol.viewers}`);
  console.log(`  Avg Latency: ${protocol.latency_ms}ms`);
  console.log(`  Bitrate: ${protocol.bitrate}`);
  console.log(`  Error Rate: ${protocol.error_rate}%`);
});

// Output:
// webrtc:
//   Viewers: 12,453
//   Avg Latency: 287ms
//   Bitrate: 2.4 Mbps
//   Error Rate: 0.02%
// srt:
//   Viewers: 156
//   Avg Latency: 1,245ms
//   Bitrate: 8.5 Mbps
//   Error Rate: 0.01%
Multi-Protocol Streaming - Quickstart | WAVE Docs | WAVE