How exactly the code should look like when you wan...
# ask-ai
l
How exactly the code should look like when you want to access the participant object?
t
Thanks for reaching out, Denis. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hey there! If you want to access the participant object in LiveKit, you can use the SDKs available for different platforms. Here are some handy examples to get you started: • JavaScript/TypeScript SDK:
Copy code
room.localParticipant; // This gets you the local participant
room.remoteParticipants.forEach(participant => {
  console.log(participant.identity);
});
• Flutter SDK:
Copy code
final participantContext = ParticipantContext.of(context);
print(participantContext?.identity);
• Swift SDK:
Copy code
let sid = participant.sid
let isSpeaking = participant.isSpeaking
• Rust SDK:
Copy code
let sid = participant.sid();
let is_speaking = participant.is_speaking();
If you're working on the server side, the GetParticipant API is your friend:
Copy code
res, err := roomClient.GetParticipant(context.Background(), &livekit.RoomParticipantIdentity{
    Room:     roomName,
    Identity: identity,
})
Feel free to reach out if you'd like a hand with a specific SDK or if you have any other questions. I'm here to help! Sources: Rooms, participants, and tracks | LiveKit Docs | Managing participants | LiveKit Docs