Get Started: Voice & Video Calls
Estimated reading time: 5 minutes- Introduction
- Create Users
- Android
- iOS
- Xamarin
- Flutter
- Javascript
- C++
- Python
- Sending Media & Files
- Sync Messages
- Authentication
Here we provide a brief overview of the mesibo Call API. Refer to Quick Start with mesibo Call API to learn more.
Prerequisites
- Read the First App Guide.
- Read one of the Android, iOS, JS sections of this tutorial.
- You can refer to Android, iOS, and Javascript sample code for ready-to-run examples.
Voice and Video Calls
Mesibo allows you to enable peer-to-peer HD video and voice calls between your users in just a few lines of code. As with messaging, Mesibo video and voice calls are encrypted and hence secure. Mesibo does not bill any additional amount for the voice or video call API.
Making and receiving voice & video calls with Mesibo is simple. You only need to initialize MesiboCall once using just two lines of code! Then, mesibo will automatically handle incoming calls. For outgoing calls, you can invoke call API as required.
You can use mesibo voice and video calls as it is. But, if you wish, you can customize it to your needs. For example, you can customize the call screen UI, filter incoming calls, etc. Refer Call API Reference to learn about using the Call API to customize outgoing & incoming calls.
Java (Android)
To initialize in Java
MesiboCall.init(context);
MesiboCall.getInstance().setDefaultUiTitle('your app name');
To make a call in Java
MesiboCall.getInstance().callUi(this, address, true);
Kotlin (Android)
Initialization In Kotlin
MesiboCall.getInstance().init(applicationContext)
MesiboCall.getInstance().setDefaultUiTitle('mesibo first app')
To make a call in Kotlin
MesiboCall.getInstance().callUi(this, address, true)
Objective-C (iOS)
Initialization in Objective-C
[MesiboCall startWith:nil name:@"mesibo first App" icon:nil callKit:YES];
To make a call in Objective-C
[MesiboCallInstance callUi:self address:mRemoteUser video:YES];
Swift (iOS)
Initialization in Swift
MesiboCall.start(with: nil, name: "mesibo first app", icon: nil, callKit: true)
To make a call in Swift
MesiboCall.getInstance().callUi(self, address:mRemoteUser, video:true)
Javascript
To make a voice call using Mesibo Javascript SDK add an <audio>
HTML element.
<audio id="audioPlayer" autoplay="autoplay" controls="controls" style="visibility:hidden; height:5px;"></audio>
Then, call the method setupVoiceCall
and pass the id of your <audio>
element. Place a call to the destination user using the call
method by passing the destination’s address.
//initialize mesibo API
//api is the initialized mesibo api object
...
api.setupVoiceCall("audioPlayer");
api.call("123"); //Make a voice call to user with address "123"
To make a video call using Mesibo Javascript SDK add <video>
HTML elements.
<div class="row" style="background-color: #f1f1f1;">
<div class="col-6" style="padding: 10px;">
<video id="localVideo" playsinline autoplay muted></video>
</div>
<div class="col-6" style="padding: 10px;">
<video id="remoteVideo" playsinline autoplay></video>
</div>
</div>
localVideo
element to display your video(From your WebCam), remoteVideo
element to display destination video.
Then, call the method setupVideoCall
and pass the ids of your <video>
elements you need to display: your local video and remote video. Place a call to the destination user using the call
method by passing the destination’s address.
//initialize mesibo API
//api is the initialized mesibo api object
...
api.setupVideoCall("localVideo", "remoteVideo", true);
api.call("123"); //Make a video call to user with address "123"
To handle incoming calls, implement Mesibo_OnCall
as follows:
DemoNotify.prototype.Mesibo_OnCall = function(callid, from, video) {
console.log("Mesibo_onCall: " + (video?"Video":"Voice") + " call from: " + from);
if(video)
this.api.setupVideoCall("localVideo", "remoteVideo", true);
else
this.api.setupVoiceCall("audioPlayer");
// Show Incoming Call Screen
var s = document.getElementById("ansBody");
if(s)
s.innerText = "Incoming " + (video?"Video":"Voice") + " call from: " + from;
$('#answerModal').modal({ show: true });
}
Runtime Permissions
Before you make or receive calls with Mesibo, you must grant a few permissions required to place the call.
Refer to Request Microphone and Camera Permissions to learn about requesting the necessary permissions and the helper function checkPermissions, which simplifies the handling of required permissions.
We will get into conferencing in the next step.
mesibo, android, ios