hundreds-caravan-28870
11/19/2025, 1:41 AM// Listen participant metadata changed
const roomIO = (session as any).roomIO as voice.RoomIO;
roomIO.setParticipant(participant.identity);
Then if this participant publish an audio track, I get a log: "RoomEvent.TrackSubscribed: Stream source already set"tall-airline-16756
11/20/2025, 12:40 PMRoomIO class from the LiveKit Agents SDK to manage the linked participant.
• Then, call the setParticipant method to switch to the participant you want by their identity:
import { RoomIO } from '@livekit/agents';
// Assuming you have a RoomIO instance
const roomIO = new RoomIO({
agentSession: yourAgentSession,
room: yourRoom,
// other options...
});
// Switch to a specific participant by identity
roomIO.setParticipant('participant-identity');
// Or unset the current participant
roomIO.unsetParticipant();
This approach will make sure the audio and video streams switch smoothly to the participant you specify. If you happen to see an error like "Stream source already set," it usually means the participant's audio track might be in use elsewhere, so double-check that it’s managed properly. If you need any more help, I’m here for you! Sources: livekit-agents/livekit/agents/voice/room_io/room_io.py | quickstart/src/joinroom.js | packages/livekit-server-sdk/src/RoomServiceClient.ts | Managing participants | LiveKit docs | cmd/lk/room.go