logo
On this page

Quick start

Integrate the SDK

Add ZegoUIKitPrebuiltLiveStreaming as dependencies

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

Untitled
flutter pub add zego_uikit_prebuilt_live_streaming
1
Copied!

Import the SDK

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

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

Using the Live Streaming Kit

  • Go to ZEGOCLOUD Admin Console, get the appID and appSign of your project.
  • Specify the userID and userName for connecting the Live Streaming Kit service.
  • liveID represents the live streaming you want to start or watch (only supports single-host live streaming for now).
Note
  • userID, userName and liveID can only contain numbers, letters, and underlines (_).
  • Using the same liveID will enter the same live streaming.
Warning

With the same liveID, only one user can enter the live stream as host. Other users need to enter the live stream as the audience.

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

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

  
  Widget build(BuildContext context) {
    return SafeArea(
      child: ZegoUIKitPrebuiltLiveStreaming(
        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',
        liveID: liveID,
        config: isHost
            ? ZegoUIKitPrebuiltLiveStreamingConfig.host()
            : ZegoUIKitPrebuiltLiveStreamingConfig.audience(),
      ),
    );
  }
}
12345678910111213141516171819202122
Copied!

Then, you can start a live stream. And the audience can watch the live stream by entering the liveID.

Config your project

Run & Test

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

Resources