Video Meeting SDK: Meeting Object, Custom UI, and Room Lifecycle
How the meeting client separates local and remote participants, join and waiting room flow, default vs custom UI Kit layout, and host controls.
This page summarizes Cloudflare RealtimeKit documentation for embedding live video meetings: initializing with an authToken, working with the meeting object, choosing default or custom UI Kit layouts, and handling waiting rooms, breakouts, and host actions. Examples below follow web naming (meeting.self, meeting.join()); mobile uses meeting.localUser and joinRoom() as described in Meeting Object Explained.
Meeting object: meeting.self vs meeting.participants
Section titled “Meeting object: meeting.self vs meeting.participants”The local user and everyone else are exposed through different entry points. Confusing them breaks grids, counts, and host targeting.
meeting.participants only contains remote participants. It does not include the local participant. Local participant is available in meeting.self.
— Cloudflare, Meeting Object Explained
meeting.self (web) or meeting.localUser (Android/iOS) controls your own audio, video, screen share, devices, and permissions. After Core SDK initialization with RealtimeKitClient.init({ authToken, defaults?, overrides?, onError? }), the onError callback surfaces invalid tokens, network issues, and media permission failures.
onError callback is used to handle SDK errors. These errors can be caused by an invalid auth token, network issues, media permissions, and so on.
— Cloudflare, Core SDK
Listen to events instead of polling: The meeting object emits events when state changes occur. Subscribe to these events rather than continuously checking property values.
— Cloudflare, Meeting Object Explained
When to use joined, active, waitlisted, and pinned
Section titled “When to use joined, active, waitlisted, and pinned”On web, remote participants live in maps under meeting.participants: joined, active, waitlisted, and pinned, each with .get(peer-id) and (for joined) .toArray(). Mobile exposes the same logical buckets as lists, plus helpers such as screenShares and activeSpeaker.
If you are building a video/audio grid, use the active map. To display a list of all participants, use the joined map.
— Cloudflare, Remote Participants
For pagination and spotlight layouts, use setViewMode("ACTIVE_GRID" | "PAGINATED"), setPage(), and properties like lastActiveSpeaker (Display active speakers, Remote Participants). Active speaker tracking applies only while the local participant renders others in active mode on page 0:
The SDK tracks active speakers only when the local participant is viewing or rendering participants in ACTIVE mode (page 0).
— Cloudflare, Display active speakers
Attach video on web with participant.registerVideoElement() or meeting.self.registerVideoElement(element, previewOnly); on mobile use getVideoView() (Remote Participants, Local participant).
| Topic | Web (meeting.self) |
Mobile (meeting.localUser) |
|---|---|---|
| Local handle | meeting.self |
meeting.localUser |
| Remote collections | Maps + toArray() |
Lists |
| Join | await meeting.join() |
joinRoom(...) |
| Display name before others see it | setName before join |
setDisplayName before joinRoom() |
| Grid vs list data | participants.active vs joined |
Same idea via list APIs |
Web Core 2.0 renamed meeting.joinRoom() / leaveRoom() to join() / leave() and moved per-participant host calls to meeting.participants.joined.get(id) (Web Core release notes).
Join, waiting room, and session lifecycle
Section titled “Join, waiting room, and session lifecycle”Call meeting.join() (or mobile joinRoom) after init. The UI Kit can show setup, waiting, joined, and ended screens automatically (Session Lifecycle).
The UI Kit SDKs automatically handle which notifications or screens to show at each state, so you don’t have to manage these transitions manually.
— Cloudflare, Session Lifecycle
With a waiting room enabled, admission is asymmetric:
After you call meeting.join(), one of two events will occur: roomJoined - You are allowed to join the meeting immediately; waitlisted - You are placed in the waiting room and must wait for host approval
— Cloudflare, Waiting Room
Track meeting.self.roomState and listen for roomJoined, waitlisted, and roomLeft with { state } (for example rejected, kicked, ended). Hosts use acceptWaitingRoomRequest / rejectWaitingRoomRequest on entries in meeting.participants.waitlisted (Waiting Room, Remote Participants).
Ending the meeting for everyone is not the same as leaving locally:
Ending a session is different from leaving a meeting. Leaving disconnects only the current participant. The session remains active if other participants are still present.
— Cloudflare, End a session
meeting.participants.kickAll() requires preset host permission kick_participant, stops recording, and sets status to ended. Server-side agent flows emit participant.kick_all without per-participant leave events (Agents Events).
Default RtkMeeting vs custom RtkUiProvider
Section titled “Default RtkMeeting vs custom RtkUiProvider”Install platform packages from Quickstart and UI Kit (for example @cloudflare/realtimekit-react + @cloudflare/realtimekit-react-ui on React). The all-in-one component is the fastest path:
The default RealtimeKit Meeting UI component gives you a complete meeting experience out of the box, with all the essential features built in. Drop it into your app and you are ready to go.
— Cloudflare, Build using UI Kit
For layouts you control, compose UI Kit pieces under RtkUiProvider / rtk-ui-provider (Build your own UI):
It is recommended to use either RtkMeeting or RtkUiProvider to render a meeting. Using both will result in unexpected behavior. For custom UIs, it is recommended to use RtkUiProvider always.
— Cloudflare, Build your own UI
You must include RtkNotifications, RtkParticipantsAudio, and RtkDialogManager. If you leave them out, features like settings toggles and notifications won’t work, and you won’t hear other participants in the session.
— Cloudflare, Build your own UI
With default RtkMeeting, joining is automatic:
The Default Meeting UI (RtkMeeting component) automatically joins the session, so you do not need to call meeting.join().
— Cloudflare, Breakout Rooms (UI Kit)
Custom stacks split RtkHeader, RtkStage, RtkControlbar, and screen components (RtkSetupScreen, RtkWaitingScreen, RtkEndedScreen). Replace bundled chrome with individual toggles per Custom controlbar and Custom header. For fullscreen, pass targetElement on RtkFullscreenToggle (often the RtkUiProvider container ref).
UI Kit rtkStatesUpdate vs Core meeting data
Section titled “UI Kit rtkStatesUpdate vs Core meeting data”rtkStatesUpdate / onRtkStatesUpdate reflect interface state (meeting: idle | setup | waiting | joined | ended, sidebars, modals). Participant counts, recording, and chat belong to the Core object:
For meeting data like participants, active speaker, or recording status, use the Core SDK’s meeting object directly.
— Cloudflare, State Management
In React, useRealtimeKitSelector reads Core fields; wire RealtimeKitProvider when using selectors (State Management, Polls). Without RtkMeeting, you must drive UI states from roomJoined / roomLeft yourself (Build your own UI).
Host controls, chat, and collaboration
Section titled “Host controls, chat, and collaboration”Host actions require matching preset permissions (Manage participants). Denied web host calls surface ClientError code 1201; native code uses HostError types.
Use RealtimeKit host controls to manage other participants in a live session. You can mute audio or video, pin a participant, or remove participants from the session.
— Cloudflare, Manage participants in a session
| Action | Web permission flag | Typical API |
|---|---|---|
| Mute one | canDisableParticipantAudio |
participant.disableAudio() |
| Mute all | same | meeting.participants.disableAllAudio() |
| Stop video | canDisableParticipantVideo |
participant.disableVideo() / disableAllVideo() |
| Pin | pinParticipant |
participant.pin() / unpin() |
| Remove one | kickParticipant |
participant.kick() |
| End for all | kickParticipant |
meeting.participants.kickAll() |
On web, hosts may call updatePermissions for a single participant; changes do not alter the preset and last only for the current session (Remote Participants).
Chat listens on meeting.chat chatUpdate (add | edit | delete). Default throughput is capped:
The default rate limit is 180 messages within 60 seconds.
— Cloudflare, Chat
Custom signals use meeting.participants.broadcastMessage(type, payload) and broadcastedMessage (Message broadcast). Shared meeting state can use meeting.stores key-value APIs (Meeting key-value store). Connection health appears on meeting.meta via mediaConnectionUpdate and socketConnectionUpdate (Meeting metadata).
Web Core 2.0 plugins
Section titled “Web Core 2.0 plugins”Plugins are no longer auto-fetched; pass defaults.plugins at init with HTMLElement components and namespaced ids (Web Core release notes). Pair Web Core 2.0 with RealtimeKit Web UI Kit 2.0+. Optional UI Kit Addons extend host menus and tiles without replacing Core event wiring.
Breakout rooms: API events and UI transition
Section titled “Breakout rooms: API events and UI transition”Hosts create rooms with meeting.connectedMeetings.createMeetings([{ title }]) and refresh lists via getConnectedMeetings(), which refetches room and participant membership (Breakout rooms (core)):
This API refetches the list of breakout rooms & participants, therefore can be considered the source of truth for breakout rooms & participants.
— Cloudflare, Breakout rooms (core)
Live updates use connectedMeetings.on("stateUpdate", ...). When a participant moves, changingMeeting then meetingChanged fire; assigned participants auto-join the breakout:
Participants will autojoin the breakout room if they are assigned to it. You won’t have to join meeting explicitly.
— Cloudflare, Breakout rooms (core)
After meetingChanged, run all actions on the new meeting reference. React’s useRealtimeKitClient swaps the client automatically (Breakout rooms (core)); vanilla JS, Angular, and custom iOS UI must rebind listeners (iOS custom UI should re-register feature listeners after a room switch per Breakout rooms (UI Kit)).
Common mistakes
Section titled “Common mistakes”Branding and copy overrides use provideRtkDesignSystem and Meeting locale rather than forking entire components. Stage and webinar flows add meeting.stage stageStatusUpdate (Stage management).
How to check this on your site
Section titled “How to check this on your site”- Initialize a test client with a valid
authTokenfrom your Add participant flow, withonErrorlogging enabled per Core SDK. - Join once with waiting room on: confirm
waitlistedvsroomJoined, then accept via host APIs in Waiting Room. - In a two-user session, verify
meeting.participants.joinedexcludes self whilemeeting.self.audioEnabledupdates onaudioUpdate(Meeting Object Explained). - If using custom UI, confirm audio, dialogs, and notifications mount, and that
rtkStatesUpdatemeetingstate matchesroomStateafter join (Build your own UI, State Management). - You can check automatically in Answerwell (our tool): https://answerwell.org/workspace
Report an error or ask a question
Section titled “Report an error or ask a question”If something on this page is wrong or unclear, email yimasynthetic@gmail.com with the page URL and the exact sentence you are asking about, and we will correct or clarify it.