Skip to content


Repository files navigation

The LiveKit icon, the name of the repository and some sample code in the background.

Android Kotlin SDK for LiveKit

Use this SDK to add real-time video, audio and data features to your Android/Kotlin app. By connecting to a self- or cloud-hosted LiveKit server, you can quickly build applications like interactive live streaming or video calls with just a few lines of code.

Table of Contents


Docs and guides at

API reference can be found at .


This is v2 of the Android SDK. When migrating from v1.x to v2.x you might encounter a small set of breaking changes. Read the migration guide for a detailed overview of what has changed.


LiveKit for Android is available as a Maven package.

dependencies {
  implementation "io.livekit:livekit-android:2.2.0"
  // Snapshots of the latest development version are available at:
  // implementation "io.livekit:livekit-android:2.2.1-SNAPSHOT"

Compose-based apps should check out our Android Components SDK for composables support.

You'll also need jitpack as one of your repositories.

dependencyResolutionManagement {
    repositories {
        maven { url '' }

        // For SNAPSHOT access
        // maven { url '' }



LiveKit relies on the RECORD_AUDIO and CAMERA permissions to use the microphone and camera. These permission must be requested at runtime. Reference the sample app for an example.

Publishing camera and microphone


Sharing screen

// create an intent launcher for screen capture
// this *must* be registered prior to onCreate(), ideally as an instance val
val screenCaptureIntentLauncher = registerForActivityResult(
) { result ->
    val resultCode = result.resultCode
    val data =
    if (resultCode != Activity.RESULT_OK || data == null) {
    lifecycleScope.launch {
        room.localParticipant.setScreenShareEnabled(true, data)

// when it's time to enable the screen share, perform the following
val mediaProjectionManager =
    getSystemService(MEDIA_PROJECTION_SERVICE) as MediaProjectionManager

Rendering subscribed tracks

LiveKit uses SurfaceViewRenderer to render video tracks. A TextureView implementation is also provided through TextureViewRenderer. Subscribed audio tracks are automatically played.

class MainActivity : AppCompatActivity() {

    lateinit var room: Room

    override fun onCreate(savedInstanceState: Bundle?) {


        // Create Room object.
        room = LiveKit.create(applicationContext)

        // Setup the video renderer


    private fun connectToRoom() {

        val url = "wss://your_host"
        val token = "your_token"

        lifecycleScope.launch {

            // Setup event handling.
            launch {
       { event ->
                    when (event) {
                        is RoomEvent.TrackSubscribed -> onTrackSubscribed(event)
                        else -> {}

            // Connect to server.

            // Turn on audio/video recording.
            val localParticipant = room.localParticipant

    private fun onTrackSubscribed(event: RoomEvent.TrackSubscribed) {
        val track = event.track
        if (track is VideoTrack) {

    private fun attachVideo(videoTrack: VideoTrack) {
        findViewById<View>( = View.GONE

See the basic sample app for the full implementation.

Audio modes

By default, the audio is configured for two-way communications.

If you are building a livestreaming or media playback focus app, you can use the preset MediaAudioType when creating the Room object for better audio quality.

val room = LiveKit.create(
    appContext = application,
    overrides = LiveKitOverrides(
        audioOptions = AudioOptions(
            audioOutputType = AudioType.MediaAudioType()

Note: audio routing becomes automatically handled by the system and cannot be manually controlled.

For more control over the specific audio attributes and modes, a CustomAudioType can be passed instead.


Properties marked with @FlowObservable can be accessed as a Kotlin Flow to observe changes directly:

coroutineScope.launch {
    room::activeSpeakers.flow.collectLatest { speakersList ->

Sample App

Note: If you wish to run the sample apps directly from this repo, please consult the Dev Environment instructions.

We have a basic quickstart sample app here, showing how to connect to a room, publish your device's audio/video, and display the video of one remote participant.

There are two more full featured video conferencing sample apps:

They both use the CallViewModel , which handles the Room connection and exposes the data needed for a basic video conferencing app.

The respective ParticipantItem class in each app is responsible for the displaying of each participant's UI.

Dev Environment

To develop the Android SDK or running the sample app directly from this repo, you'll need:

  • Clone the repo to your computer
  • Ensure the protocol submodule repo is initialized and updated
git clone
cd client-sdk-android
git submodule update --init

For those developing on Macs with Apple silicon (e.g. M1, M2, etc.), please add below to $HOME/.gradle/


Optional (Dev convenience)

  1. Download webrtc sources from
  2. Add sources to Android Studio by pointing at the webrtc/sdk/android folder.

LiveKit Ecosystem
Real-time SDKsReact Components · JavaScript · iOS/macOS · Android · Flutter · React Native · Rust · Python · Unity (web) · Unity (beta)
Server APIsNode.js · Golang · Ruby · Java/Kotlin · Python · Rust · PHP (community)
Agents FrameworksPython · Playground
ServicesLivekit server · Egress · Ingress · SIP
ResourcesDocs · Example apps · Cloud · Self-hosting · CLI