Local User - Events
You can subscribe to various local user events:
- To subscribe, pass the instance of
LocalUserListener
class created above toaddSelfEventsListener()
method ofdyteClient
instance as follows:
dyteClient.addSelfEventsListener(LocalUserListener());
- Implement
DyteSelfEventsListener
to a class sayLocalUserListener
, and listen to event fromDyteSelfEventsListener
by overriding them. This class can be user to manage your state in the application.
class LocalUserListener implements DyteSelfEventsListener {
...
void onAudioDevicesUpdated() {
/// code to handle onAudioDevicesUpdated() event
}
...
}
Video update
Triggered when the user starts / stops the video using enableVideo()
/
disableVideo()
, or host turns-off the video.
class LocalUserListener implements DyteSelfEventsListener {
...
void onVideoUpdate(bool videoEnabled) {
if(isVideoEnabled){
// Video is enabled, other users can see the video.
} else {
// Video is disabled, others users can't see the video.
}
// or alternatively you can pass the bool through state as demonstrated in example app.
}
...
}
Audio update
Triggered when the user starts / stops the audio using enableAudio()
/
disableAudio()
, or host mutes the audio.
class LocalUserListener implements DyteSelfEventsListener {
...
void onAudioUpdate(bool audioEnabled) {
if (audioEnabled) {
// audio is enabled, and other participants in room can hear local user
} else {
// audio is disabled, and other participants in room can not hear local user.
}
// or alternatively you can pass the bool through state as demonstrated in example app.
}
...
}
Room disconnected update
Triggered when the user is disconnected due to media or network errors
class RoomStateNotifier implements DyteMeetingRoomEventsListener {
...
void onMeetingRoomDisconnected() {
// Display a notification to the user indicating that they have been disconnected from the meeting.
}
...
}
Proximity changed
Triggered by any change in proximity, such as when the device is brought near or moved away from an earpiece, which triggers the display to turn on or off.
class LocalUserListener implements DyteSelfEventsListener {
...
void onProximityChanged(bool isNear) {
if (isNear) {
// Display should be turned off, as user might be speaking through ear piece
} else {
// Display should be tunred on, as user might be looking at display and listening through speaker/earphones.
}
}
...
}
Waitlist status
When the waiting room feature is enabled for a meeting, you can use the onWaitListStatusUpdate()
callback function to receive updates on waiting room status changes.
class LocalUserNotifier implements DyteSelfEventsListener {
...
void onWaitListStatusUpdate(DyteWaitListStatus waitListStatus) {
// DyteWaitListStatus is an enum with the following values:
// if `DyteWaitListStatus.none`, user is not on the waitlist
// if `DyteWaitListStatus.waiting`, user is on the waitlist
// if `DyteWaitListStatus.accepted`, user has been accepted in the meeting.
// if `DyteWaitListStatus.rejected`, user has been rejected from the meeting.
}
...
}
Webinar request
When the local user receives a request to join the webinar, the onWebinarPresentRequestReceived()
callback function is triggered. Similarly, when the local user stops presenting during the webinar, the onStoppedPresenting()
callback function is triggered.
void onWebinarPresentRequestReceived() {
// Display an alert to the user, allowing them to accept or reject the request.
}
void onStoppedPresenting() {
// Display an alert to the user indicating that they are no longer presenting.
}
Local user removed
When the local user is removed from the meeting, the onRemovedFromMeeting()
callback is triggered.
void onRemovedFromMeeting() {
// Display an alert to the user indicating that they are no longer in the meeting.
}
Listen to stage status changes
When the stage status of local user is updated, this event is triggered. It contains updated stage status as an argument.
void onStageStatusUpdated(DyteStageStatus status){
// Update your UI as per this stage status.
}