Skip to main content
Version: 2.0.x

Join Live Stream - iOS

Once, the live stream is configured, the next step is to join it. With our iOS SDK, you can choose to manually call the join() method. If you have not initialized the live stream yet, you can follow the guide here.

join()

  • To join the meeting you can call the join() method of Meeting class.
  • This method can be called after the meeting is initialized using VideoSDK class.

Events associated with the join() method

Following events are received when a participant successfully joins the livestream.


func handleJoinStream(){
meeting?.join()
}

extension LiveStreamViewController: MeetingEventListener {

// Event to know meeting is joined
func onMeetingJoined() {
print("You just joined the livestream")
}

// Event to know some other participant joined
func onParticipantJoined(_ participant: Participant) {
print("A new remote participant", \(participant.displayName) + "just joined the livestream")
}
}

leave()

  • To leave the live stream you can call the leave() method which is the part of the useMeeting hook of React SDK.
note

This method can be called only after the live stream is joined successfully.

Events associated with the leave() method

Following callbacks are received when a participant leaves the live stream.


func handleLeaveStream(){
meeting?.leave()
}

extension LiveStreamViewController: MeetingEventListener {
func onMeetingLeft() {

// remove listeners
meeting?.localParticipant.removeEventListener(self)
meeting?.removeEventListener(self)

print("You left the livestream")
}

func onParticipantLeft(_ participant: Participant) {

// remove listener
participant.removeEventListener(self)

print(participant.displayName, "just left the livestream")
}
}
tip

You should call the leave() method on the unmount of your main live stream component so that live stream is left once the view is unmounted.

API Reference

The API references for all the methods and events utilized in this guide are provided below.

Got a Question? Ask us on discord