Quickstart
Add voxera_audio_room_kit to a Flutter app and join a voice room.
You need a project with audio_room enabled. If you don't have one, follow Get started first.
Install
Add the package to pubspec.yaml:
dependencies:
voxera_audio_room_kit: ^2.2.2Set up iOS and Android
iOS: add this to ios/Runner/Info.plist:
<key>NSMicrophoneUsageDescription</key>
<string>Required for audio room participation</string>To keep audio playing in the background, enable Background Modes > Audio, AirPlay, and Picture in Picture in Xcode.
Android: add this to android/app/src/main/AndroidManifest.xml:
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />Set minSdkVersion to at least 21, or 31 if you want Android Picture-in-Picture.
Open a room
VoxeraAudioRoom(
appId: '<voxera-app-id>',
appKey: '<voxera-app-key>', // publishable, no token server needed
userId: 'user123',
userName: 'John Doe',
roomId: 'room456',
roomOwnerId: 'owner789', // userId == roomOwnerId makes this user the host
);The kit renders a dark background, the seat grid, a header with minimize and exit, the chat list and the controls bar. Connect failures show an error and a retry button.
Roles
- The host is the user whose
userIdequalsroomOwnerId. - Admins come from the room's saved admin list. See moderation.
- Everyone else joins as the audience.
By default, a host or admin joins with the microphone on, and the host takes seat hostSeatIndex if nobody seated them. Change this with autoHostMic and autoSeatHost in the configuration.
Set up the audio engine
The native media engine is built once per process, and whatever touches it first decides its audio profile. The kit handles this itself. If your app touches WebRTC before the first room opens, call this first in main():
import 'package:flutter/widgets.dart';
import 'package:voxera_media_client/voxera_media_client.dart';
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) => const SizedBox();
}
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await VoxeraMediaClient.initializeForRoom();
runApp(const MyApp());
}That keeps echo cancellation on. Don't call initialize(mediaAudioProfile: true), because it turns echo cancellation off for the rest of the process.
Use another Voxera deployment
The kit sends requests to https://stream.zavryn.online by default. Only set tokenBaseUrl and engineBaseUrl if you've been given a different deployment.