Live Audio Room Kit
  • iOS
  • Android
  • Flutter : Dart
  • React Native
  • Overview
  • Quick start
  • Customize prebuilt features
    • Overview
    • Set avatar for users
    • Customize the seats
    • Customize the seat-taking logic
    • Customize the background
    • Customize user attributes
    • Set a leave confirmation dialog
    • Modify user interface text
    • Customize the bottom menu bar buttons
    • Customize the text message UI
  • Advanced features
    • Integrate Minigame
    • Minimize audio room window
    • Sharing Media
    • Send virtual gifts
  • API Reference
    • API
    • Event
  • Migration guide
    • Migrating to v3.0
  • Documentation
  • Live Audio Room Kit
  • Customize prebuilt features
  • Customize user attributes

Customize user attributes

Last updated:2023-06-04 16:49

Live Audio Room Kit (ZegoUIKitPrebuiltLiveAudioRoom) supports customizing the user attributes. The user attribute (userInRoomAttributes) is in the format of key-value pairs, which are used to implement customized functions, such as setting the user level and sharing it with in-room participants.

After you customized successfully (or in-room participants complete the customization), you (or in-room participants) will receive a notification through the onUserCountOrPropertyChanged callback, and the user attributes you customized will return in this callback.

  • For a single user, the sum of all Key-Value pairs must be within 100 bytes and a maximum of 20 pairs can be configured.
  • Each Key must be within 8 bytes.
  • Each Value must be within 64 bytes.

Here is the reference code:

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

  final String roomID;
  final bool isHost;

  @override
  Widget build(BuildContext context) {
    return SafeArea(
      child: ZegoUIKitPrebuiltLiveAudioRoom(
        appID: YourSecret.appID,
        appSign: YourSecret.appSign,
        userID: userID,
        userName: 'user_$userID',
        roomID: roomID,

        // Modify your custom configurations here.
        config: isHost
            ? ZegoUIKitPrebuiltLiveAudioRoomConfig.host()
            : ZegoUIKitPrebuiltLiveAudioRoomConfig.audience()
          ..userInRoomAttributes = {
            'key_1': 'value_1',
          },
      ),
    );
  }
}
Page Directory