LiveKit LogoDocs
Real-timeEgress/IngressCloudReference

Flutter Quickstart

On this page

1. Install LiveKit SDK2. Declare permissions2. Connect to a room, publish video & audio3. Create a backend server to generate tokens

1. Install LiveKit SDK

Include this package to your pubspec.yaml

---
dependencies:
livekit_client: <version>

2. Declare permissions

Camera and microphone usage need to be declared in your Info.plist file.

Your application can still run a voice call when it is switched to the background if the background mode is enabled. Select the app target in Xcode, click the Capabilities tab, enable Background Modes, and check Audio, AirPlay, and Picture in Picture.

Your Info.plist should have the following entries:

<dict>
...
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
</array>

(We strongly recommend using Flutter 3.3.0+. if you are using Flutter 3.0.0 or below, please see this note in our SDK README.)

2. Connect to a room, publish video & audio

final roomOptions = RoomOptions(
adaptiveStream: true,
dynacast: true,
// ... your room options
)
final room = await LiveKitClient.connect(url, token, roomOptions: roomOptions);
try {
// video will fail when running in ios simulator
await room.localParticipant.setCameraEnabled(true);
} catch (error) {
print('Could not publish video, error: $error');
}
await room.localParticipant.setMicrophoneEnabled(true);

3. Create a backend server to generate tokens

Set up a server to generate tokens for your app at runtime by following this guide: Generating Tokens.

LiveKit logo

Product

SFU

SDKs

Performance

Deployment

GitHub Logo