where are webrtc and websockets used in livekit in...
# ask-ai
f
where are webrtc and websockets used in livekit infrastructure
t
Thanks for reaching out, Amjad. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
LiveKit utilizes WebRTC and WebSockets in its infrastructure as follows: • WebRTC: This is the primary transport protocol for real-time media, including audio, video, and data. It is optimized for media with advanced codecs and compression algorithms, ensuring ultra-low latency and network resilience. WebRTC is crucial for synchronized experiences like live sports viewing. • WebSockets: These are used specifically in integrations, such as with OpenAI's Realtime API, for low-latency audio streaming. LiveKit bridges WebSockets and WebRTC, converting WebSocket transport to WebRTC for better performance over long distances or slower networks. This hybrid approach leverages the strengths of both protocols to provide efficient and reliable communication in LiveKit's infrastructure. Sources: LiveKit | LiveKit Docs
f
how does livekit encode the audio when using a web call via livekit js sdk
t
When using the LiveKit JS SDK for web calls, audio encoding can be configured with the following options: • Audio Presets: The
audioPreset
property allows you to set audio presets, with the default being
AudioPresets.music
. • Stereo Support: The
forceStereo
property enables or disables stereo mode, based on the capture channel count by default. • DTX (Discontinuous Transmission): This feature, enabled by default for mono tracks, can be controlled using the
dtx
property. • RED (Redundant Audio Data): The
red
property enables or disables redundant audio data, which is also enabled by default for mono tracks. • HD Voice Support: Wideband audio codecs like G.722 are supported for higher quality audio (HD Voice) when compatible with SIP trunks or endpoints. These settings can be adjusted through the
TrackPublishOptions
interface when publishing audio tracks. Sources: TrackPublishOptions | LiveKit JS Client SDK - v2.8.1 | TrackPublishDefaults | LiveKit JS Client SDK - v2.8.1 | Configuring HD Voice for SIP | LiveKit Docs