Overview
WebRTC (Web Real-Time Communication) provides sub-second latency streaming, making it ideal for interactive applications like video conferencing, live auctions, and real-time broadcasts. Ant Media Server supports WebRTC for both publishing and playing streams.Key Benefits
- Ultra-low latency: Sub-second (typically 0.5s) latency
- Peer-to-peer capable: Direct browser-to-browser communication
- Adaptive bitrate: Automatically adjusts quality based on network conditions
- Secure by default: Encryption with DTLS and SRTP
- Codec support: H.264, VP8, VP9, H.265 (HEVC), AV1, Opus audio
Publishing Streams
WebRTC SDK Publishing
Playing Streams
WebRTC SDK Playback
Configuration Options
Server-Side Configuration
Configure WebRTC settings in your application’sapplication.properties or via REST API:
Client-Side Media Constraints
Advanced PeerConnection Configuration
Adaptive Bitrate Streaming (ABR)
WebRTC adaptor in Ant Media Server automatically manages stream quality based on network conditions:Troubleshooting
Common Issues
No Video/Audio
- Check browser permissions for camera/microphone
- Verify HTTPS is being used (required for WebRTC)
- Check ICE connection state in browser console
- Verify firewall allows WebRTC ports (50000-60000)
High Latency
- Check network conditions and bandwidth
- Verify server is geographically close to clients
- Reduce video resolution or bitrate
- Enable TURN server for better connectivity
Connection Failures
- Verify WebSocket URL is correct and accessible
- Check STUN/TURN server configuration
- Verify stream exists on server
- Check server logs for errors
