⌘K

LiveKit

LiveKit is a component of the WandKit framework that provides functionalities such as screen sharing, keeping the screen active, and auto-connecting to the environment. It is specifically designed to work with the Nativeblocks Studio environment.


LiveKit

public struct LiveKit: WandKit 

Inheritance

WandKit

Initializers

Initializes the LiveKit module with configurable options.

public init(
        screenSharing: Bool = false,
        screenShareExtention: String = "",
        keepScreenOn: Bool = true,
        autoConnect: Bool = true
    ) 
Parameters
  • screenSharing: A flag to enable or disable screen sharing (default: false).
  • screenShareExtention: The extension identifier required for screen sharing (default: "").
  • keepScreenOn: A flag to keep the screen active (default: true).
  • autoConnect: A flag to enable automatic connection (default: true).

Methods

destroy

Destroys the LiveKit instance and cleans up resources.

public func destroy() 

Sample Usage


NativeblocksManager.initialize()

#if DEBUG
    let bundleId = Bundle.main.bundleIdentifier ?? ""
    _ = NativeblocksManager.getInstance().wandKit(
        LiveKit(
            screenSharing: true,
            screenShareExtention: "\(bundleId).LiveKitExtention",
            keepScreenOn: true,
            autoConnect: false
        )
    )
#endif

LiveKitScreenSharingHandler

LiveKitScreenSharingHandler is a handler for managing screen sharing functionality in the LiveKit module. This class is designed to facilitate the broadcast lifecycle when screen sharing is enabled.

open class LiveKitScreenSharingHandler: AgoraReplayKitHandler 

Inheritance

AgoraReplayKitHandler

Methods

broadcastStarted

Called when the broadcast starts with the provided setup information.

open override func broadcastStarted(withSetupInfo setupInfo: [String: NSObject]?) 
Parameters
  • setupInfo: A dictionary containing setup information for the broadcast.

Sample Usage

import NativeblocksWandKit
import ReplayKit

class SampleHandler: LiveKitScreenSharingHandler {
    override func broadcastStarted(withSetupInfo setupInfo: [String: NSObject]?) {
        // User has requested to start the broadcast. Setup info from the UI extension can be supplied but optional.
        super.broadcastStarted(withSetupInfo: setupInfo)
    }
}