Meeting Object Explained·续1

The meeting.self represents the local user (you) in the meeting. It provides properties and methods to control your own audio, video, and screen sharing.

Key Properties:

// Participant identifiers
meeting.self.id; // Peer ID (unique per session)
meeting.self.userId; // Participant ID (persistent across sessions)
meeting.self.name; // Participant display name

// Media state
meeting.self.audioEnabled; // Boolean: Is audio enabled?
meeting.self.videoEnabled; // Boolean: Is video enabled?
meeting.self.screenShareEnabled; // Boolean: Is screen share active?

// Media tracks
meeting.self.audioTrack; // Audio MediaStreamTrack, if audio is enabled
meeting.self.videoTrack; // Video MediaStreamTrack, if video is enabled
meeting.self.screenShareTracks; // Structure: { audio: MediaStreamTrack, video: MediaStreamTrack }, if screen share is enabled

// Room state
meeting.self.roomJoined; // Boolean: Has joined the meeting?
meeting.self.roomState; // Current room state

Common Methods:

// Media controls
await meeting.self.enableAudio(); // Emits a `audioUpdate` event on `meeting.self` when successful.
await meeting.self.disableAudio(); // Emits a `audioUpdate` event on `meeting.self` when successful.
await meeting.self.enableVideo(); // Emits a `videoUpdate` event on `meeting.self` when successful.
await meeting.self.disableVideo(); // Emits a `videoUpdate` event on `meeting.self` when successful.
await meeting.self.enableScreenShare(); // Emits a `screenShareUpdate` event on `meeting.self` when successful.
await meeting.self.disableScreenShare(); // Emits a `screenShareUpdate` event on `meeting.self` when successful.

// Update Name
await meeting.self.setName("New Name"); // setName works only works before joining the meeting

// List Devices
await meeting.self.getAllDevices(); // Returns all available devices
await meeting.self.getAudioDevices(); // Returns all available audio devices
await meeting.self.getVideoDevices(); // Returns all available video devices
await meeting.self.getSpeakerDevices(); // Returns all available speaker devices
await meeting.self.getCurrentDevices(); // {audio: MediaDevice, video: MediaDevice, speaker: MediaDevice} Returns the current device configuration

// Change a device
await meeting.self.setDevice((await meeting.self.getAllDevices())[0]);

Remote participants

meeting.participants - All Remote Participants

The meeting.participants contains maps of all remote participants in the meeting, organized by their state.

Note

meeting.participants only contains remote participants. It does not include the local participant. Local participant is available in meeting.self.

Participant Maps:

// All participants who have joined
meeting.participants.joined; // Map of joined participants
meeting.participants.joined.toArray(); // Array of joined participants

// Participants with active media
meeting.participants.active; // Map of participants with active audio/video
meeting.participants.active.toArray(); // Array of participants with active audio/video

// Participants in waiting room
meeting.participants.waitlisted; // Map of waitlisted participants
meeting.participants.waitlisted.toArray(); // Array of waitlisted participants

// Pinned participants
meeting.participants.pinned; // Map of pinned participants
meeting.participants.pinned.toArray(); // Array of pinned participants

Accessing Participant Data:

// Get all joined participants as an array
const joinedParticipants = meeting.participants.joined.toArray();

// Access first participant's IDs
const firstParticipant = joinedParticipants[0];
console.log("First Participant Peer ID:", firstParticipant?.id); // Peer ID (unique per session)
console.log("First Participant User ID:", firstParticipant?.userId); // Participant ID (persistent)
console.log("First Participant Name:", firstParticipant?.name); // Display name
console.log("First Participant Audio Enabled:", firstParticipant?.audioEnabled); // Audio state
console.log("First Participant Video Enabled:", firstParticipant?.videoEnabled); // Video state
console.log(
    "First Participant Screen Share Enabled:",
    firstParticipant?.screenShareEnabled,
); // Screen share state
console.log("First Participant Audio Track:", firstParticipant?.audioTrack); // Audio MediaStreamTrack
console.log("First Participant Video Track:", firstParticipant?.videoTrack); // Video MediaStreamTrack
console.log(
    "First Participant Screen Share Track:",
    firstParticipant?.screenShareTracks,
); // Screen share MediaStreamTrack

// Access participant by peer ID
const participant = meeting.participants.joined.get("peer-id");

// Get count of joined participants
const count = meeting.participants.joined.size();

Participant Properties:

Each participant object has similar properties to meeting.self:

participant.id; // Peer ID
participant.userId; // Participant ID
participant.name; // Display name
participant.audioEnabled; // Audio state
participant.videoEnabled; // Video state
participant.screenShareEnabled; // Screen share state
participant.audioTrack; // Audio MediaStreamTrack
participant.videoTrack; // Video MediaStreamTrack
participant.screenShareTrack; // Screen share MediaStreamTrack

The meeting.participants contains maps of all remote participants in the meeting, organized by their state.

Note

meeting.participants only contains remote participants. It does not include the local participant. Local participant is available in meeting.self.

Participant Maps:

// All participants who have joined
meeting.participants.joined; // Map of joined participants
meeting.participants.joined.toArray(); // Array of joined participants

// Participants with active media
meeting.participants.active; // Map of participants with active audio/video
meeting.participants.active.toArray(); // Array of participants with active audio/video

// Participants in waiting room
meeting.participants.waitlisted; // Map of waitlisted participants
meeting.participants.waitlisted.toArray(); // Array of waitlisted participants

// Pinned participants
meeting.participants.pinned; // Map of pinned participants
meeting.participants.pinned.toArray(); // Array of pinned participants

Accessing Participant Data:

// Get all joined participants as an array
const joinedParticipants = meeting.participants.joined.toArray();

// Access first participant's IDs
const firstParticipant = joinedParticipants[0];
console.log("First Participant Peer ID:", firstParticipant?.id); // Peer ID (unique per session)
console.log("First Participant User ID:", firstParticipant?.userId); // Participant ID (persistent)
console.log("First Participant Name:", firstParticipant?.name); // Display name
console.log("First Participant Audio Enabled:", firstParticipant?.audioEnabled); // Audio state
console.log("First Participant Video Enabled:", firstParticipant?.videoEnabled); // Video state
console.log(
    "First Participant Screen Share Enabled:",
    firstParticipant?.screenShareEnabled,
); // Screen share state
console.log("First Participant Audio Track:", firstParticipant?.audioTrack); // Audio MediaStreamTrack
console.log("First Participant Video Track:", firstParticipant?.videoTrack); // Video MediaStreamTrack
console.log(
    "First Participant Screen Share Track:",
    firstParticipant?.screenShareTracks,
); // Screen share MediaStreamTrack

// Access participant by peer ID
const participant = meeting.participants.joined.get("peer-id");

// Get count of joined participants
const count = meeting.participants.joined.size();

Participant Properties:

Each participant object has similar properties to meeting.self:

participant.id; // Peer ID
participant.userId; // Participant ID
participant.name; // Display name
participant.audioEnabled; // Audio state
participant.videoEnabled; // Video state
participant.screenShareEnabled; // Screen share state
participant.audioTrack; // Audio MediaStreamTrack
participant.videoTrack; // Video MediaStreamTrack
participant.screenShareTrack; // Screen share MediaStreamTrack

The meeting.participants contains maps of all remote participants in the meeting, organized by their state.

Note

meeting.participants only contains remote participants. It does not include the local participant. Local participant is available in meeting.self.

Participant Maps:

// All participants who have joined
meeting.participants.joined; // Map of joined participants
meeting.participants.joined.toArray(); // Array of joined participants

// Participants with active media
meeting.participants.active; // Map of participants with active audio/video
meeting.participants.active.toArray(); // Array of participants with active audio/video

// Participants in waiting room
meeting.participants.waitlisted; // Map of waitlisted participants
meeting.participants.waitlisted.toArray(); // Array of waitlisted participants

// Pinned participants
meeting.participants.pinned; // Map of pinned participants
meeting.participants.pinned.toArray(); // Array of pinned participants

Accessing Participant Data:

// Get all joined participants as an array
const joinedParticipants = meeting.participants.joined.toArray();

// Access first participant's IDs
const firstParticipant = joinedParticipants[0];
console.log("First Participant Peer ID:", firstParticipant?.id); // Peer ID (unique per session)
console.log("First Participant User ID:", firstParticipant?.userId); // Participant ID (persistent)
console.log("First Participant Name:", firstParticipant?.name); // Display name
console.log("First Participant Audio Enabled:", firstParticipant?.audioEnabled); // Audio state
console.log("First Participant Video Enabled:", firstParticipant?.videoEnabled); // Video state
console.log(
    "First Participant Screen Share Enabled:",
    firstParticipant?.screenShareEnabled,
); // Screen share state
console.log("First Participant Audio Track:", firstParticipant?.audioTrack); // Audio MediaStreamTrack
console.log("First Participant Video Track:", firstParticipant?.videoTrack); // Video MediaStreamTrack
console.log(
    "First Participant Screen Share Track:",
    firstParticipant?.screenShareTracks,
); // Screen share MediaStreamTrack

// Access participant by peer ID
const participant = meeting.participants.joined.get("peer-id");

// Get count of joined participants
const count = meeting.participants.joined.size();

Participant Properties:

Each participant object has similar properties to meeting.self:

participant.id; // Peer ID
participant.userId; // Participant ID
participant.name; // Display name
participant.audioEnabled; // Audio state
participant.videoEnabled; // Video state
participant.screenShareEnabled; // Screen share state
participant.audioTrack; // Audio MediaStreamTrack
participant.videoTrack; // Video MediaStreamTrack
participant.screenShareTrack; // Screen share MediaStreamTrack

The meeting.participants contains lists of all remote participants in the meeting, organized by their state.

Participant Lists:

// All participants who have joined
val joined: List<RtkRemoteParticipant> = meeting.participants.joined

// Participants with active media
val active: List<RtkRemoteParticipant> = meeting.participants.active

// Participants in waiting room
val waitlisted: List<RtkRemoteParticipant> = meeting.participants.waitlisted

// Pinned participant
val pinned: RtkRemoteParticipant? = meeting.participants.pinned

// Participants sharing screen
val screenShares: List<RtkRemoteParticipant> = meeting.participants.screenShares

// Active speaker
val activeSpeaker: RtkRemoteParticipant? = meeting.participants.activeSpeaker

// Total count of participants (including local user if joined)
val totalCount: Int = meeting.participants.totalCount

Accessing Participant Data:

// Get all joined participants
val joinedParticipants = meeting.participants.joined

// Access first participant
val firstParticipant = joinedParticipants.firstOrNull()
firstParticipant?.id // Participant ID (aka peerId)
firstParticipant?.userId // User ID
firstParticipant?.name // Display name
firstParticipant?.picture // Participant picture (if any)
firstParticipant?.customParticipantId // Custom participant ID
firstParticipant?.audioEnabled // Audio state
firstParticipant?.videoEnabled // Video state
firstParticipant?.screenShareEnabled // Screen share state
firstParticipant?.isPinned // Pin state
firstParticipant?.isHost // Host state
firstParticipant?.presetName // Preset name
firstParticipant?.stageStatus // Stage status
firstParticipant?.flags // Participant flags (recorder, hiddenParticipant, webinarHiddenParticipant)

// Get participant video view
firstParticipant?.getVideoView() // Returns a View that renders video stream
firstParticipant?.getScreenShareVideoView() // Returns a View that renders screenshare stream

// Access pagination
val maxNumberOnScreen = meeting.participants.maxNumberOnScreen // Max participants per page
val currentPageNumber = meeting.participants.currentPageNumber // Current page number
val pageCount = meeting.participants.pageCount // Total number of pages
val canGoNextPage = meeting.participants.canGoNextPage // Can navigate to next page
val canGoPreviousPage = meeting.participants.canGoPreviousPage // Can navigate to previous page
meeting.participants.setPage(1) // Switch to specific page

Participant Control Methods:

// Individual participant controls (host only)
firstParticipant?.disableAudio { error -> } // Disable participant's audio
firstParticipant?.disableVideo { error -> } // Disable participant's video
firstParticipant?.kick { error -> } // Remove participant from meeting

// Pin/Unpin participants
val error: HostError? = firstParticipant?.pin() // Pin participant
val error: HostError? = firstParticipant?.unpin() // Unpin participant

// Waiting room management
meeting.participants.acceptWaitingRoomRequest(participantId) // Accept from waiting room
meeting.participants.rejectWaitingRoomRequest(participantId) // Reject from waiting room
meeting.participants.acceptAllWaitingRoomRequests() // Accept all waiting participants

// Bulk operations (host only)
val error: HostError? = meeting.participants.disableAllAudio() // Disable all participants' audio
val error: HostError? = meeting.participants.disableAllVideo() // Disable all participants' video
val error: HostError? = meeting.participants.kickAll() // Remove all participants

// Broadcast custom message
meeting.participants.broadcastMessage("custom-event", mapOf("key" to "value"))

// Cache management
meeting.participants.enableCache() // Enable participant caching
meeting.participants.disableCache() // Disable participant caching

Participant Properties:

participant.id // Participant ID (aka peerId, unique per session)
participant.userId // User ID (persistent across sessions)
participant.name // Display name
participant.picture // Participant picture URL
participant.customParticipantId // Custom participant ID
participant.audioEnabled // Audio state
participant.videoEnabled // Video state
participant.screenShareEnabled // Screen share state
participant.isPinned // Pin state
participant.isHost // Host state
participant.presetName // Preset name
participant.stageStatus // Stage status
participant.flags // Participant flags (recorder, hiddenParticipant, webinarHiddenParticipant)

The meeting.participants contains lists of all remote participants in the meeting, organized by their state.

Participant Lists:

```swift // All participants who have joined let joined: [RtkRemoteParticipant] = meeting.participants.joined