Live iOS v1
Live iOS
Live
iOS
Home
/
Live
/
iOS
/
SDK

Enter a live event

A user can enter any live events that are in ready or ongoing states by calling liveEvent.enter(). When a user enters a live event, the user is counted as a participant.

When a user enters a live event that is ready, they can chat but can't watch the event yet because the host's media stream isn't available to them. When users enter an ongoing live event, they can chat and watch the event when the host starts streaming.

A view object must be provided for users to watch the live event when they enter the event. To watch the media content streamed from the host, set the video view by calling liveEvent.setVideoViewForLiveEvent(view:hostId:).

// Provide a video view to show the live event.
liveEvent.enter { error in
   Guard error == nil else { return } // Failed to join a live event.
   }
   // Show the live event video view controller.
}

For a participant to receive the video view of the host who starts the live event, set the video view using liveEvent.host.hostId. When a different user becomes a host during the live event, subscribe to LiveEventListener.didHostEnter(_:host:) and set the video using host.hostId to view the new host's video.

For the best experience, here are some components included in the SDK that you can use in creating the participant view.