TUILiveKit

English | 简体中文

TUILiveKit is a real-time interactive live streaming component that includes features such as host streaming, audience viewing, bullet chat, likes and gifts, audience management, and co-hosting management. It is suitable for live streaming scenarios such as entertainment, e-commerce, and education. By integrating TUILiveKit, you can add all the above live streaming features to your application in just three steps and launch your business quickly within 30 minutes.

Environment Preparation

Flutter

  • Flutter 3.27.4 or higher.
  • Dart 3.6.2 or higher.

Android

  • Android Studio 3.5 or higher.
  • Android devices with Android 5.0 or higher.

iOS

  • Xcode 15.0 or higher.
  • Ensure your project has a valid developer signature.

Getting Started

Add Dependencies

Follow the documentation to add the tencent_live_uikit package as a dependency in your pubspec.yaml file (Installation Guide).

Activate Services

To use the interactive live streaming features, ensure that you have activated the service.

  1. Activate the Service
    You can activate the service and obtain your SDKAppID and SDKSecretKey in the Console.

  2. Configure SDKAppID and SDKSecretKey
    Open the example/lib/debug/generate_test_user_sig.dart file and fill in the obtained SDKAppID and SDKSecretKey:

    static int sdkAppId = 0; // Replace with your SDKAppID
    static String secretKey = ''; // Replace with your SDKSecretKey
    

Example Experience

After configuring the SDKAppID and SDKSecretKey, you can directly run the example project to experience the features.

For a better experience, it is recommended to prepare two mobile devices: one for the host to start the live stream and the other for the audience to watch or listen.

Quick Integration

Configure Routing and Internationalization

return MaterialApp(
   navigatorObservers: TUILiveKitNavigatorObserver.instance,
   localizationsDelegates: [
      ...LiveKitLocalizations.localizationsDelegates,
      ...BarrageLocalizations.localizationsDelegates,
      ...GiftLocalizations.localizationsDelegates,
   ],
   supportedLocales: [
      ...LiveKitLocalizations.supportedLocales,
      ...BarrageLocalizations.supportedLocales,
      ...GiftLocalizations.supportedLocales
   ],
   //...
);

Login

Before using the interactive live streaming features, ensure that you have completed the initialization by executing the following login code.

import 'package:tencent_live_uikit/tencent_live_uikit.dart';

final int sdkAppId = 'replace with your sdkAppId';
final String userId = 'replace with your userId';
final String userSig = 'replace with your userSig';

await TUILogin.instance.login(
   sdkAppId,
   userId,
   userSig,
   TUICallback(onSuccess: () async {
      debugPrint("TUILogin login success");
   }, onError: (code, message) {
      debugPrint("TUILogin login fail, {code:$code, message:$message}");
   }));
  • sdkAppId: You can obtain it from the Console after activating the service.
  • userSig: Generate it using the UserSig Guide.

Host Streaming Page Integration

You can use the Navigator.push method to navigate to the host streaming page.

For video streaming, refer to the following code:

import 'package:tencent_live_uikit/tencent_live_uikit.dart';

Navigator.push(context, MaterialPageRoute(
   builder: (context) {
      final String userId = 'replace with your userId';
      final String roomId = LiveIdentityGenerator.instance.generateId(userId, RoomType.live);
      return TUILiveRoomAnchorWidget(roomId: roomId);
   }));

For audio chat room streaming, refer to the following code:

import 'package:tencent_live_uikit/tencent_live_uikit.dart';

Navigator.push(context, MaterialPageRoute(
   builder: (context) {
      final String userId = 'replace with your userId';
      final String roomId = LiveIdentityGenerator.instance.generateId(userId, RoomType.live);
      final params = RoomParams();
      params.maxSeatCount = 10; // Set the number of seats (maximum value depends on your subscription plan).
      return TUIVoiceRoomWidget(
                              roomId: roomId,
                              behavior: RoomBehavior.prepareCreate,
                              params: params);
   }));

The maximum value of maxSeatCount can be found in the Multi-guests in Package Details.

Live Room List Page Integration

The live room list page displays ongoing video live streams and audio chat rooms. You can click on any room to join as an audience member and watch or listen.
You can use the Navigator.push method to navigate to the live room list page.
Reference code:

Navigator.push(context, MaterialPageRoute(
   builder: (context) {
      return Scaffold(
         body: SafeArea(child: LiveListWidget()));
   }));

You can also directly add the live room list page as a child widget in your existing page.
Reference code:

// Single child widget, using Container as an example
Container(
   child: LiveListWidget()
)

// Multiple child widget, using Column as an example
Column(
   children: [LiveListWidget()]
)

Feedback and Support

If you have any questions or feedback, please contact us at: info_rtc@tencent.com.

Libraries

common/boot/boot
common/boot/index
common/constants/constants
common/constants/index
common/error/error_handler
common/error/index
common/index
common/language/gen/livekit_localizations
common/language/gen/livekit_localizations_en
common/language/gen/livekit_localizations_zh
common/language/index
common/logger/index
common/logger/logger
common/platform/index
common/platform/rtc_live_tuikit_method_channel
common/platform/rtc_live_tuikit_platform_interface
common/reporter/index
common/reporter/live_data_reporter
common/resources/colors
common/resources/images
common/resources/index
common/screen/index
common/screen/screen_adapter
common/widget/action_sheet
common/widget/alert
common/widget/debounce_gesture_recognizer
common/widget/global
common/widget/index
common/widget/toast
component/audience_list/audience_list_widget
component/audience_list/index
component/audience_list/manager/audience_list_manager
component/audience_list/manager/audience_list_observer
component/audience_list/panel/audience_list_panel_widget
component/audience_list/state/audience_list_state
component/audio_effect/audio_effect_panel_widget
component/audio_effect/index
component/audio_effect/manager/audio_effect_manager
component/audio_effect/state/audio_effect_state
component/audio_effect/state/audio_effect_state_factory
component/audio_effect/widget/change_voice_widget
component/audio_effect/widget/reverb_widget
component/beauty/api/beauty_service
component/beauty/beauty_panel_widget
component/beauty/index
component/beauty/manager/beauty_manager
component/beauty/state/beauty_state
component/beauty/state/beautyStateFactory
component/gift_access/gift_barrage_item_builder
component/gift_access/index
component/index
component/live_info/index
component/live_info/live_info_widget
component/live_info/manager/live_info_engine_observer
component/live_info/manager/live_info_im_observer
component/live_info/manager/live_info_manager
component/live_info/panel/live_info_detail_widget
component/live_info/state/follow_define
component/live_info/state/live_info_state
live_identity_generator
live_navigator_observer
live_stream/api/index
live_stream/api/live_stream_service
live_stream/features/anchor_broadcast/anchor_broadcast_widget
live_stream/features/anchor_broadcast/battle/battle_count_down_backgroud_widget
live_stream/features/anchor_broadcast/battle/battle_count_down_widget
live_stream/features/anchor_broadcast/co_guest/anchor_co_guest_float_widget
live_stream/features/anchor_broadcast/co_guest/co_guest_management_panel_widget
live_stream/features/anchor_broadcast/co_host/co_host_management_panel_widget
live_stream/features/anchor_broadcast/index
live_stream/features/anchor_broadcast/living_widget/anchor_bottom_menu_widget
live_stream/features/anchor_broadcast/living_widget/anchor_living_widget
live_stream/features/anchor_broadcast/living_widget/index
live_stream/features/anchor_broadcast/living_widget/more_features_panel_widget
live_stream/features/anchor_prepare/anchor_preview_widget
live_stream/features/anchor_prepare/anchor_preview_widget_define
live_stream/features/anchor_prepare/index
live_stream/features/anchor_prepare/widgets/anchor_preview_function_widget
live_stream/features/anchor_prepare/widgets/anchor_preview_info_edit_widget
live_stream/features/anchor_prepare/widgets/cover_select_panel_widget
live_stream/features/audience/audience_widget
live_stream/features/audience/index
live_stream/features/audience/living_widget/audience_bottom_menu_widget
live_stream/features/audience/living_widget/audience_living_widget
live_stream/features/audience/panel/co_guest_type_select_panel_widget
live_stream/features/audience/panel/co_guest_video_setting_panel_widget
live_stream/features/decorations/battle/battle_info_widget
live_stream/features/decorations/battle/battle_member_info_widget
live_stream/features/decorations/battle/index
live_stream/features/decorations/battle/single_battle_score_widget
live_stream/features/decorations/co_guest/co_guest_waiting_agree_widget
live_stream/features/decorations/co_guest/co_guest_widget
live_stream/features/decorations/co_guest/index
live_stream/features/decorations/co_host/co_host_widget
live_stream/features/decorations/co_host/index
live_stream/features/decorations/index
live_stream/features/end_statistics/anchor_end_statistics_widget
live_stream/features/end_statistics/audience_end_statistics_widget
live_stream/features/end_statistics/end_statistics_widget_define
live_stream/features/end_statistics/index
live_stream/features/index
live_stream/features/live_list/index
live_stream/features/live_list/live_list_widget
live_stream/features/live_list/service/live_list_service
live_stream/features/live_list/store/live_list_state
live_stream/features/live_room_anchor_widget
live_stream/features/live_room_audience_widget
live_stream/live_define
live_stream/manager/live_stream_manager
live_stream/manager/module/battle_manager
live_stream/manager/module/co_guest_manager
live_stream/manager/module/co_host_manager
live_stream/manager/module/index
live_stream/manager/module/media_manager
live_stream/manager/module/room_manager
live_stream/manager/module/user_manager
live_stream/manager/observer/battle_manager_observer
live_stream/manager/observer/index
live_stream/manager/observer/live_layout_observer
live_stream/manager/observer/live_list_observer
live_stream/manager/observer/live_stream_observer
live_stream/manager/observer/room_engine_observer
live_stream/state/battle_state
live_stream/state/co_guest_state
live_stream/state/co_host_state
live_stream/state/index
live_stream/state/media_state
live_stream/state/room_state
live_stream/state/user_state
tencent_live_uikit
voice_room/api/index
voice_room/api/voice_room_service
voice_room/index
voice_room/manager/index
voice_room/manager/module/index
voice_room/manager/module/media_manager
voice_room/manager/module/room_manager
voice_room/manager/module/seat_manager
voice_room/manager/module/user_manager
voice_room/manager/observer/im_observer
voice_room/manager/observer/index
voice_room/manager/observer/live_list_observer
voice_room/manager/observer/room_engine_observer
voice_room/manager/voice_room_manager
voice_room/state/index
voice_room/state/media_state
voice_room/state/room_state
voice_room/state/seat_state
voice_room/state/user_state
voice_room/state/voice_define
voice_room/voice_room_widget
voice_room/widget/component/dashboard/anchor_dashboard_widget
voice_room/widget/component/dashboard/audience_dashboard_widget
voice_room/widget/component/dashboard/index
voice_room/widget/component/index
voice_room/widget/index
voice_room/widget/panel/index
voice_room/widget/panel/live_background_select_widget
voice_room/widget/panel/live_cover_select_panel_widget
voice_room/widget/panel/seat_invitation_panel_widget
voice_room/widget/panel/seat_management_panel_widget
voice_room/widget/panel/seat_mode_setting_widget
voice_room/widget/panel/settings_panel_widget
voice_room/widget/panel/user_management_panel_widget
voice_room/widget/prepare/index
voice_room/widget/prepare/live_prepare_function_widget
voice_room/widget/prepare/live_prepare_info_edit_widget
voice_room/widget/prepare/seat_preview_widget
voice_room/widget/root/bottom_menu_widget
voice_room/widget/root/index
voice_room/widget/root/top_widget
voice_room/widget/voice_room_prepare_widget
voice_room/widget/voice_room_root_widget