Skip to main content
Version: 0.0.x

Active Speaker Indication - Python

The Active Speaker Indication feature in VideoSDK allows you to identify the participant who is currently the active speaker in a meeting. This feature proves especially valuable in larger meetings or webinars, where numerous participants can make it challenging to identify the active speaker.

Whenever any participant speaks in a meeting, the on_speaker_changed event will trigger, providing the participant ID of the active speaker.

For example, the meeting is running with Alice and Bob. Whenever any of them speaks, on_speaker_changed event will trigger in MeetingEventHandler and return the speaker's participantId.

Event

from videosdk import (
MeetingConfig,
VideoSDK,
MeetingEventHandler,
)
VIDEOSDK_TOKEN = "<VIDEOSDK_TOKEN>"
MEETING_ID = "<MEETING_ID>"
NAME = "<NAME>"
class MyMeetingEventHandler(MeetingEventHandler):
def __init__(self):
super().__init__()

def on_speaker_changed(self, data):
print("speaker changed", data)
def main():
meeting_config = MeetingConfig(
meeting_id=MEETING_ID,
name=NAME,
mic_enabled=False,
webcam_enabled=False,
token=VIDEOSDK_TOKEN,
)
meeting = VideoSDK.init_meeting(**meeting_config)
meeting.add_event_listener(MyMeetingEventHandler())
meeting.join()
if __name__ == "__main__":
main()
loop.run_forever()

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


Was this helpful?