wooden-megabyte-91316
07/30/2025, 6:50 PMtall-airline-16756
07/30/2025, 6:50 PMtall-airline-16756
07/30/2025, 6:51 PMParticipantInfo.State in LiveKit is an enumeration that represents the different connection states a participant can be in during their lifecycle within a LiveKit room. It has four possible values:
• JOINING (0): The participant has connected to the WebSocket but has not yet received a join response. This is the initial state.
• JOINED (1): The server has received the participant's client offer, and they are in the process of establishing WebRTC connections.
• ACTIVE (2): The participant has established ICE connectivity and is fully connected, allowing them to publish/subscribe to media tracks.
• DISCONNECTED (3): The participant has left the room or been disconnected from the WebSocket.
The state transitions typically follow this flow: JOINING → JOINED → ACTIVE → DISCONNECTED, though participants can transition to DISCONNECTED from any previous state due to errors or explicit disconnection.
Sources: Room & Participant Management | livekit/livekit_composite | DeepWiki | livekit-protocol/src/livekit.rs | Rooms, participants, and tracks | LiveKit Docswooden-megabyte-91316
07/30/2025, 6:53 PMtall-airline-16756
07/30/2025, 6:54 PMParticipantInfo.State really depends on which SDK you're working with. No worries though—I’ve put together some examples for different platforms to help you out:
• JavaScript/TypeScript SDK:
import { ParticipantInfo_State } from '@livekit/protocol';
Then you can check the state like this:
if (participantInfo.state === ParticipantInfo_State.ACTIVE) { /* Do something */ }
• Flutter/Dart SDK:
import 'package:livekit_client/src/proto/livekit_models.pb.dart' as lk_models;
Here’s how you might use it:
if (participantInfo.state == lk_models.ParticipantInfo_State.ACTIVE) { /* Do something */ }
• Android/Kotlin SDK:
The state lives in the Participant class. For example:
if (participant.state == Participant.State.ACTIVE) { /* Do something */ }
• Swift SDK:
You’ll find the state defined as Livekit_ParticipantInfo.State. Like this:
if participant.state == .active { /* Do something */ }
• Python SDK:
The state is a nested class inside ParticipantInfo. For example:
if participant.state == ParticipantInfo.State.ACTIVE: # Do something
Just so you know, the state values are the same across all SDKs:
• JOINING (0): WebSocket connected, but not offered yet
• JOINED (1): Server received client offer
• ACTIVE (2): ICE connectivity established
• DISCONNECTED (3): WebSocket disconnected
If you want me to dive deeper into any specific SDK or have other questions, just give me a shout—I’m happy to help!
Sources: Sources/LiveKit/Protos/livekit_models.pb.swift | livekit-protocol/livekit/protocol/models.pyi | src/room/participant/Participant.ts | test/mock/test_data.dart | livekit-android-test/src/main/java/io/livekit/android/test/mock/TestData.ktwooden-megabyte-91316
07/30/2025, 6:54 PMtall-airline-16756
07/30/2025, 6:55 PMParticipantInfo class in LiveKit, it really depends on which SDK you're working with. Here’s a quick rundown of the import statements for different platforms:
• JavaScript/TypeScript SDK:
import { ParticipantInfo } from '@livekit/protocol';
• Python SDK:
from livekit.protocol.models import ParticipantInfo
or
from livekit.rtc._proto.participant_pb2 import ParticipantInfo
• Flutter/Dart SDK:
import 'package:livekit_client/src/proto/livekit_models.pb.dart';
• Swift SDK:
import LiveKit
You’ll find the Livekit_ParticipantInfo struct there.
• Unity/C# SDK:
using LiveKit.Proto;
The ParticipantInfo class lives in the LiveKit.Proto namespace.
Just make sure you have the right LiveKit package installed for your platform before you start importing. If you run into any questions or need a hand, feel free to ask—I’m here to help!
Sources: Sources/LiveKit/Protos/livekit_models.pb.swift | Runtime/Scripts/Proto/Participant.cs | src/room/participant/Participant.ts | agents/src/worker.ts | livekit-api/livekit/api/room_service.py