Skip to main content
Version: 0.x.x

Join Live Stream - Android

Once, the live stream is configured, the next step is to join it. If you have not initialized the live stream yet, you can follow the guide here.

join()

  • To join the live stream you can call the join() method which is the part of the Meeting class of Android SDK.
  • This method can be called after the live stream is initialized from the VideoSdk class.

Events associated with Join

Following callbacks are received when a participant is successfully joined.

class LiveStreamActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_live_stream);
// initialize the meeting
liveStream = VideoSDK.initMeeting(... )
...

// join meeting
meeting!!.join()

// Add event listener for listening upcoming events of live stream
meeting!!.addEventListener(meetingEventListener)
}

private val meetingEventListener: MeetingEventListener = object : MeetingEventListener(){
//Event to determine if the live stream has been joined
fun onMeetingJoined() {
Log.d("VideoSDK", "onMeetingJoined")
}
/ //Event to determine some other participant has joined
fun onParticipantJoined(participant: Participant) {
Log.d("#VideoSDK", participant.displayName + " joined");
}
}
}

leave()

  • To leave the live stream you can call the leave() method which is the part of the Meeting class of Flutter 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.

private final MeetingEventListener meetingEventListener = new MeetingEventListener() {
//Event to determine if the live stream has been left
override fun onMeetingLeft() {
Log.d("#VideoSDK", "onMeetingleft()")
}

//Event to determine some other participant has left
override fun onParticipantLeft(participant: Participant) {
Log.d("#VideoSDK", participant.displayName + " left");
}
}
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