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.)
We require a set of permissions that need to be declared in your AppManifest.xml
. These are required by Flutter WebRTC, which we depend on.
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.your.package"><uses-feature android:name="android.hardware.camera" /><uses-feature android:name="android.hardware.camera.autofocus" /><uses-permission android:name="android.permission.CAMERA" /><uses-permission android:name="android.permission.RECORD_AUDIO" /><uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /><uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" /><uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /><uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30" /><uses-permission android:name="android.permission.BLUETOOTH_ADMIN" android:maxSdkVersion="30" />...</manifest>
<dict>...<key>NSCameraUsageDescription</key><string>$(PRODUCT_NAME) uses your camera</string><key>NSMicrophoneUsageDescription</key><string>$(PRODUCT_NAME) uses your microphone</string>...</dict>
In order to enable Flutter desktop development, please follow instructions here.
On M1 Macs, you will also need to install x86_64 version of FFI:
sudo arch -x86_64 gem install ffi
On Windows VS 2019 is needed (link in flutter docs will download VS 2022).
In order to enable Flutter desktop development, please follow instructions here.
On M1 Macs, you will also need to install x86_64 version of FFI:
sudo arch -x86_64 gem install ffi
On Windows VS 2019 is needed (link in flutter docs will download VS 2022).
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 simulatorawait 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
Use our Server SDKs to create a backend server than generates tokens for your app at runtime: