Participant

open class Participant

Someone in the room — you, or a remote participant.

Instances come from Room.localParticipant, Room.participants and the RoomEventListener callbacks; application code never constructs one. The same participant keeps the same object for as long as they are in the room, so it is safe to hold one in a tile and compare by id.

Attach a ParticipantEventListener with addEventListener to learn when their streams come and go — that, not polling streams, is how a tile gets its video.

The host controls — enableMic, disableMic, enableCam, disableCam, remove and setViewPort — act on a remote participant and throw when called on the local one. setQuality and setScreenShareQuality do nothing on the local one.

Every suspend action here needs a joined room. The people already in the room are announced while Room.join is still running; an action called in that window waits for the join to finish. Otherwise, before joining, after leaving or while reconnecting, code 3035 (ERROR_ACTION_PERFORMED_BEFORE_ROOM_JOINED) or 3065 (ERROR_ROOM_RECONNECTING) goes to onError and the call returns without throwing.

Inheritors

Properties

Link copied to clipboard

The display name for this participant.

Link copied to clipboard
open val id: String

Server-assigned participant ID, and the key this participant has in Room.participants.

Link copied to clipboard
open val isLocal: Boolean

true if this participant is the local participant.

Link copied to clipboard
open val metaData: JSONObject?

Whatever metadata was attached when this participant joined, or null if they attached none. Fixed for the session; it never changes mid-session.

Link copied to clipboard
open val mode: Mode

How this participant takes part. Updated just before onParticipantModeChanged fires for them.

Link copied to clipboard

Which of this participant's streams are pinned, room-wide. Updated just before onPinStateChanged fires for them; not pinned until then.

Link copied to clipboard

The streams this participant is publishing right now, keyed by RTCStream.id.

Link copied to clipboard

The quality this device last asked for with setQuality, starting at VideoQuality.HIGH.

Functions

Link copied to clipboard

Starts delivering this participant's stream and state events to listener.

Link copied to clipboard
open suspend fun captureImage(width: Int = 0, height: Int = 0, flash: CaptureFlash = CaptureFlash.OFF): String

Takes a still from your own camera and returns it base64-encoded, ready for an ImageView or an upload.

Link copied to clipboard
open suspend fun consumeMicStreams()

Subscribes this device to the participant's microphone: the way to receive it in a room joined with createRoom(autoConsume = false), and to receive it again after stopConsumingMicStreams.

Link copied to clipboard
open suspend fun consumeWebcamStreams()

Subscribes this device to the participant's camera: with createRoom(autoConsume = false), and again after stopConsumingWebcamStreams. Receive-side only, and waits for a join still running, as consumeMicStreams does.

Link copied to clipboard
open suspend fun disableCam()

Turns this participant's camera off. Not a request — see disableMic.

Link copied to clipboard
open suspend fun disableMic()

Mutes this participant's microphone. Unlike enableMic they are not asked — the server mutes them, and their "audio" stream disappears for everyone.

Link copied to clipboard
open suspend fun enableCam()

Asks this participant to turn their camera on. They decide — see enableMic; the request arrives as onWebcamRequested.

Link copied to clipboard
open suspend fun enableMic()

Asks this participant to turn their microphone on.

Link copied to clipboard

Microphone statistics, as a single object — not an array, unlike getVideoStats, because there is only ever one mic track.

Link copied to clipboard

Statistics for the audio captured with the screen share. The microphone is not included — that is getAudioStats.

Link copied to clipboard

Screen-share statistics, as a single object — the same fields as one getVideoStats entry, for the share stream rather than the camera.

Link copied to clipboard

Totals for the connection underneath this participant's media, as the server measures it: send.outgoingBitrate and receive.incomingBitrate in kbps, send.totalSentBytes and receive.totalReceivedBytes. A value the server did not report is null.

Link copied to clipboard

Camera statistics — one JSON object per RTP stream, so your own camera publishing a simulcast ladder gives one entry per layer and a remote camera gives one.

Link copied to clipboard
open fun isAgent(): Boolean

true when this participant is an AI agent rather than a person — cast to AgentParticipant to read its state.

Link copied to clipboard
open suspend fun pin(pinType: PinType = PinType.SHARE_AND_CAM)

Pins this participant so every device in the room sees them promoted.

Link copied to clipboard
open suspend fun remove()

Kicks this participant out of the room. Whether your token may do this is the server's call.

Link copied to clipboard

Removes every registered ParticipantEventListener.

Link copied to clipboard

Removes a previously registered ParticipantEventListener.

Link copied to clipboard
open suspend fun setQuality(quality: VideoQuality)

Asks the server for a different simulcast layer of this participant's camera — drop a thumbnail tile to VideoQuality.LOW to save bandwidth, raise the speaker to VideoQuality.HIGH.

Link copied to clipboard
open suspend fun setScreenShareQuality(quality: VideoQuality)

The same request as setQuality, for this participant's screen share instead of their camera.

Link copied to clipboard
open suspend fun setViewPort(width: Int, height: Int)

Tells the server how large this participant's tile actually is, so it can pick the simulcast layer that fits instead of sending pixels you scale away.

Link copied to clipboard
open suspend fun stopConsumingMicStreams()

Stops receiving this participant's microphone, freeing that downstream bandwidth — they are not muted and everyone else still hears them.

Link copied to clipboard
open suspend fun stopConsumingWebcamStreams()

Stops receiving this participant's camera, freeing that downstream bandwidth — use it for tiles scrolled off screen. Their camera stays on for everyone else, and consumeWebcamStreams resubscribes.

Link copied to clipboard
open suspend fun unpin(pinType: PinType = PinType.SHARE_AND_CAM)

Releases a pin pin set, firing the same onPinStateChanged on all participants.