1. Install the LiveKit SDK
flutter pub add livekit_client
2. Add required permissions
You'll need to request camera and/or microphone permissions (depending on your use case). This must be done within your platform-specific code:
Permissions are configured in AppManifest.xml
. In addition to camera and microphone, you may need to add networking and bluetooth permissions.
<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" />
2. Connect to a room, publish video & audio
final roomOptions = RoomOptions(adaptiveStream: true,dynacast: true,// ... your room options)final room = Room();await room.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. Next Steps
- Set up a server to generate tokens for your app at runtime by following this guide: Generating Tokens.
- View the full SDK reference and GitHub repository for more documentation and examples.
Happy coding!