No history yet

LiveKit Fundamentals

Introducing LiveKit

LiveKit is an open-source platform designed to simplify the creation of real-time audio and video experiences. Instead of wrestling with the low-level complexities of streaming media, developers can use LiveKit's tools to build applications like video conferencing, virtual classrooms, or live-streamed events with much less effort.

The core idea behind LiveKit is to provide a robust, scalable infrastructure that handles the heavy lifting of real-time communication. This lets you focus on building the user interface and features for your specific application.

Lesson image

The Architecture

At its heart, LiveKit uses a client-server architecture. But it's a specific type of server known as a Selective Forwarding Unit, or SFU. In a traditional peer-to-peer (P2P) video call with several people, your computer has to send your video stream to every single other person, and receive a stream from each of them in return. As more people join, the amount of data your computer has to handle explodes.

The SFU model solves this. Each participant sends just one stream of their audio and video to the central LiveKit server. The server then becomes the traffic cop, selectively forwarding those streams to the other participants in the room. This is vastly more efficient and scalable, allowing for sessions with many more users without overwhelming any single person's internet connection.

This central server model is what allows LiveKit to support large, complex sessions efficiently.

WebRTC Integration

LiveKit is built on top of WebRTC (Web Real-Time Communication), a powerful open-source project maintained by Google that enables real-time communication directly in web browsers and mobile applications. WebRTC provides the fundamental building blocks for streaming audio, video, and data between peers.

However, working with WebRTC directly can be incredibly complex. It involves managing network connections, handling different network conditions (like firewalls), negotiating media formats, and synchronizing streams. LiveKit abstracts all this complexity away. It uses WebRTC for the actual media transport but provides a much simpler, high-level API for developers.

Think of it this way: WebRTC provides the engine and the wheels for a car, but LiveKit builds the rest of the car around it—the chassis, the steering wheel, and the seats—making it a complete, ready-to-drive vehicle.

LiveKit's server handles the difficult parts of WebRTC, like signaling (how peers find and connect to each other) and NAT traversal (getting through routers and firewalls), so you don't have to. The Client SDKs wrap the WebRTC functionality in a clean, easy-to-use package.

The architecture integrates a Flutter-based cross-platform mobile interface with MQTT-based control signaling and WebRTC video streaming via the LiveKit framework.

Core Components

To work with LiveKit, you just need to understand a few key concepts.

ComponentDescription
RoomA virtual session where participants communicate. Anyone with the room's name and proper credentials can join.
ParticipantA user connected to a Room. Each participant has a unique identity.
TrackA single stream of media, either audio or video. A participant can publish multiple tracks (e.g., camera and screen share).
Client SDKLibraries for different platforms (web, iOS, Android, React Native) that connect to the LiveKit server and manage tracks.
LiveKit ServerThe SFU that routes media between participants in a room. You can self-host this or use LiveKit's cloud service.

When a user joins a LiveKit session, their application uses a Client SDK to connect to a Room on the LiveKit Server. Once connected, they become a Participant. They can then publish their own Tracks (like from their microphone and camera) and subscribe to the Tracks published by other Participants in the same room. The SDK handles rendering the video and playing the audio from those subscribed tracks.

This simple but powerful model is the foundation for building any real-time media application with LiveKit.

Quiz Questions 1/4

What is the primary architectural model that LiveKit uses to manage real-time media streams efficiently in large sessions?

Quiz Questions 2/4

What is the relationship between LiveKit and WebRTC?

With these fundamentals in place, you're ready to start exploring how to build with LiveKit.