Live Android v1
Live Android
Live
Android
Home
/
Live
/
Android
/
UIKit

Host a live event

You can use the LiveEventHostActivity class to build a view for users to host a live event. A LiveEventHostActivity instance can be used to display the host’s media stream, multiple options to configure the live event, and a chat where the host and participants can send messages.

Users included in userIdsForHost can enter the live event one at a time to host. Once they have entered, they can start the live event as a host and stream video and audio during the live event.


Component

OverlayView

The overlay view component shows the buttons that control live event media. you will be able to perform Start, End, Exit, Flip camera and Video/Audio control. In ready status, you can start the live event once the middle view of the top section is clicked. Otherwise, the duration of the live event is shown.

Live event view

The live event view component shows a livestreaming that the host is broadcasting at the moment.


Usage

Sendbird Live UIKit for Android provides both activity and fragment to create a live event host screen. You can choose which one to build your app with and you may solely use activity instead of fragment if you wish to. You can build a live event host screen through LiveEventHostActivity, which uses LiveUIKitFragmentFactory to create views.

Start an activity

You can start an activity by using intent to move from one activity to LiveEventHostActivity as shown below:

val intent = LiveEventHostActivity.newIntent(context, liveEventId);
startActivity(intent);

Create a fragment

LiveEventHostActivity allows you to create a basic LiveEventHostFragment through LiveUIKitFragmentFactory and LiveEventHostFragment.Builder. LiveUIKitFragmentFactory has a set of methods that build each fragment, whereas the builder class provides APIs to customize the UI of the data and event handlers used in LiveEventHostFragment.

val fragment = LiveEventHostFragment.Builder(liveEventId).build();

Customization

In the live event host key function, you can customize LiveEventHostFragment to change different aspects of the screen. The LiveEventHostFragment.Builder class allows you to create and customize the basic LiveEventHostFragment that Live UIKit provides but you can only change its own APIs, such as setting a layout. If you wish to customize the fragment beyond using the APIs provided in the builder, you must inherit new customization methods.

The following table shows the main classes used in LiveEventHostFragment to display and customize the live event host screen.

FragmentStyle

LiveEventHostFragment

Widget.SendbirdLive.LiveEventOverlayView

Widget.SendbirdLive.SetupItemView

Widget.SendbirdLive.LiveEventView

Widget.SendbirdLive.LiveEventEmptyView

String resource

The following table lists some of the text strings that you can customize to modify the host live event view. To see a full list, see String resource.

<resources>
    <!-- Live event host fragment   -->
    <string name="sb_live_event_end_dialog_option_cancel">Cancel</string>
    <string name="sb_live_live_event_end_dialog_option_end">End live event</string>
    <string name="sb_live_live_event_end_dialog_option_exit">Exit without ending</string>
    <string name="sb_live_live_event_end_dialog_title">End live event?</string>
    <string name="sb_live_start_live_event_header_button">Start</string>

    <!-- Live event setup fragment  -->
    <string name="sb_live_audio_device">Audio device</string>
    <string name="sb_live_camera_device">Camera</string>
    <string name="sb_live_camera_device_back">Back</string>
    <string name="sb_live_camera_device_external">External</string>
    <string name="sb_live_camera_device_front">Front</string>
    <string name="sb_live_live_event_setup_header_title">Live event setup</string>
    <string name="sb_live_live_event_setup_right_button">Enter</string>
    <string name="sb_live_live_event_setup_ready_description">When you enter, the live event will be open to participants and they can also enter to chat only.</string>
</resources>

Icon resource

The following table lists some of the icons that you can customize to modify the host live event view. To see a full list, see Icon resource.

IconImageDescription

ICON_CAMERA_SWITCH

Switches between front and rear cameras.

ICON_AUDIO_ON

Indicates that audio device is turned on.

ICON_AUDIO_OFF

Indicates that audio device is turned off.

ICON_VIDEO_ON

Indicates that a video device is turned on.

ICON_VIDEO_OFF

Indicates that a video device is turned off.