logo
On this page

Quick start

Prerequisites

​If you don't know how to create a project and obtain an app ID, please refer to this guide.

Integrate the SDK

Add ZegoUIKitPrebuiltLiveAudioRoom as dependencies

Run the following code in your project's root directory:

Untitled
flutter pub add zego_uikit_prebuilt_live_audio_room
1
Copied!

Import the SDK

Now in your Dart code, import the Live Audio Room Kit SDK.

Untitled
import 'package:zego_uikit_prebuilt_live_audio_room/zego_uikit_prebuilt_live_audio_room.dart';
1
Copied!

Using the Live Audio Room Kit

  • Specify the userID and userName for connecting the Live Audio Room Kit service.
  • Create a roomID that represents the live audio room you want to create.
Note
  • userID, userName, and roomID can only contain numbers, letters, and underlines (_).
  • Using the same roomID will enter the same live audio room.
Warning

With the same roomID, only one user can enter the live audio room as host. Other users need to enter the live audio room as the audience.

Untitled
class LivePage extends StatelessWidget {
  final String roomID;
  final bool isHost;

  const LivePage({Key? key, required this.roomID, this.isHost = false}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return SafeArea(
      child: ZegoUIKitPrebuiltLiveAudioRoom(
        appID: yourAppID, // Fill in the appID that you get from ZEGOCLOUD Admin Console.
        appSign: yourAppSign, // Fill in the appSign that you get from ZEGOCLOUD Admin Console.
        userID: 'user_id',
        userName: 'user_name',
        roomID: roomID,
        config: isHost
            ? ZegoUIKitPrebuiltLiveAudioRoomConfig.host()
            : ZegoUIKitPrebuiltLiveAudioRoomConfig.audience(),
      ),
    );
  }
}
1
Copied!

Then, you can create a live audio room. And the audience can join the live audio room by entering the roomID.

Config your project

Run & Test

Now you can simply click the Run or Debug button to run and test your App on the device.

Custom prebuilt UI

Resources

Previous

Overview

Next

Overview