Skip to main content

Local User - Events

You can subscribe to various local user events:

  • To subscribe, pass the instance of LocalUserListener class created below to addSelfEventsListener() method of dyteClient instance as follows:
dyteClient.addSelfEventsListener(LocalUserListener());
  • Implement DyteSelfEventsListener to a class say LocalUserListener, and listen to event from DyteSelfEventsListener 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.
}
...
}

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.
}

...
}

Local user removed

When the local user is removed from the meeting, the onRemovedFromMeeting() callback is triggered.


class LocalUserNotifier implements DyteSelfEventsListener {

...


void onRemovedFromMeeting() {
// Display an alert to the user indicating that they are no longer in the meeting.
}

...
}

Screenshare callbacks for local user


class LocalUserNotifier implements DyteSelfEventsListener {

...



void onScreenShareStartFailed(String reason) {
// screenshare failed to start
}


void onScreenShareStarted() {
// screenshare started presenting in the meeting
}


void onScreenShareStopped() {
// screenshared stopped by the local user
}

...
}

Change in audio/video source

Whenever user changes audio/video source using setAudioDevice(DyteAudioDevice) and setVideoDevice(DyteVideoDevice) respectively [ref: here], onAudioDevicesUpdated() and onVideoDevicesChanged() are triggered respectively.


class LocalUserNotifier implements DyteSelfEventsListener {

...


void onAudioDevicesUpdated() {
// triggered on successful execution of `setAudioDevice(DyteAudioDevice)`
}


void onVideoDeviceChanged(DyteVideoDevice videoDevice) {
// triggered on successful execution of `setVideoDevice(DyteVideoDevice)`
}

...

}

Process message within the room

Manage messages within the room using onRoomMessage(String message) callback.


class LocalUserNotifier implements DyteSelfEventsListener {

...


void onRoomMessage(String type, Map<String, dynamic> payload) {
// triggered when a message is sent within the room.
}

...
}