Red5 Pro WebRTC SDK: Browser Publish and Subscribe
Add sub-second WebRTC streaming to any web page with the Red5 Pro WebRTC SDK. Publish via WHIP and subscribe via WHEP with no browser plugins required.
The Red5 Pro WebRTC SDK lets you add live streaming to any browser-based application without plugins. It uses WebRTC under the hood — with WHIP for publishing and WHEP for subscribing — to deliver sub-second latency audio and video directly in HTML5. Use it for video chat, interactive live broadcasts, online gaming, or any application that needs real-time peer-to-peer media in the browser.
WHIP (WebRTC-HTTP Ingestion Protocol) — used for publishing. Your browser sends an SDP offer to the server over HTTP, and the server negotiates the connection.
WHEP (WebRTC-HTTP Egress Protocol) — used for subscribing. Your browser requests a stream from the server over HTTP and renders the incoming media.
Both protocols run over standard HTTPS, which means they work through firewalls and proxies that block raw WebSocket or RTP traffic.
The following example subscribes to an existing stream and plays it in a <video> element.
import { WHEPClient } from 'red5pro-webrtc-sdk';const subscriber = new WHEPClient();const config = { host: 'userid-xxx.cloud.red5.net', app: 'live', streamName: 'myStream',};// Initialize the subscriberawait subscriber.init(config);// Get the incoming media stream and attach it to a video elementconst mediaStream = await subscriber.subscribe();const player = document.getElementById('remote-video');player.srcObject = mediaStream;player.play();console.log('Playback started');
Standard getUserMedia constraints for resolution and frame rate
For Red5 Cloud deployments, use the Stream Manager hostname from your deployment’s Pub/Sub Details page as the host value. The SDK handles node resolution automatically.