Skip to main content
Version: 4.x.x

Remove Participant - iOS

This feature in a room allows the room host or organizer to remove a participant from the room. This can be helpful in situations where a participant is causing a disturbance, is behaving inappropriately, or is not following room guidelines.

VideoSDK provides three ways to remove a participant from the room.

  1. Using SDK
  2. Using VideoSDK Dashboard
  3. Using Rest API

1. Using SDK​

remove()​

Remove participant allows removing participant while session is on-going. This can be helpful when moderation in a particular room is required.

To remove a participant, call remove() on their Participant object. It is async throws, so call it with try await inside a Task. It throws a VideoSDKError if the call fails, for example ERROR_ACTION_PERFORMED_BEFORE_ROOM_JOINED when you call it before joining the room.

extension RoomViewController {
//Button when tapped will remove the participant with given participantID
@IBAction func removeParticipant(_ sender: Any) {
let participantID = "ABCD"

guard let participant = room?.participants[participantID] else {
return
}
Task {
do {
try await participant.remove()
} catch {
print("Could not remove the participant: \(error)")
}
}
}
}

Events associated with remove​

Following callbacks are received when a participant is removed from the room.

2. Using VideoSDK Dashboard​

  • You can go to the session page on VideoSDK Dashboard and select the room you want to remove a participant from.
  • And then from the participants list you can remove any participant you want.

3. Using Rest API​

  • You can also remove the particular participant from the room using the REST API.
  • To use this method, you should have the sessionId of the room and participantId of the participant who is supposed to be removed.

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