What is the rtc object?
# ask-ai
w
What is the rtc object?
t
Thanks for reaching out, Arthur. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
The term "rtc object" can mean a few different things in LiveKit, like RTC statistics, configuration, or other WebRTC-related features. Could you share a bit more about where you came across this term or the context you're working in? For example, are you dealing with client SDKs, server-side settings, or maybe monitoring tools? I'd love to help you out! Sources: Runtime/Scripts/Proto/Stats.cs | livekit-rtc/livekit/rtc/_proto/__init__.py | Protocol & WebRTC | livekit/livekit_composite | DeepWiki | pkg/rtc/room.go
w
Acutally, what attributes does the participant class have in the rtc module?
t
Hey there! Just wanted to share some info about the
Participant
class in the LiveKit RTC module and its handy attributes: • Identity and Identification: ◦ `sid`: This is the unique ID the server gives to each participant. ◦ `identity`: The identity the client assigns to the participant. ◦ `name`: The display name you see for the participant. • Metadata and Custom Data: ◦ `metadata`: A custom metadata string tied to the participant. ◦ `attributes`: Custom attributes for the participant, provided as a
dict[str, str]
. • Participant Type and Status: ◦ `kind`: What kind of participant it is (like a regular participant, ingress, egress, SIP, or agent). ◦ `disconnect_reason`: If the participant disconnects, this tells you why — or it’s
None
if they’re still connected. • Track Management: ◦ `track_publications`: A dictionary listing the participant’s track publications (this is an abstract property, so subclasses will implement it). There are also some internal attributes like
_info
(which holds participant info) and
_ffi_handle
(the FFI handle for the participant). If you want me to dive deeper into any of these or need examples, just give me a shout! Sources: livekit-rtc/livekit/rtc/_proto/room_pb2.pyi
w
what events are are there for things that happen to participants?
t
LiveKit offers a bunch of helpful events related to participant actions, and these are sent out both at the room level and the participant level. Here’s a quick rundown of the key events you might find useful: • Connection Events: ◦ `ParticipantConnected`: When someone new joins the room. ◦ `ParticipantDisconnected`: When someone leaves the room. • Track-Related Events: ◦ `TrackPublished`: A participant adds a new track to the room. ◦ `TrackUnpublished`: A participant removes a track. ◦ `TrackSubscribed`: You (the local participant) start receiving a track. ◦ `TrackUnsubscribed`: You stop receiving a track you were subscribed to. ◦
TrackMuted
and `TrackUnmuted`: Tracks get muted or unmuted. • Participant State and Metadata Events: ◦ `ParticipantMetadataChanged`: Someone’s metadata gets updated. ◦ `ParticipantAttributesChanged`: Custom attributes for a participant change. ◦ `ParticipantPermissionsChanged`: Permissions for a participant get updated. • Communication and Audio Events: ◦ `IsSpeakingChanged`: Someone starts or stops speaking. ◦ `ActiveSpeakersChanged`: The list of active speakers updates. ◦ `DataReceived`: You receive data from another participant. • Quality and Connection Events: ◦ `ConnectionQualityChanged`: A participant’s connection quality shifts. ◦ `TrackStreamStateChanged`: A track you’re subscribed to gets paused, maybe due to bandwidth issues. These events make it super easy to build apps that react in real-time to what’s happening with participants, tracks, and communication. If you want to dive deeper into any specific event or how to use it, just let me know—I’m here to help! Sources: src/room/Room.ts | Handling events | LiveKit Docs | livekit-rtc/livekit/rtc/room.py | livekit-android-sdk/src/main/java/io/livekit/android/events/ParticipantEven...
w
When do the attributes of a participant change?
t
Hey there! Just wanted to share a quick rundown on how participant attributes in LiveKit can change: • Local Updates: Participants have the power to update their own attributes using SDK methods, like
setAttributes
in JavaScript. • Server-Side Updates: Attributes can also be updated through server APIs, and these updates get synced to everyone in the room. • Initial Connection: You can set attributes right in the participant's access token, so they’re ready to go as soon as they connect. • Programmatic Changes: Apps can tweak attributes based on events, like switching translation preferences on the fly. Whenever attributes change, LiveKit spots the differences and fires off events like
participant_attributes_changed
(Python) or
AttributesChanged
(JavaScript). These events tell you what changed and who it happened to. Just a heads-up: participants need the
canUpdateOwnMetadata
permission in their access token to update their own attributes. Also, while attributes sync across everyone, they’re not ideal for super frequent updates because of the server overhead. If you want to dive deeper into any part of this, just let me know—I’m here to help! Sources: livekit-rtc/livekit/rtc/room.py | Sources/LiveKit/Participant/Participant.swift | Participant attributes and metadata | LiveKit Docs | server/main.py | src/room/events.ts