Hi how to get participant identity
# ask-ai
f
Hi how to get participant identity
t
Thanks for reaching out, Vishalli. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
f
ok
t
I'm happy to help you access a participant's identity! You can use the
identity
property or method on participant objects in all LiveKit SDKs. Here are some examples across different SDKs to guide you: • JavaScript/TypeScript:
Copy code
// Local participant
const localIdentity = room.localParticipant.identity;

// Remote participants
room.remoteParticipants.forEach((participant) => {
  console.log(participant.identity);
});
• Swift (iOS):
Copy code
// Local participant
let localIdentity = room.localParticipant.identity

// Remote participants
for participant in room.remoteParticipants.values {
  print(participant.identity)
}
• Flutter/Dart:
Copy code
// Access participant identity
String participantIdentity = participant.identity;
• Unity:
Copy code
// Access participant identity
string participantIdentity = participant.Identity;
• Rust:
Copy code
// Access participant identity
let identity = participant.identity();
If you have any questions or need help with a particular SDK, please feel free to ask—I’m here to support you! Sources: lib/src/context/participant_context.dart | Runtime/Scripts/Room/Participant/Participant.cs | livekit/src/room/mod.rs | Rooms, participants, and tracks | LiveKit Docs | packages/livekit-rtc/src/room.ts
f
i want in python, and what is local and what is remote participant
t
In the LiveKit Python SDK, you can easily access participant identities like this: • Local Participant:
Copy code
# Access the local participant's identity
local_identity = room.local_participant.identity
• Remote Participants:
Copy code
# Iterate through all remote participants
for identity, participant in room.remote_participants.items():
    print(f"Participant identity: {identity}")
    # Note: identity and participant.identity are the same
    print(f"Same as: {participant.identity}")
Definitions: • Local Participant: This is the participant representing you, the current user connected to the room. • Remote Participants: These are all the other participants in the room, excluding yourself. If you have any questions or want me to walk you through this further, just let me know—I’m here to help! Sources: livekit-protocol/livekit/protocol/models.pyi | ivr-nagivator/README.mdoc | Rooms, participants, and tracks | LiveKit Docs