Skip to main content
Subclass srtc.ChannelHandler, override the methods you need, and pass it in with Channel.join(token, handler=...). Events you don’t override are ignored.
  • All methods are called on the asyncio event loop thread, so no locking is needed
  • async methods are scheduled as Tasks and don’t block subsequent events
  • Exceptions raised in the methods are logged to the srtc logger and don’t interrupt the SDK

Event list

on_active_speakers, on_connection_quality, and on_layer_switched depend on the channel’s media streaming engine and don’t fire in some deployments. Don’t make your business logic rely on them always arriving.

Ordering and timing

There’s no ordering guarantee between user events and track events. For example, a user’s on_track_added may arrive before their on_user_join. Just handle them idempotently by uid, and don’t assume “join first, publish later”.
  • Users and tracks already in the channel before you joined don’t trigger on_user_join / on_track_added; read ch.users after joining
  • on_audio_frame / on_video_frame for the same track arrive strictly in order
  • on_audio_frame is a high-frequency event, so use a regular function and return as quickly as possible; for time-consuming processing, we recommend consuming with async for over ch.audio_frames() instead

Handling disconnects

Distinguish three cases: