Hi guys, I found an example of how to switch the ...
# agents
h
Hi guys, I found an example of how to switch the linked participant in the room. However it's written in python: https://github.com/livekit/agents/blob/main/examples/voice_agents/toggle_io.py#L43 I'm currently using Nodejs version, so how can I achieve this goal in Nodejs? I noticed when call session.start(...), it'll create the private RoomIO properties, so I tried 2 approaches and none is working: 1. Manually create a RoomIO like the python version, but it doesn't work like I expect. The agent's still listening to the first participant. 2. Access the AgentSession.roomId like this:
Copy code
// 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"
m
Ran into same issue yesterday, ended up using the python library in the end.
❤️ 1