Skip to main content
Version: 0.0.x

Participant Class Event Handler - Python

Overview

ParticipantEventHandler is a base class for event handlers. Event handlers are used to handle events from the meeting, such as when a participant joins or leaves the meeting, when the active speaker changes, or other various meeting-related events.

Refer to the Example section and modify MyParticipantEventHandler based on your requirements.

Events

The base class ParticipantEventHandler has the following events associated with it:

on_stream_enabled

  • on_stream_enabled is a callback which gets triggered whenever a participant's video, audio or screen share stream is enabled.

  • Parameters:

on_stream_disabled

  • on_stream_disabled is a callback which gets triggered whenever a participant's video, audio or screen share stream is disabled.

  • Parameters:

on_media_status_changed

  • on_media_status_changed is a callback which gets triggered whenever a participant's video, audio is disabled or enabled.

  • Parameters:

    • data: Information about the media status update.
      • kind: stream kind
      • newStatus: new status

on_video_quality_changed

  • on_video_quality_changed is a callback which gets triggered whenever a participant's video quality changes.

  • Parameters:

    • data: Information about the video quality changes.
      • currentQuality: HIGH | MEDIUM | LOW
      • prevQuality: HIGH | MEDIUM | LOW

Example

from videosdk import ParticipantEventHandler

class MyParticipantEventHandler(ParticipantEventHandler):
def __init__(self):
super().__init__()

def on_stream_enabled(self, data):
# Custom logic when a participant joins
print("Participant Stream Enabled")
pass

def on_stream_disabled(self, data):
# Custom logic when a participant leaves
print("Participant Stream Disabled")
pass

# Additional event callbacks as needed

# Pass MyParticipantEventHandler instance to the participant
participant.add_event_listener(MyParticipantEventHandler())

Got a Question? Ask us on discord