⌘K

LiveKit

LiveKit is a component of the Wandkit framework that provides functionalities such as keeping the screen active, and auto-connecting to the Nativeblocks Studio environment. It is tailored for Android applications and integrates seamlessly with the Nativeblocks ecosystem.


Features

  1. Keep Screen On:
  • Prevents the device screen from turning off automatically.
  1. Auto-Connect:
  • Simplifies live session workflows by automatically connecting to the environment.

LiveKit

class LiveKit : WandKit

Inheritance

Implements: Wandkit


Constructor

Initializes the LiveKit module with configurable options.

LiveKit(
    keepScreenOn: Boolean = true,
    autoConnect: Boolean = true
)

Parameters

  • keepScreenOn: Keeps the device screen active during live sessions (default: true).
  • autoConnect: Automatically connects to the live environment (default: true).

Methods

setup

Configures the LiveKit instance with the provided context and Nativeblocks edition.

override fun setup(context: Context, edition: NativeblocksEdition)
Parameters
  • context: The Android Context used to initialize the live service.
  • edition: The NativeblocksEdition (Cloud or Community). LiveKit is only supported for the Cloud edition.
Exceptions
  • Throws IllegalAccessException if the Community edition is used.

destroy

Destroys the LiveKit instance and cleans up resources.

override fun destroy()

Sample Usage

Here’s an example of how to configure and use LiveKit in an Android application:

import android.app.Application
import io.nativeblocks.core.api.NativeblocksManager

class MyApplication : Application() {

    override fun onCreate() {
        super.onCreate()

        // Initialize NativeblocksManager
        NativeblocksManager.initialize()

        // Configure LiveKit for debug builds
        if (BuildConfig.DEBUG) {
            NativeblocksManager.getInstance().liveKit(
                keepScreenOn = true,   // Keep the screen active
                autoConnect = false    // Disable auto-connect
            )
        }
    }
}

Extension Function

liveKit

Initializes a LiveKit instance for the NativeblocksManager.

fun NativeblocksManager.liveKit(
    keepScreenOn: Boolean = true,
    autoConnect: Boolean = true
): NativeblocksManager
Parameters
  • keepScreenOn: Keeps the device screen active during live sessions (default: true).
  • autoConnect: Automatically connects to the live environment (default: true).
Returns

The NativeblocksManager instance with the configured LiveKit.