MirrorFly aims at building you a powerful vision with its well organized tutorial using a variety of tech stacks to get you the best video chat apps. This is the tutorial that walks you through the detailed technical version of Kotlin SDK build your real-time video calling application.

Where the market is filled with a lot of video chat apps, mobile development is all about introducing a new tech version at every other point with no time to think over. One of the most widely used technologies among all these video chat apps is Kotlin.

To make a video call is one of the core features for any video chat app. The video SDK allows the users to make one to one audio/video calls to get connected with other video SDK users.

This tutorial is all about Kotlin UI Kit, the backend services with security standards and protocol, all that which is necessary and need to be learned before planning to build an end-to-end encrypted video chat app with MirrorFly.

Let's get started with the steps with simple codes to build your Kotlin video Chat app:

Initial setup

Before proceed call implementation, please ensure you signed in with mirrorfly, downloaded our SDK & followed preliminary steps to configure & run our SDK. For more details, please check this link:

The foremost step in for building a video call is the set-up process. You will start with initializing the call SDK to begin the setup.

Request Params

Argument Type Description
SIGNAL_SERVER_DOMAIN String signal server url
String janus websocket server url
CALL_UI_ACTIVITY Class Activity which needs to be invoked during incoming call. when a incoming call is received Call sdk will start this activity with the call details
ICE_SERVERS_LIST List Ice servers list( STUN,TURN)

                           public void onCreate() {
                            //initialize call sdk
                            CallManager.setMissedCallListener(object : MissedCallListener {
                                override fun onMissedCall(isOneToOneCall: Boolean, userJid: String, groupId: String?, callType: String,
                                userList: ArrayList?) {
                                    //show missed call notification

                                     CallManager.setCallHelper(object : CallHelper {
                                        override fun getDisplayName(jid: String): String {
                                            return ContactManager.getDisplayName(jid)
                                             override fun sendCallMessage(details: GroupCallDetails, users: List, invitedUsers: List) {
                                                CallMessenger.sendCallMessage(details, users, invitedUsers)
                                                ChatManager.callService =

Setup your call activity

Call UI Activity should be defined like below in your manifest You need to call the below method on your call activity onCreate() to configure the call activity.



You need to call the below method on onStart() from your call activity to notify the call sdk to remove the ongoing call notification.


You need to call the below method on onStop() from your call activity to notify the call sdk to show the ongoing call notification.


Making a call

Once the initial set up is done, it is important that you check on the permissions for making the video call, for which you will have to first start with checking the audio permissions.

You can use the below method to check audio call permissions:


For video call, we need the below permissions:


You can use the below method to check video call permissions:


Make video call feature allows users to make a one to one video call with the another sdk user. You can make a video call using the below method.

                  CallManager.makeVideoCall("TO_JID", object : CallActionListener{
                    override fun onResponse(isSuccess: Boolean, message: String) {

Request Params

Argument Type Description Argument
TO_JID String jid of the call receiver TO_JID
CALLBACK - CallActionListener callback to observe the action status


It is a feature that allows you to connect with multiple SDK users at once. The below is the method that can be used to make the group video call,

Even here, you need to have a user JID for the caller and a Group ID for the Group to get into the makeVideoCall method. As soon as the program gets executed with the same, a callActionListener callback will be triggered and the callee user call status will be received as the following,

                         CallManager.makeGroupVideoCall(JID_LIST, GROUP_ID, object : 
                             override fun onResponse(isSuccess: Boolean, message: String) {


Request Params

Argument Type Description Argument
JID_LIST List jid list of the callee's JID_LIST
GROUP_ID String Group id of the group from which call initiated GROUP_ID
CALLBACK CallActionListener callback to observe the action status -

Answer the incoming call

Whenever you receive the audio/video call from another sdk user, depending upon the android version, your activity may be started so whenever the user presses the accept button from your call UI , you need to call the below sdk method to answer the call and notify the caller.

Note: if the required permissions are not available then call be will be automatically declined even though you answered a call

                          ChatManager.setIvAndAuthToken(IV, TOKEN);    

Request Params

Argument Type Description
CALLBACK CallActionListener callback to observe the action status

                                 CallManager.answerCall(object : CallActionListener { 
                                       override fun onResponse(isSuccess: Boolean, message: String) { 

Disconnect the ongoing call

Whenever you make the audio/video call to the another sdk user and you just want to disconnect the call before getting connected or if you want to just disconnect a connected call after the end of conversation, whenever user presses the disconnect button from your call UI , you need to call the below sdk method to disconnect the call and notify the caller.

Note: The below method accepts CallActionListener as an optional parameter. you can pass the listener to get disconnect success callback


Decline the incoming call

Whenever you receive the audio/video call from another sdk user, depending upon the android version, your activity may be started so whenever the user presses decline button from your call UI , you need to call the below sdk method to decline the call and notify the caller.


Managing mute/unmute video call events

During the video chat session if you need you can go ahead and mute/unmute a session i.e. In terms of technical coding, here you need to pass the boolean value as true for mute and false for unmute the entire video call session, using the muteVideo method as given below.


Request Params

Argument Type Description Argument
MUTE_VIDEO boolean Pass true,if you want to disable audio else pass false MUTE_VIDEO

Add participants to the call

Once the call gets connected, you can add multiple users in an ongoing call. The video SDK here provides the method where you can invite the users to the call, and once the user accepts the incoming call, they get connected to the call for further communication.

There is a need to provide the caller's with the user JID in array format using the below inviteUsers method,


Request Params

Param Description Type Required
[JID_LIST] Invite users JID list in array format Array true

Video Call Switching

Sometimes, it so happens that you might get an urge to switch the video for some clarity or need, in such a case we can initiate this video switching process, to do so we require to make a callback with callSwitchListener method. This method has to be registered in the client app to receive the request, accept, decline and cancel status information.

Moreover, whenever the user performs any related action to this call switching process, the client app will automatically receive the user action status in this callback.

Request the Call Switch

In this case, to send any call switch request, you need to use the method of requestVideoCallSwitch.


Cancel the Video Call Switch Request

Now, if suddenly you want to cancel the call switch request then you have to make use of the below method with cancelVideoCallSwitchRequest.


Accept the Video call switch Request

The same way if you were planning to go for video call switching, you can go ahead and accept the switching request with the acceptVideoCallSwitchRequest method.


Declining the Video Call Switching Request

To decline the video call switching you have to use declineVideoCallSwitchRequest method,


Get Track of All the Call Log Details

Whenever you make a video call session, all the call details will get automatically stored in the call log. So, if needed you can go ahead and retrieve all the call details by calling getCallLogs method.


Display of Browser Notification/Alerts

When it comes to web apps, the display of notification is very essential as it's with the other platforms. Thus, to display the browser notification there will be need to provide the notification object as showCallNotification method. These notifications will be displayed when a user receives a call or ends a call when the user is on some other screen.


Request Params

Argument Type Description
MUTE_STATUS Boolean if true, call notification/ui will not be shown when app is in background

Join the Video Call via Link

To join a video call using a link is not a simple process, there is a need of small ongoing steps that needs to be taken care off including need to get the call link, subscribe the call, join the call, etc. let's see each of them in detail with the call methods,


Obtain a Call Link

When you are there on an ongoing video call, and you need to join a video call session, then you have to make use of the method - getCallLink. With this method you can return the call link that is connected to a call or else will get you an error message.



Whenever you are in the join call UI, you need to initialize the join call setup in the call sdk by calling the below method.


after calling the setupJoinCallViaLink you can initialize your surface view for the video preview like below

            YOUR_SURFACE_VIEW.init(CallManager.getRootEglBase()!!.eglBaseContext, null)
            /* setting Target SurfaceViews to VideoSinks  */

Observing join call events

When you are in the join call UI, you might need to observe the call events to update the UI. You can use the below method to set the observer for the call events from call sdk.

                   CallManager.setJoinCallEventsListener(object : JoinCallListener {
                     override fun onSubscribeSuccess() {
                           //enable join call UI button here

                        override fun onLocalTrack(videoTrack: VideoTrack?) {
                             if (videoTrack != null) {

                                 override fun onUsersUpdated(usersList: List) {
                                    // update the users list in ui here

                                     override fun onError(reason: String) {
                                        // show the error and close the ui here

Request Params

Argument Type Description
joinCallListener JoinCallListener Listener to observe the events

Subscribe the call events

When you are in the join call UI, you need to subscribe to the call events by using the below method.

                  CallManager.subscribeCallEvents(CALL_LINK, USER_NAME, object : JoinCallActionListener {
                     override fun onSuccess() {

                        override fun onFailure(error: Error) {

Request Params

Argument Type Description
CALL_LINK String Call link for the ongoing call
USER_NAME String username of the current user
LISTENER JoinCallActionListener listener for action response

if onFailure called, you need to show the error message to the user and close the UI. The error object will contain the error code as well as the description.

The above method may return the below error codes, if any error occurred.

Type Error code Description
INVALID_CALL_LINK 100601 Call link is not valid
CALL_ENDED_ALREADY 100602 Call has been ended already
INTERNAL_SERVER_ERROR 100605 Server responds with failure response

Join a Call

Whenever you are planning to join a call and if you are in the preview screen, you can make use of the joinCall method.

Here, the callback needs to be given as an input that can handle the success/error of this method where the success and error object will be held as params. As soon as the call gets connected successfully the callback with the success object will get triggered. This will let you receive a normal call event.

But, if instead the callback with the error is triggered then this indicates some issue in joining. All these errors are popped-up as alerts and are redirected to other screens in the UI.

                  CallManager.joinCall(object : JoinCallActionListener {
                    override fun onSuccess() { 
                        override fun onFailure(error: Error) { 


Well, this is all about the tutorial to build your video chat app with Kotlin using Mirrorfly - a highly compatible solution that moves across all kinds of cross platforms. As the tutorial itself explained about the main video chat features, our solution still offers a lot more variety of rich features that can get you an outstanding video chat experience beyond your imagination.

So, I hope this platform would have helped you to get great understanding about the entire technical concept of Kotlin, but still if you feel the need for assistance, I suggest you have a try with our demo application and get some live experience for more in-depth clarity.

Launch your Own Android & iOS Group Video Call App with Kotlin!

Start today with MirrorFly APIs and services to scale 1 Billion concurrent users.

  • Average API response 3s
  • 100ms worldwide latency
  • 1 Billion+ concurrent users
Try for free
Try MirrorFly Free for 21 Days!

It’s easy, free, and you can start integrating on your app immediately...

Try for free
Let's Talk To Sales Team

We’d love to answer your questions. Tell us your needs, and we’ll contact you shortly.

Talk to Sales