mic

Rooms

Voice Rooms

Use Rust for room membership and realtime events, and LiveKit for microphone audio and remote participants.

Create a voice room

dart
final room = await sdk.createRoom(
  groupId: 'RUST_GROUP_UUID',
  name: 'Town Hall',
  roomType: 'voice',
);

Join the Rust room

dart
await sdk.joinRoom(
  roomId: room.id,
  userId: auth.user.id,
);

Connect realtime signaling

dart
await sdk.connectRoomSocket(
  roomId: room.id,
  userId: auth.user.id,
  username: auth.user.username,
);

Connect LiveKit voice

dart
await sdk.connect(
  SpliveSessionConfig(
    serverUrl: mediaUrl,
    accessToken: mediaToken,
    roomId: room.id,
    userId: auth.user.id,
    displayName: auth.user.username,
    enableMicrophoneOnConnect: false,
  ),
);

Microphone and speaker

dart
await sdk.enableMicrophone();
await sdk.disableMicrophone();
await sdk.toggleMicrophone();
await sdk.setSpeakerOutput(true);

Participants

dart
final subscription = sdk.participants.listen((participants) {
  for (final participant in participants) {
    print(participant.displayName);
  }
});

Leave

dart
await sdk.leaveRoom(roomId: room.id);
await sdk.disconnectRoomSocket();
await sdk.disconnect();
Use LiveKit exclusively for media negotiation. The legacy custom offer/answer routes should not be used at the same time.