Live Streaming
Broadcast to thousands of viewers with ultra-low latency live streaming
Overview
BaxCloud's live streaming enables you to broadcast video content to thousands of concurrent viewers with sub-second latency. Built on WebRTC for ultra-low latency delivery, our platform is perfect for live events, webinars, gaming streams, auctions, and interactive broadcasts where real-time engagement matters.
Unlike traditional HLS streaming which has 10-30 second delays, BaxCloud delivers streams with 300-500ms latency, enabling real-time chat interactions, live Q&A, and instant audience reactions. Our global edge network ensures smooth playback even for viewers on slow connections through adaptive bitrate streaming.
Ultra-Low Latency
Sub-second latency (300-500ms) for real-time viewer interactions
Unlimited Viewers
Scale to millions of concurrent viewers with our global CDN
RTMP & WebRTC
Stream from OBS, browser, mobile, or any RTMP-compatible encoder
Streaming Architecture
BaxCloud uses a hybrid streaming architecture that combines the best of RTMP ingest, WebRTC delivery, and HLS fallback. This ensures maximum compatibility while maintaining the lowest possible latency.
1. Stream Ingestion
Broadcasters can publish streams using multiple protocols:
- WebRTC: Browser and mobile apps (lowest latency, ~300ms)
- RTMP: OBS Studio, vMix, Wirecast, hardware encoders (~1-2s latency)
- SRT: Professional broadcast equipment (low latency, reliable)
2. Media Processing
Our edge servers process incoming streams:
- Transcode to multiple bitrates (adaptive streaming)
- Generate WebRTC and HLS outputs simultaneously
- Apply video filters, watermarks, and overlays
- Record streams to cloud storage
3. Delivery & Playback
Viewers receive streams via the best available protocol:
- WebRTC: Modern browsers, mobile apps (300-500ms latency)
- HLS: Fallback for older devices/browsers (5-10s latency)
- Adaptive bitrate: Automatically adjusts quality to viewer's bandwidth
Host vs Viewer Roles
Host (Broadcaster)
- Publish audio and video streams to thousands
- Control stream quality, bitrate, and resolution
- Start/stop recording and save to cloud
- Moderate chat and manage viewers
- Monitor stream health and viewer analytics
Viewer (Audience)
- Watch live stream with minimal latency
- Participate in real-time chat
- Send reactions, emojis, and engagement signals
- Adaptive quality based on internet speed
- Ultra-low bandwidth consumption
Implementation Guide
Step-by-step guide to implementing live streaming
Start Broadcasting (Host)
To start broadcasting, connect to a room with isHost: true and enable your camera/microphone. The stream will be automatically distributed to all viewers.
1import { BaxCloudClient } from '@baxcloud/react-sdk';
2import { useState } from 'react';
3
4const LiveStreamHost = () => {
5 const [client, setClient] = useState<BaxCloudClient | null>(null);
6 const [isLive, setIsLive] = useState(false);
7
8 const goLive = async () => {
9 const baxClient = new BaxCloudClient({
10 projectId: 'your-project-id',
11 apiKey: 'your-api-key',
12 });
13
14 // Connect as host
15 await baxClient.connect({
16 roomName: 'my-live-stream',
17 liveType: 'live_streaming',
18 participant: {
19 userId: 'host-123',
20 name: 'Stream Host',
21 avatarUrl: 'https://example.com/avatar.jpg',
22 isHost: true,
23 },
24 });
25
26 // Enable camera and microphone
27 await baxClient.enableCamera();
28 await baxClient.enableMicrophone();
29
30 // Optional: Start cloud recording
31 const recording = await baxClient.startRecording({
32 roomName: 'my-live-stream',
33 fileType: 'MP4',
34 });
35
36 setClient(baxClient);
37 setIsLive(true);
38 };
39
40 const endStream = async () => {
41 if (client) {
42 await client.stopRecording(recording.egressId);
43 await client.disconnect();
44 }
45 setIsLive(false);
46 };
47
48 return (
49 <div>
50 {!isLive ? (
51 <button onClick={goLive}>Go Live</button>
52 ) : (
53 <button onClick={endStream}>End Stream</button>
54 )}
55 </div>
56 );
57};Join as Viewer
Viewers connect with isHost: false and receive the broadcast stream automatically. They don't need to enable camera/microphone.
1import { BaxCloudClient } from '@baxcloud/react-sdk';
2import { useState } from 'react';
3
4const LiveStreamViewer = () => {
5 const [client, setClient] = useState<BaxCloudClient | null>(null);
6 const [isWatching, setIsWatching] = useState(false);
7
8 const joinStream = async () => {
9 const baxClient = new BaxCloudClient({
10 projectId: 'your-project-id',
11 apiKey: 'your-api-key',
12 });
13
14 // Connect as viewer
15 await baxClient.connect({
16 roomName: 'my-live-stream',
17 liveType: 'live_streaming',
18 participant: {
19 userId: 'viewer-456',
20 name: 'John Viewer',
21 avatarUrl: 'https://example.com/avatar.jpg',
22 isHost: false,
23 },
24 });
25
26 setClient(baxClient);
27 setIsWatching(true);
28 };
29
30 const leaveStream = async () => {
31 await client?.disconnect();
32 setIsWatching(false);
33 };
34
35 return (
36 <div>
37 {!isWatching ? (
38 <button onClick={joinStream}>Watch Stream</button>
39 ) : (
40 <button onClick={leaveStream}>Leave</button>
41 )}
42 </div>
43 );
44};RTMP Streaming (OBS, vMix, etc.)
BaxCloud supports RTMP ingestion, allowing you to stream from professional tools like OBS Studio, vMix, Wirecast, or hardware encoders.
RTMP Server URL:
rtmp://ingest.baxcloud.com/liveStream Key Format:
{roomName}?token={accessToken}OBS Studio Configuration
- Open OBS Studio → Settings → Stream
- Select "Custom" as the service
- Enter Server:
rtmp://ingest.baxcloud.com/live - Enter Stream Key:
my-stream?token=YOUR_TOKEN - Click Apply and OK
- Click "Start Streaming" in OBS
Monitor Stream Health
Monitor your stream's health, quality metrics, and viewer engagement in real-time.
1// Monitor network quality
2const quality = controller.getNetworkQuality();
3console.log('Connection quality:', quality.connectionQuality);
4console.log('RTT:', quality.rtt);
5console.log('Packet loss:', quality.packetLoss);
6
7// Listen for quality changes
8controller.onNetworkQualityChanged((quality) => {
9 if (quality.connectionQuality === 'poor') {
10 console.warn('Stream quality is degraded. Check your internet connection.');
11 }
12});Viewer Capacity & Scaling
BaxCloud's global infrastructure automatically scales to handle any number of concurrent viewers. Our edge network ensures viewers connect to the nearest server for optimal performance.
Automatic Scaling
- 0-1,000 viewers: Single edge server
- 1,000-10,000 viewers: Regional distribution
- 10,000+ viewers: Global CDN activation
- No manual configuration required
Geographic Distribution
- 150+ edge locations worldwide
- Automatic geo-routing to nearest server
- < 50ms latency in most regions
- 99.99% uptime SLA
Latency Optimization
BaxCloud provides multiple latency modes to balance between latency and quality based on your use case.
1// Connect to room for live streaming
2await client.connect({
3 roomName: 'my-stream',
4 liveType: 'live_streaming',
5 participant: {
6 userId: 'host-123',
7 name: 'Stream Host',
8 avatarUrl: 'https://example.com/avatar.jpg',
9 isHost: true,
10 },
11});
12
13// Note: Latency optimization is handled automatically by the SDKUse Cases by Latency Mode
- Ultra-Low: Auctions, gaming, sports betting, live Q&A
- Low: Webinars, conferences, interactive events
- Balanced: Pre-recorded content, concerts, one-way broadcasts
Cloud Recording & VOD
Automatically record live streams to cloud storage and make them available as video-on-demand (VOD) content. Recordings include full video, audio, and can be automatically transcoded for different devices.
1// Start recording when going live
2const recording = await client.startRecording({
3 roomName: 'my-stream',
4 fileType: 'MP4',
5});
6
7console.log('Recording started:', recording.egressId);
8
9// Stop recording
10await client.stopRecording(recording.egressId);Best Practices
1. Optimize Upload Bandwidth
Ensure you have sufficient upload bandwidth for your target quality:
- 1080p @ 30fps: 5-8 Mbps upload
- 720p @ 30fps: 3-5 Mbps upload
- 480p @ 30fps: 1-2 Mbps upload
2. Test Before Going Live
Always do a test stream to verify quality and settings.
1// Create a test stream
2await client.connect({
3 roomName: 'test-stream-' + Date.now(),
4 liveType: 'live_streaming',
5 participant: {
6 userId: 'host-123',
7 name: 'Test Stream',
8 avatarUrl: 'https://example.com/avatar.jpg',
9 isHost: true,
10 },
11});3. Monitor Stream Health
Keep an eye on stream metrics and alert users about issues.
1// Monitor connection state
2const connectionState = client.getConnectionState();
3if (connectionState === 'reconnecting') {
4 showNotification('Reconnecting...');
5}
6
7// Monitor network quality via controller
8import { useBaxCloudRoom } from '@baxcloud/react-sdk';
9
10const { controller } = useBaxCloudRoom();
11const quality = controller.getNetworkQuality();
12
13if (quality.connectionQuality === 'poor') {
14 showNotification('Poor stream quality. Consider reducing resolution.');
15}4. Handle Stream Interruptions
The SDK automatically handles reconnection. Monitor connection state to show user feedback.
1// Monitor connection state
2const connectionState = client.getConnectionState();
3
4if (connectionState === 'reconnecting') {
5 console.log('Stream disconnected. Attempting to reconnect...');
6 showReconnectingMessage();
7} else if (connectionState === 'connected') {
8 console.log('Reconnected successfully');
9 hideReconnectingMessage();
10} else if (connectionState === 'failed') {
11 console.error('Failed to reconnect');
12 showError('Connection failed. Please try again.');
13}Troubleshooting
Stream Not Starting
- Verify camera/microphone permissions are granted
- Check if another app is using the camera
- Ensure you're connected as host (
isHost: true) - Verify API credentials are correct
Poor Stream Quality / Buffering
- Test upload speed (should be 2x your target bitrate)
- Close other applications using bandwidth
- Reduce stream resolution or framerate
- Use wired ethernet instead of WiFi
- Check CPU usage (encoding is CPU-intensive)
Viewers Can't See Stream
- Ensure host has started broadcasting
- Verify viewers are connecting to the correct room name
- Check if room is in test mode
- Confirm viewers have viewer role (
isHost: false)
High Latency
- Switch to ultra-low latency mode
- Reduce buffer size
- Check geographic distance between host and viewers
- Verify edge servers are accessible