famous-translator-19267
02/13/2026, 10:55 PMtall-airline-16756
02/13/2026, 10:55 PMtall-airline-16756
02/13/2026, 10:55 PM@session.on to see which tracks your agent (or client) is subscribed to.
Below is a concise explanation and a runnable example showing how to listen for subscription events and inspect subscribed tracks. If you’re using a different language or SDK, tell me which one (Python, JS, or other) and I’ll adapt the example.
Example (Python, LiveKit agent-style):
# Listen for when a remote track is subscribed
@session.on("track_subscribed")
def on_track_subscribed(track: rtc.Track, publication: rtc.RemoteTrackPublication, participant: rtc.RemoteParticipant):
print(f"Subscribed to track: {publication.name} | kind: {track.kind} | from: {participant.identity}")
# Example handling by track kind
if track.kind == rtc.TrackKind.KIND_VIDEO:
# Wrap into a VideoStream if you want to process frames
video_stream = rtc.VideoStream(track)
# e.g., start processing frames in a worker or callback
elif track.kind == rtc.TrackKind.KIND_AUDIO:
audio_stream = rtc.AudioStream(track)
# e.g., read audio buffers, feed STT, etc.
Useful related events
• `track_published`: fired when a participant publishes a track (useful to know availability before subscribing).
• `track_unsubscribed`: fired when a previously subscribed track is removed or unsubscribed.
Quick tips
• The publication object contains metadata such as the track name, sid, and mediaType.
• The participant object gives you the remote participant identity so you can map tracks to users.
• If you need to list all currently subscribed tracks after joining, iterate remote participants’ publications and check which have an active subscribed track.
Follow-up question
• Which SDK/language are you using (Python, JavaScript, mobile)? I can send a tailored example for that environment and show how to enumerate all currently subscribed tracks as well. Sources: How to detect and handle silence during calls | LiveKit