fresh-painting-88343
08/16/2025, 6:03 PMtall-airline-16756
08/16/2025, 6:03 PMtall-airline-16756
08/16/2025, 6:03 PMRoomOutputOptions
to turn off the audio while keeping the transcription going.
Here’s a simple way to do it:
1. Set audio_enabled=False
in RoomOutputOptions
to stop the AI agent from playing audio.
2. Make sure transcription_enabled=True
so you keep receiving those handy text transcriptions.
Check out this example code:
from livekit.agents import RoomOutputOptions
output_options = RoomOutputOptions(
audio_enabled=False,
transcription_enabled=True
)
await session.start(
agent=MyAgent(),
room=ctx.room,
room_output_options=output_options
)
With this setup, you’ll get all the text transcriptions without any audio—pretty neat, right?fresh-painting-88343
08/16/2025, 6:07 PMtall-airline-16756
08/16/2025, 6:08 PMRoomOutputOptions
while your session is already running, you’ve got two ways to do it depending on what exactly you want to change:
1. Dynamic Audio Control: You can easily toggle the audio output on or off without restarting the session. Just use these handy methods:
# Turn audio output on
session.output.set_audio_enabled(True)
# Turn audio output off
session.output.set_audio_enabled(False)
2. Restarting the Session: For changes that can’t be done on the fly (like turning transcription on or off), you’ll need to update the RoomOutputOptions
and then restart the session. Here’s how:
# Create new RoomOutputOptions with your updates
new_output_options = RoomOutputOptions(
transcription_enabled=True,
audio_enabled=False # For example, turning audio off
)
# Restart the session using the new options
await session.start(
agent=agent,
room=room,
room_output_options=new_output_options
)
So, toggling audio is quick and easy, but for other tweaks, a session restart is needed. If anything’s unclear or you want to chat more about it, just let me know—I’m here to help!