leave

fun leave()

Leaves the meeting, disconnecting the local participant.

After leaving, the local participant will receive onMeetingLeft and remote participants will receive onParticipantLeft.

Available once the meeting reaches CONNECTED and, unlike the other meeting actions, also while it is RECONNECTING — so an app can always get out of a live session. Called after the meeting is connected but before the join has completed — for example while a waiting-room entry request is still pending — it cancels the join: the connection is dropped and onMeetingLeft still fires so the app's own leave flow completes.

In any other state it does nothing and reports through onError instead. Before the meeting is connected — join never called, still CONNECTING, or the join FAILED — the code is 3001 (ERROR_ACTION_PERFORMED_BEFORE_MEETING_JOINED); calling it again after the meeting has already left gives 3016 (ERROR_ALREADY_IN_REQUESTED_STATE).

Events:

  • onStreamDisabled — emitted on the local participant for each active stream (mic, webcam, screen share)
  • onPresenterChanged — emitted with null if the local participant was the active presenter
  • onMeetingLeft — emitted on the local participant when the meeting is left
  • onParticipantLeft — emitted on remote participants when a participant leaves

Code Example:


meeting.leave()