Skip to main content
Quick Reference for AI Agents & Developers
// Join as presenter
val presenterSettings = CometChatCalls.PresentationSettingsBuilder(context)
    .setDefaultLayoutEnable(true)
    .setIsPresenter(true)  // true = presenter, false = viewer
    .setEventListener(eventListener)
    .build()

CometChatCalls.joinPresentation(callToken, presenterSettings, videoContainer, object : CometChatCalls.CallbackListener<String>() {
    override fun onSuccess(s: String) { }
    override fun onError(e: CometChatException) { }
})
Use Cases: Webinars, online classes, keynote speeches, all-hands meetings
Capacity: Up to 5 presenters + 95 viewers (100 total)

Overview

The Presenter Mode feature allows developers to create a calling service experience in which:
  1. There are one or more users who are presenting their video, audio, and/or screen (maximum 5)
  2. Viewers are consumers of that presentation (they cannot send their audio, video, or screen streams out)
  3. The total number of presenters and viewers can go up to 100
  4. Features such as mute/unmute audio, show/hide camera capture, recording, etc. are enabled only for the Presenter in this mode
  5. Other call participants do not get these features, so they act like passive viewers in the call
Using this feature, developers can create experiences such as:
  1. All hands calls
  2. Keynote speeches
  3. Webinars
  4. Talk shows
  5. Online classes and many more

About This Guide

This guide demonstrates how to start a presentation in an Android application. Before you begin, we strongly recommend you read the calling setup guide. Before starting a call session, you need to generate a call token. You need to call this method for the call token.

Start Presentation Session

The most important class used in the implementation is the PresentationSettings class. This class allows you to set the various parameters for Presenter Mode. To set the various parameters of the PresentationSettings class, use the PresentationSettingsBuilder class. Below are the various options available with the PresentationSettings class. The PresentationSettingsBuilder class takes 1 mandatory parameter as part of the constructor:
  1. Context of the application
You also need to set the User Type. There are 2 types of users in Presenter Mode: Presenter and Participant. You can set this in PresentationSettingsBuilder by using the method isPresenter(true/false). Here is a basic example of how to start a Presentation:
    RelativeLayout videoContainer;
    Context activityContext = this; //Your activity reference
    String callToken = ""; //Received on generate token onSuccess

    PresentationSettings presenterSettings = new CometChatCalls.PresentationSettingsBuilder(activityContext)
        .setDefaultLayoutEnable(true)
        .setIsPresenter(false)
        .setEventListener(new CometChatCallsEventsListener() {
            @Override
            public void onCallEnded() {
            }

            @Override
            public void onCallEndButtonPressed() {
            }

            @Override
            public void onUserJoined(RTCUser user) {
            }

            @Override
            public void onUserLeft(RTCUser user) {
            }

            @Override
            public void onUserListChanged(ArrayList<RTCUser> users) {
            }

            @Override
            public void onAudioModeChanged(ArrayList<AudioMode> devices) {
            }

            @Override
            public void onCallSwitchedToVideo(CallSwitchRequestInfo callSwitchRequestInfo) {
            }

            @Override
            public void onUserMuted(RTCMutedUser muteObj) {
            }

            @Override
            public void onRecordingToggled(RTCRecordingInfo recordingInfo) {
            }

            @Override
            public void onError(com.cometchat.pro.rtc.exceptions.CometChatException ce) {
            }
        })
        .build();

    CometChatCalls.joinPresentation(callToken, presenterSettings, videoContainer, new CometChatCalls.CallbackListener<String>() {
        @Override
        public void onSuccess(String s) {
            Log.e(TAG, "startSession onSuccess");
        }

        @Override
        public void onError(com.cometchat.pro.rtc.exceptions.CometChatException e) {
            Log.e(TAG, "CallSDKLog >>>: startSession onError: " + e);
        }
    });
ParameterDescription
activityContextThe activity in which you want to show the calling view.
videoContainerAn object of the RelativeLayout class in which CometChatCalls can load the calling views.
The CometChatCallsEventsListener listener provides you with the below callback methods:
Callback MethodDescription
onCallEnded()This method is called when the call is successfully ended. The call details can be obtained from the Call object provided.
onCallEndButtonPressed()This method is called when the user presses the end call button.
onUserJoined(user: RTCUser)This method is called when any other user joins the call. The user details can be obtained from the User object provided.
onUserLeft(user: RTCUser)This method is called when a user leaves the call. The details of the user can be obtained from the provided User object.
onUserListChanged(users: ArrayList<RTCUser?>)This method is triggered every time a participant joins or leaves the call, providing the list of users active in the call.
onAudioModeChanged(devices: ArrayList<AudioMode?>)This callback is triggered if any new audio output source is available or becomes unavailable.
onCallSwitchedToVideo(callSwitchRequestInfo: CallSwitchRequestInfo)This callback is triggered when an audio call is converted into a video call.
onUserMuted(muteObj: RTCMutedUser)This method is triggered when a user is muted in the ongoing call.
onRecordingToggled(recordingInfo: RTCRecordingInfo)This method is triggered when a recording starts/stops.
onError(e: CometChatException)This method is called when there is some error in establishing the call.

Settings

The PresentationSettings class is the most important class when it comes to implementing the Calling feature. This class allows you to customize the overall calling experience. The properties for the call/conference can be set using the PresentationSettingsBuilder class. This gives you an object of the PresentationSettings class which you can pass to the joinPresentation() method to start the call. The mandatory parameters required for any call/conference to work are:
  • Context - context of the activity/application
  • RelativeLayout - A RelativeLayout object in which the calling UI is loaded
The options available for customization of calls are:
SettingDescription
setIsPresenter(boolean value)If set to true, the user will join the call as a presenter. If set to false, the user will join the call as an audience member. Default value = false
setDefaultLayoutEnable(boolean value)If set to true enables the default layout for handling the call operations. If set to false, it hides the button layout and just displays the Call View. Default value = true
setIsAudioOnly(boolean value)If set to true, the call is supposed to be an audio call. If set to false, the call is supposed to be a video call. Default value = false
showEndCallButton(boolean value)If set to true, it displays the End Call Button in the Button Layout. If set to false, it hides the End Call Button in the Button Layout. Default value = true
showSwitchCameraButton(boolean value)If set to true, it displays the Switch Camera Button in the Button Layout. If set to false, it hides the Switch Camera Button in the Button Layout. Default value = true
showMuteAudioButton(boolean value)If set to true, it displays the Mute Audio Button in the Button Layout. If set to false, it hides the Mute Audio Button in the Button Layout. Default value = true
showPauseVideoButton(boolean value)If set to true, it displays the Pause Video Button in the Button Layout. If set to false, it hides the Pause Video Button in the Button Layout. Default value = true
showAudioModeButton(boolean value)If set to true, it displays the Audio Mode Button in the Button Layout. If set to false, it hides the Audio Mode Button in the Button Layout. Default value = true
startWithAudioMuted(boolean value)This ensures the call is started with the audio muted if set to true. Default value = false
startWithVideoMuted(boolean value)This ensures the call is started with the video muted if set to true. Default value = false
setDefaultAudioMode(boolean value)This method can be used if you wish to start the call with a specific audio mode. The available options are CometChatCallsConstants.AUDIO_MODE_SPEAKER, CometChatCallsConstants.AUDIO_MODE_EARPIECE, CometChatCallsConstants.AUDIO_MODE_BLUETOOTH, CometChatCallsConstants.AUDIO_MODE_HEADPHONES. Default value = false
showRecordingButton(boolean value)If set to true, it displays the Recording Button. If set to false, it hides the Recording Button. Default value = false
setEventListener(new CometChatCallsEventsListener())The CometChatCallsEventsListener listener provides you callbacks.
If you want to achieve a completely customized UI for the Calling experience, you can do so by embedding default Android buttons to the screen as per your requirement and then use the methods below to achieve different functionalities for the embedded buttons. For the use case where you want to align your own custom buttons and not use the default layout provided by CometChat, you can embed the buttons in your layout and use the methods below to perform the corresponding operations:
Always remove call event listeners when they’re no longer needed (e.g., in onDestroy() or when navigating away). Failing to remove listeners can cause memory leaks and duplicate event handling.

Best Practices

Keep the number of presenters to 5 or fewer for optimal performance. More presenters increase bandwidth requirements and can degrade the experience for viewers.
Clearly distinguish between presenters and viewers using setIsPresenter(). Presenters have full control (audio, video, screen share), while viewers are passive consumers.
Test your presentation with close to 100 participants to ensure your infrastructure can handle the load. Monitor bandwidth and CPU usage during testing.
Show visual indicators to users about their role (presenter vs viewer) and available controls. Viewers should understand they cannot send audio/video.
Implement logic to handle scenarios where a presenter disconnects unexpectedly. Consider promoting another user to presenter or ending the session gracefully.

Troubleshooting

Symptom: Viewers join the presentation but cannot see the presenter’s video stream.Cause: Presenter may have started with video muted, or network issues are preventing video transmission.Solution: Ensure the presenter has startWithVideoMuted(false) in their settings. Check network connectivity and bandwidth for both presenter and viewers.
Symptom: joinPresentation() fails with “Invalid call token” error.Cause: The call token is invalid or expired.Solution: Ensure you’re using a valid call token generated for the specific session. Verify the token hasn’t expired and matches the session ID.
Symptom: User cannot join as presenter even though setIsPresenter(true) is set.Cause: The maximum limit of 5 presenters has been reached.Solution: Wait for an existing presenter to leave, or join as a viewer instead. Implement logic to check presenter count before allowing users to join as presenters.

Next Steps