Skip to main content
Version: 0.0.x

Remove Participant - Python

When hosting a meeting, it's essential for the host to have the capability to remove a participant from the meeting. This can be useful in various scenarios where a participant is causing disturbance, behaving inappropriately, or is not following meeting guidelines. This guide focuses on this very aspect of removing a particpant in a meeting from server side.

VideoSDK provides three ways to do so:

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

1. Using SDK

remove()

The remove() method allows for the removal of a participant during an on-going session. This can be helpful when moderation is required in a particular meeting.

MeetingEventHandler

from videosdk import MeetingEventHandler, MeetingConfig, VideoSDK
import asyncio

VIDEOSDK_TOKEN = os.getenv("VIDEOSDK_TOKEN")
MEETING_ID = os.getenv("MEETING_ID")
NAME = os.getenv("NAME")
loop = asyncio.get_event_loop()

class MyMeetingEventListener(MeetingEventHandler):
def __init__(self):
super().__init__()

def on_participant_joined(self, participant):
print("Participant joined")
participant.remove()

def on_participant_left(self, participant):
print("Participant left", participant.display_name)

join the meeting

async def main():
meeting_config = MeetingConfig(
meeting_id=MEETING_ID,
name=NAME,
mic_enabled=True,
webcam_enabled=True,
token=VIDEOSDK_TOKEN,
)
meeting = VideoSDK.init_meeting(**meeting_config)

meeting.add_event_listener(MyMeetingEventListener())

# asynchronously join the meeting
await meeting.async_join()

print("Meeting joined")

if __name__ == "__main__":
loop.run_until_complete(main())
loop.run_forever()

Events associated with remove()

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

2. Using VideoSDK Dashboard

  • For removing a participant using the VideoSDK Dashboard, navigate to the session page on VideoSDK Dashboard. Select the specific meeting, and from the list of participants, choose the participant you wish to remove. Utilize the provided options to remove the selected participant from the meeting.

3. Using Rest API

  • You can also remove a particular participant from the meeting using the REST API.
  • To employ this method, you need the sessionId of the meeting and the participantId of the individual you intend to remove.

API Reference

The API references for all the methods and events utilized in this guide are provided below.

Got a Question? Ask us on discord