Initialize the LiveKit native module in your AppDelegate file. This must be placed above any other React Native initialization.
Swift Implementation
In AppDelegate.swift:
import livekit_react_native
import livekit_react_native_webrtc
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
) -> Bool {
// Place this above any other RN related initialization
LivekitReactNative.setup()
// ...
}
}
Objective-C Implementation
In AppDelegate.m:
#import "LivekitReactNative.h"
#import "WebRTCModuleOptions.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Place this above any other RN related initialization
[LivekitReactNative setup];
// ...
}
@end
Background Camera Access (iOS 18+):
To use the camera in the background, you require the voip background mode and must enable multitasking camera access via WebRTCModuleOptions:
// Objective-C
WebRTCModuleOptions *options = [WebRTCModuleOptions sharedInstance];
options.enableMultitaskingCameraAccess = YES;
// Swift
let options = WebRTCModuleOptions.sharedInstance()
options.enableMultitaskingCameraAccess = true
import livekit_react_native
import livekit_react_native_webrtc
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
) -> Bool {
LivekitReactNative.setup()
return true
}
}