how to get platform in python sdk
# ask-ai
n
how to get platform in python sdk
t
Thanks for reaching out, rohit. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Do you mean the participant's platform/device (e.g., web, iOS, Android), or the participant's kind (e.g.,
ParticipantKind.STANDARD
,
SIP
)? • If you mean participant kind: use
participant.kind
in the Python SDK. • If you mean device/platform (client SDK): have the client set a
platform
attribute or metadata when connecting, then read it from
participant.attributes.get("platform")
on the server. Which of these do you need help implementing? Sources: Job lifecycle | LiveKit docs | livekit/livekit_composite | DeepWiki | Participant attributes and metadata | LiveKit docs | SIP participant | LiveKit docs
n
yeah ios, android, chrome, etc
t
You can’t read device/platform automatically — have the client set a
platform
attribute or metadata when it connects, then read that attribute from the participant in the Python SDK. 1. Client: set platform when connecting (example concepts) • Web (Chrome): set metadata or participant attribute to
"platform":"chrome"
before/when joining. • iOS / Android: set
"platform":"ios"
or
"platform":"android"
similarly. 1. Server (Python): read the attribute from the Participant
Copy code
# assuming you have a participant object
platform = participant.attributes.get("platform")
print(platform)  # "chrome", "ios", "android", or None
Notes: • The server cannot infer platform automatically. • If you want participants to update their own platform after joining, ensure their token allows
canUpdateOwnMetadata
. • You can also pass platform in the token metadata at connection time if preferred. Would you like example client code for web or mobile to show how to set the attribute?