Local User - Events
You can subscribe to various events on the local user by implementing
DyteSelfEventsListener and passing the object to
meeting.addSelfEventsListener(dyteSelfEventsListener).
Video update
Triggered when the user starts / stops the video using enableVideo or
disableVideo
extension MeetingViewModel: DyteSelfEventsListener {
    func onVideoUpdate(isEnabled: Bool) {
      if (videoEnabled) {
        // video is enabled, and other participants in room can see local user
      } else {
        // video is disabled, and other participants in room can not see local user.
      }
    }
}
Audio update
Triggered when the user starts / stops the audio using enableAudio or
disableAudio
extension MeetingViewModel: DyteSelfEventsListener {
    func onAudioUpdate(isEnabled: Bool) {
      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.
      }
    }
}
Room disconnected update
Triggered when the user is disconnected due to media/network errors
extension MeetingViewModel: DyteSelfEventsListener {
    func onMeetingRoomDisconnected() {
      //disconnected
    }
}
Proximity changed
Triggered when there is any change in proximity. Meaning if device is near ear piece which triggers display on/off.
extension MeetingViewModel: DyteSelfEventsListener {
    func onProximityChanged(isNear: Bool) {
      // isNear
      // if true, display should be turned off, as user might be speaking through earpiece
      // if false, display should be turned on, as user might be looking at display and listening through speaker/earphones.
    }
}
Waitlist status
For meetings whose waiting room is enabled:
To get status of localUser in waiting room we can use
let waitListStatus = meeting.localUser.waitListStatus
Developers can listen to those changes in onWaitListStatusUpdate() callbacks
extension MeetingViewModel: DyteSelfEventsListener {
    func onWaitListStatusUpdate(waitListStatus: WaitListStatus) {
    }
}
Webinar Request
The onWebinarPresentRequestReceived() callback is triggered when the local user receives a request to join the webinar, while the onStoppedPresenting() callback is triggered when the local user ends their presentation.
extension MeetingViewModel: DyteSelfEventsListener {
    func onWebinarPresentRequestReceived() {
        // Display an alert to the user here, allowing them to accept or reject the request.
    }
    func onStoppedPresenting() {
        //Display an alert to the user indicating that they are no longer presenting.
    }
}
LocalUser removed
Whenever local user is removed from the meeting, onRemovedFromMeeting() callback is triggered.
extension MeetingViewModel: DyteSelfEventsListener {
    func onRemovedFromMeeting() {
      // Display an alert here that user no longer in the meeting.
    }
}
Listen to Broadcast message within the room
Get broadcast messages within the room using onRoomMessage callback.
Parameters:
type: A client-specific type to differentiate between custom messages like "emoji" or "greetings"
payload: A dictionary containing the message payload, where keys are strings and values are of any type.
extension MeetingViewModel: DyteSelfEventsListener {
  func onRoomMessage(type: String, payload: [String : Any]) {
    // triggered when a message is sent within the room.
  }