Meeting Connection Events - Android
VideoSDK provides onMeetingStateChanged
event which will notify you of the current connection state of the meeting.
onMeetingStateChanged
- This event will be triggered when state of meeting changes.
- It will pass
state
as an event callback parameter which will indicate current state of the meeting. - All available states are
CONNECTING
,CONNECTED
,FAILED
,DISCONNECTED
,CLOSING
,CLOSED
. - You can implement this method of the abstract Class
MeetingEventListener
and add the listener toMeeting
class using theaddEventListener()
method ofMeeting
Class.
Example
Here is the usage of the event mentioned in this page.
- Kotlin
- Java
private val meetingEventListener: MeetingEventListener = object : MeetingEventListener() {
override fun onMeetingStateChanged(state: String?) {
when (state) {
"CONNECTING" -> Log.d("onMeetingStateChanged: ", "Meeting is Connecting")
"CONNECTED" -> Log.d("onMeetingStateChanged: ", "Meeting is Connected")
"FAILED" -> Log.d("onMeetingStateChanged: ", "Meeting connection failed")
"DISCONNECTED" -> Log.d("onMeetingStateChanged: ","Meeting connection disconnected abruptly")
"CLOSING" -> Log.d("onMeetingStateChanged: ", "Meeting is closing")
"CLOSED" -> Log.d("onMeetingStateChanged: ", "Meeting connection closed")
}
}
}
override fun onCreate(savedInstanceState: Bundle?) {
//...
// add listener to meeting
meeting!!.addEventListener(meetingEventListener)
}
private final MeetingEventListener meetingEventListener = new MeetingEventListener() {
@Override
public void onMeetingStateChanged(String state) {
switch (state) {
case "CONNECTING":
Log.d("onMeetingStateChanged: ", "Meeting is Connecting");
break;
case "CONNECTED":
Log.d("onMeetingStateChanged: ", "Meeting is Connected");
break;
case "FAILED":
Log.d("onMeetingStateChanged: ", "Meeting connection failed");
break;
case "DISCONNECTED":
Log.d("onMeetingStateChanged: ", "Meeting connection disconnected abruptly");
break;
case "CLOSING":
Log.d("onMeetingStateChanged: ", "Meeting is closing");
break;
case "CLOSED":
Log.d("onMeetingStateChanged: ", "Meeting connection closed");
break;
}
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
//...
// add listener to meeting
meeting.addEventListener(meetingEventListener);
}
API Reference
The API references for all the methods and events utilised in this guide are provided below.
Got a Question? Ask us on discord