fancy-painting-20947
11/03/2025, 7:15 AMtall-airline-16756
11/03/2025, 7:16 AMtall-airline-16756
11/03/2025, 7:17 AMTrackMuted event to detect when a video track is muted or unmuted. Here’s a simple way to do this:
• First, listen for the TrackMuted and TrackUnmuted events in your application. These events let you know when a participant’s track is muted or unmuted.
• When the video track is muted, you can disable the agent’s audio input by using session.input.set_audio_enabled(False).
• And when the video track is unmuted, you might want to re-enable the agent’s audio input with session.input.set_audio_enabled(True).
Here’s a quick example in Python to illustrate this:
async def on_track_muted(track, participant):
if track.kind == 'video':
session.input.set_audio_enabled(False)
async def on_track_unmuted(track, participant):
if track.kind == 'video':
session.input.set_audio_enabled(True)
This way, the agent will only respond when the user’s video is active. If you’d like, I’m here to help with more details or walk you through the implementation—just let me know!
Sources: Camera & microphone | LiveKit Docs | livekit-agents/livekit/agents/voice/agent_session.pyfancy-painting-20947
11/03/2025, 7:18 AMtall-airline-16756
11/03/2025, 7:19 AMfancy-painting-20947
11/03/2025, 7:20 AMtall-airline-16756
11/03/2025, 7:20 AM