Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/realtime/llms.txt
Use this file to discover all available pages before exploring further.
STOP! If you are an AI agent or LLM, read this before continuing. This is the HTML version of a Cloudflare documentation page. Always request the Markdown version instead — HTML wastes context. Get this page as Markdown: https://developers.cloudflare.com/realtime/realtimekit/core/stage-management/index.md (append index.md) or send Accept: text/markdown to https://developers.cloudflare.com/realtime/realtimekit/core/stage-management/. For this product's page index use https://developers.cloudflare.com/realtime/llms.txt. For all Cloudflare products use https://developers.cloudflare.com/llms.txt.
This guide explains how to use stage management APIs for Webinar (WebRTC) use cases in Cloudflare RealtimeKit.
Instead of a traditional publish-subscribe model, where a user can publish their
media and others can choose to subscribe, RealtimeKit comes with an optional
managed configuration. In this managed configuration, a less privileged user can
be configured with a default behavior to not publish media. The user can then
request permission to be allowed to publish their media, where a privileged user
can choose to grant or deny access.
Using RealtimeKit's stage management APIs, a user can perform actions such as:
Leave and join stage
Manage stage requests and permissions
Kick participants
Access the Stage APIs
The stage module can be accessed under the meeting.stage namespace.
console.log("Stage object:",meeting.stage);
TypeScript
console.log("Stage object:",meeting.stage);
JavaScript
console.log("Stage object:",meeting.stage);
Kotlin
Log.d("Stage", "Stage object: ${meeting.stage}")
Swift
print("Stage object: \(meeting.stage)")
Dart
print("Stage object: ${meeting.stage}");
console.log("Stage object:",meeting.stage);
Properties
Status
The meeting.stage.status property returns the current stage status of the local user.
ON_STAGE - The user is currently on the stage and sharing audio and video.
OFF_STAGE - The user is viewing the session but is not on the stage and is not sharing audio or video.
REQUESTED_TO_JOIN_STAGE - The user has a pending request to join the stage and share audio and video. This status remains until the host accepts or rejects the request.
ACCEPTED_TO_JOIN_STAGE - The host has accepted the user's request to join the stage.
Host Controls
RealtimeKit's stage management APIs allow hosts to receive and manage stage requests as well as leave and join the stage.
Join Stage
This method connects the user to the media room, enabling them to interact with other peers in the meeting.
awaitmeeting.stage.join();
TypeScript
awaitmeeting.stage.join();
JavaScript
awaitmeeting.stage.join();
Kotlin
meeting.stage.join()
Swift
meeting.stage.join()
Dart
meeting.stage.join();
awaitmeeting.stage.join();
Leave Stage
By employing this method, the user will be disconnected from the media room and subsequently unable to communicate with their peers. Additionally, their audio and video will no longer be visible to others in the room.
awaitmeeting.stage.leave();
TypeScript
awaitmeeting.stage.leave();
JavaScript
awaitmeeting.stage.leave();
Kotlin
meeting.stage.leave()
Swift
meeting.stage.leave()
Dart
meeting.stage.leave();
awaitmeeting.stage.leave();
Grant Access
A privileged user can grant access to stage for a set of users with the grantAccess method.
awaitmeeting.stage.grantAccess(userIds);
TypeScript
awaitmeeting.stage.grantAccess(userIds);
JavaScript
awaitmeeting.stage.grantAccess(userIds);
Kotlin
meeting.stage.grantAccess(userIds)
Swift
meeting.stage.grantAccess(userIds: userIds)
Dart
meeting.stage.grantAccess(userIds);
awaitmeeting.stage.grantAccess(userIds);
Parameters:
userIds (string[]) - Array of user IDs to grant stage access. You can retrieve user IDs using meeting.participants.toArray().map(p => p.userId)
userIds (string[]) - Array of user IDs to grant stage access. You can retrieve user IDs using meeting.participants.toArray().map(p => p.userId)
userIds (string[]) - Array of user IDs to grant stage access. You can retrieve user IDs using meeting.participants.toArray().map(p => p.userId)
userIds (List<String>) - List of user IDs to grant stage access. You can retrieve user IDs using meeting.participants.map { it.userId }
userIds ([String]) - Array of user IDs to grant stage access. You can retrieve user IDs using meeting.participants.map { $0.userId }
userIds (List<String>) - List of user IDs to grant stage access. You can retrieve user IDs using meeting.participants.map((p) => p.userId).toList()
userIds (string[]) - Array of user IDs to grant stage access. You can retrieve user IDs using meeting.participants.toArray().map(p => p.userId)
Deny Access
A privileged user can deny access to stage for a set of users with the denyAccess method.
awaitmeeting.stage.denyAccess(userIds);
TypeScript
awaitmeeting.stage.denyAccess(userIds);
JavaScript
awaitmeeting.stage.denyAccess(userIds);
Kotlin
meeting.stage.denyAccess(userIds)
Swift
meeting.stage.denyAccess(userIds: userIds)
Dart
meeting.stage.denyAccess(userIds);
awaitmeeting.stage.denyAccess(userIds);
Parameters:
userIds (string[]) - Array of user IDs to deny stage access. You can retrieve user IDs using meeting.participants.toArray().map(p => p.userId)
userIds (string[]) - Array of user IDs to deny stage access. You can retrieve user IDs using meeting.participants.toArray().map(p => p.userId)
userIds (string[]) - Array of user IDs to deny stage access. You can retrieve user IDs using meeting.participants.toArray().map(p => p.userId)
userIds (List<String>) - List of user IDs to deny stage access. You can retrieve user IDs using meeting.participants.map { it.userId }
userIds ([String]) - Array of user IDs to deny stage access. You can retrieve user IDs using meeting.participants.map { $0.userId }
userIds (List<String>) - List of user IDs to deny stage access. You can retrieve user IDs using meeting.participants.map((p) => p.userId).toList()
userIds (string[]) - Array of user IDs to deny stage access. You can retrieve user IDs using meeting.participants.toArray().map(p => p.userId)
Kick Users
A privileged user can remove a set of users from stage using the kick method.
awaitmeeting.stage.kick(userIds);
TypeScript
awaitmeeting.stage.kick(userIds);
JavaScript
awaitmeeting.stage.kick(userIds);
Kotlin
meeting.stage.kick(userIds)
Swift
meeting.stage.kick(userIds: userIds)
Dart
meeting.stage.kick(userIds);
awaitmeeting.stage.kick(userIds);
Parameters:
userIds (string[]) - Array of user IDs to remove from stage. You can retrieve user IDs using meeting.participants.toArray().map(p => p.userId)
userIds (string[]) - Array of user IDs to remove from stage. You can retrieve user IDs using meeting.participants.toArray().map(p => p.userId)
userIds (string[]) - Array of user IDs to remove from stage. You can retrieve user IDs using meeting.participants.toArray().map(p => p.userId)
userIds (List<String>) - List of user IDs to remove from stage. You can retrieve user IDs using meeting.participants.map { it.userId }
userIds ([String]) - Array of user IDs to remove from stage. You can retrieve user IDs using meeting.participants.map { $0.userId }
userIds (List<String>) - List of user IDs to remove from stage. You can retrieve user IDs using meeting.participants.map((p) => p.userId).toList()
userIds (string[]) - Array of user IDs to remove from stage. You can retrieve user IDs using meeting.participants.toArray().map(p => p.userId)
Participant Controls
RealtimeKit's stage management APIs allow participants to request and manage stage access.
Request Access
This method is used to create a new stage request which can be approved by the host. Each user (viewer or host) must call this method in order to join the stage.
When the host calls this method, their status will be updated to ACCEPTED_TO_JOIN_STAGE.
awaitmeeting.stage.requestAccess();
TypeScript
awaitmeeting.stage.requestAccess();
JavaScript
awaitmeeting.stage.requestAccess();
Kotlin
meeting.stage.requestAccess()
Swift
meeting.stage.requestAccess()
Dart
meeting.stage.requestAccess();
awaitmeeting.stage.requestAccess();
Cancel Access Request
You can call this method to cancel your stage request.
awaitmeeting.stage.cancelRequestAccess();
TypeScript
awaitmeeting.stage.cancelRequestAccess();
JavaScript
awaitmeeting.stage.cancelRequestAccess();
Kotlin
meeting.stage.cancelRequestAccess()
Swift
meeting.stage.cancelRequestAccess()
Dart
meeting.stage.cancelRequestAccess();
awaitmeeting.stage.cancelRequestAccess();
Events
The meeting.stage module emits the following events:
Stage Access Requests Updated
Emitted when there is an update to stage access requests.