Participant Events - Android
VideoSDK provides multiple types of events which can be listened to know the about the participants in the meeting.
You can implement all the methods of MeetingEventListener
abstract Class and add the listener to Meeting
class using the addEventListener()
method of Meeting
Class.
Here are the events which specifically relate to the participants.
onParticipantJoined
- This event is triggered when someone joins the meeting and return the
Participant
object as parameter.
onParticipantLeft
- This event is triggered when the someone leaves the meeting.
onWebcamRequested
- This event will be triggered to the participant
B
when any other participantA
requests to enable webcam of participantB
. - On accepting the request, webcam of participant
B
will be enabled.
onMicRequested
- This event will be triggered to the participant
B
when any other participantA
requests to enable mic of participantB
. - On accepting the request, mic of participant
B
will be enabled. - This event can be subscribed from the
useMeeting
hook.
Example
Here is the usage of all the events mentioned in this page.
- Kotlin
- Java
private val meetingEventListener: MeetingEventListener = object : MeetingEventListener() {
override fun onParticipantJoined(participant: Participant) {
Log.d("VideoSDK", participant.displayName + " joined");
}
override fun onParticipantLeft(participant: Participant) {
Log.d("VideoSDK", participant.displayName + " left");
}
override fun onWebcamRequested(participantId: String, listener: WebcamRequestListener) {
// participantId, will be the id of participant who requested to enable mic
// if accept request
listener.accept()
// if reject request
listener.reject()
}
override fun onMicRequested(participantId: String, listener: MicRequestListener) {
// participantId, will be the id of participant who requested to enable mic
// if accept request
listener.accept()
// if reject request
listener.reject()
}
}
override fun onCreate(savedInstanceState: Bundle?) {
//...
// add listener to meeting
meeting!!.addEventListener(meetingEventListener)
}
private final MeetingEventListener meetingEventListener = new MeetingEventListener() {
@Override
public void onParticipantJoined(Participant participant) {
Log.d("VideoSDK", participant.getDisplayName() + " joined");
}
@Override
public void onParticipantLeft(Participant participant) {
Log.d("VideoSDK", participant.getDisplayName() + " left");
}
@Override
public void onWebcamRequested(String participantId, WebcamRequestListener listener) {
// participantId, will be the id of participant who requested to enable webcam
// if accept request
listener.accept();
// if reject request
listener.reject();
}
@Override
public void onMicRequested(String participantId, MicRequestListener listener) {
// participantId, will be the id of participant who requested to enable mic
// if accept request
listener.accept();
// if reject request
listener.reject();
}
}
@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