Live UIKit iOS v1
Live UIKit iOS
Live UIKit
iOS
Version 1

Host a live event

Copy link

You can use the LiveEventHostViewController class to build a view for users to host a live event. A LiveEventHostViewController 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.

Note: Before starting the live event, you can test your media stream and devices by yourself by using liveEvent.startStreaming. Participants will be able to receive your media stream when you start the live event by calling the liveEvent.StartLiveEvent() method.

List of features

Copy link

The following table lists the features included in LiveEventHostViewController. The LiveEventHostViewController class includes all the features of the LiveEventViewController class and can access all of its methods and properties.

FeatureDescription

Enter a live event as a host

Allows a user who had been selected as one of the users who can be a host to enter a live event as a host.

Set up a live event

Allows the host to choose the audio and video settings for the live event.

Manage live event settings

Allows the host to turn off video and/or audio, hide the chat, and change the live event title and cover image.

Use the chat and moderate chat activity

Allows the host to send messages to the chat to talk to participants, and freeze the chat to prohibit inappropriate activity as needed.

Change live event status

Allows the host to update the live event status. A host can start the event, exit the live event without ending the event, and end the live event. A host may opt to view a summary of the live event metrics after ending the event.


Initialize

Copy link

To launch LiveEventHostViewController, one of the users selected to be host must enter the live event as a host.

A user can click a live event on LiveEventListViewController to enter as a host and LiveEventHostViewController is automatically displayed. Entering as a host will prompt the user to select audio and video devices before entering the live event.

Alternatively, you can use the following code to manually display LiveEventHostViewController.

liveEvent.enterAsHost(mediaOptions: .init()) { error in
    guard error == nil, liveEvent.openChannel != nil else { return }

    let hostVC = HostViewController(openChannel: liveEvent.openChannel!, liveEvent: liveEvent)
    self.present(hostVC)
}

Customization

Copy link

You can customize properties in theLiveEventHostViewController class for your own needs. The LiveEventHostViewController class includes multiple user interfaces for managing the live event and displaying live event information.

UI Customization

Copy link

The following table lists methods you can use to customize the view controller.

Method nameDescription

showDuration

Determines whether to display the duration of a live event in the view. If set to true, displays the duration of the live event. (Default: true)

showLiveEventStatus

Determines whether to display the live event status in the view. If set to true, displays the live event status. (Default: true)

showParticipantCount

Determines whether to display the number of participants in real time. If set to true, displays the number of views. (Default: true)

allowHostExitWithoutEnding

Determines whether the host can exit the live event without ending the event. If set to true, the host can exit without ending the event. (Default: true)

showLiveEventSummaryView

Determines whether to show a summary of the live event after the event has ended. If set to true, displays a summary of the live event. (Default: true)

endedLiveEventViewDisplayTime

The period of time to display the message that the live event has ended.

onEndLiveEventClicked

Called when a user clicks the exit button. By default, a host is given a choice to end or leave without ending the live event while a participant is prompted to leave the live event.

String set

Copy link

The following table lists the properties of SBUStringSet you can customize to modify the live event's host view.

CategoryKeyString

StreamSetup

headerButton

Enter

StreamSetup

headerTitle

Live event setup

StreamSetup

readyDescription

When you enter, the live event will be open to participants and they can also enter to chat only.

LiveEvent

disconnectedAlertTitle

Disconnected temporarily

LiveEvent

disconnectedAlertDescription

Try entering the live event again.

HostView

duration

Duration

HostView

liveEventEndDialogTitle

End live event?

HostView

liveEventEndDialogDescription

N/A

HostView

liveEventEndDialogOptionEnd

End live event

HostView

liveEventEndDialogOptionExit

Exit without ending

HostView

peakConcurrentParticipantCount

Peak concurrent participants

HostView

startLiveEventHeaderButton

Start

HostView

totalParticipantsCount

Total participants

LiveEventInformation

changeCoverImage

Change cover image

LiveEventInformation

changeEventTitle

Change event title

LiveEventInformation

changeEventTitlePlaceholder

Enter new title

LiveEventInformation

changeTitle

Change title

LiveEventInformation

createdAt

Created on

LiveEventInformation

createdBy

Created by

LiveEventInformation

editEvent

Edit this event?

LiveEventInformation

host

Host

LiveEventInformation

liveEventId

Live event ID

LiveEventInformation

participants

Participants

LiveEventInformation

participantListHeaderTitle

N/A

LiveEventInformation

startedAt

Started on

LiveEventInformation

startedBy

Started by

LiveEventInformation

title

Live event information

LiveEventInformation

usersForHost

Host users

LiveEventInformation

usersForHostDescription

Any one of the users in the list below can act as a host for the live event. If the current host leaves the event, another user can act as the host.

Icon set

Copy link

The following table lists icons in SBUIconSet that you can customize to modify the live event's host view.

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.