future-stone-69754
07/11/2025, 5:31 AMtall-airline-16756
07/11/2025, 5:31 AMtall-airline-16756
07/11/2025, 5:33 AMmetadata
string field (usually JSON). You can set or update this using SDK methods such as await localParticipant.setMetadata(metadata)
in JavaScript. This is ideal for passing information like user profiles, roles, or interaction states. You need the canUpdateOwnMetadata
permission to update this field.
• Participant Attributes: Attributes are key-value string pairs, allowing you to update specific information independently, e.g., await localParticipant.setAttributes(attributes)
.
• Room Metadata: The room also has a metadata field, which is settable only via server APIs during creation or with admin privileges. This can be used for application-scoped settings such as livestream configuration or global features for all participants.
Common use cases include user profiles, hand-raising features, SIP metadata, and application-level room configuration. Metadata and attributes are visible to all participants and synchronize automatically, but are not intended for very frequent updates. For more details or examples in a specific programming language or use case, let me know what you’d like to see.
References available upon request.
Sources: Room metadata | LiveKit Docs | Job lifecycle | LiveKit Docs | src/room/participant/LocalParticipant.ts | SIP dispatch rule | LiveKit Docs | Runtime/Scripts/Participant.cs | livekit-rtc/livekit/rtc/participant.py | lib/src/participant/local.dart | Shared/Types/RoomMetadata.swift | sample-livestream/src/main/java/io/livekit/android/sample/livestream/room/s... | Participant attributes and metadata | LiveKit Docsfuture-stone-69754
07/11/2025, 6:12 AMtall-airline-16756
07/11/2025, 6:13 AMroom_metadata = json.loads(ctx.room.metadata)
Think of this like translating the room's secret notes from a JSON string into a Python dictionary—super handy for getting the info you need! Here are some helpful tips to keep in mind:
• Room metadata lives in ctx.room.metadata
.
• Use json.loads()
to decode that string into something you can work with.
• Pro tip: Always double-check that ctx.room.metadata
isn't empty, and have a backup plan for any JSON curveballs.
Bonus: If you want to stay in the loop about metadata changes, you can hook into the room_metadata_changed
event—perfect for staying up-to-date in real-time.
Need a more detailed walkthrough or want to see some error handling magic? Just give me a shout!
Sources: Job lifecycle | LiveKit Docs | agent/game_host.py | livekit-protocol/livekit/protocol/room.pyi | Room metadata | LiveKit Docs