Building Blocks

A short tour through everything you need to build your next LiveKit app.

Components

Components are the basic building blocks of your LiveKit application, enriched with additional functionality and LiveKit state.

Scopes

Scopes help manage the LiveKit state as well as providing a CompositionLocal for simplifying passing data down into your composables.

  • RoomScope: This scope is the basis for using LiveKit within composables.
  • ParticipantScope: This scope provides a CompositionLocal for a participant.

UI Composables

This library provides UI composables that will form the basis for your LiveKit application.

State Handling

We provide a wide range of remember functions that makes state management easier. Some hooks are foundational and are needed for almost every live app, while others are only needed if you want to build some custom components and go low-level.

Often used and important hooks are:

  • rememberTracks: The rememberTracks state returns an array of current tracks that can be looped, filtered, and processed.
  • rememberParticipants: The rememberParticipants state returns all participants (local and remote) of the current room.
  • rememberTrackMuted: The rememberTrackMuted state allows you to simply implement your own muted indicator.

Additionally, LiveKit class members marked with the @FlowObservable can be observed and converted into Compose State with the io.livekit.android.util.flow utility function.

tip:

Avoid using class member values directly, as that may result in Compose not updating when the values change.

// Avoid!
// val roomName = room.name
// Instead, use its flow and collect as state.
val roomName by room::name.flow.collectAsState()