Mesibo Video Conferencing API - MesiboGroupCall

Estimated reading time: 4 minutes

MesiboCall.MesiboGroupCall controls various aspects of a group call, like joining and leaving the conference call, playing in-call sound, etc. The following is a list of methods available in the MesiboGroupCall API. The first step in starting a group call is to create a MesiboGroupCall object.

Refer to Conferencing API Documentation to learn more.

Creating an instance of MesiboGroupCall

You can get a group call instance using MesiboCall.groupCall().

Before you make a group call, ensure the following :

  1. Created a group and obtained a group-id.
  2. Added members to the group.
  3. Initialized and started mesibo, using a “user access token”. The mesibo user placing the group call, must be a member of that group.
  4. Granted the required device permissions for using mesibo Call APIs.

MesiboCall.groupCall() takes the following parameters:

  • callActivity, A MesiboCallActivity instance
  • groupid, The groupid that you obtained after creating a group

and returns a MesiboCall.MesiboGroupCall object. Returns null if there already is an ongoing call.

For example, in Android

mGroupcall = MesiboCall.getInstance().groupCall((MesiboCallActivity) getActivity(), 9999)

In iOS,

// Create a group call object
MesiboCall.MesiboGroupCall *MesiboGroupCallInstance =  [MesiboCallInstance groupCall:self groupid:mGid];  

In Javascript,

// Create a group call object
let mGroupcall = api.groupCall(this, groupid);

Once you create a group call instance, you can join the call using MesiboGroupCall.join() and leave the call using MesiboGroupCall.leave()

MesiboGroupCall Methods

The following are the methods in MesiboGroupCall

join

This initiates the group call and you join the call. This MUST be the first function you should call once your user-interface for displaying the group call is ready.

It takes the following parameters:

For example, in Android and Javascript,

mGroupcall.join(this);
// If you have implemented GroupCallListener in "this" context

In iOS,

// 'self' has implemented GroupCallListener
[MesiboGroupCallInstance join:self];

leave

All the streams that you are publishing will be hanged up and you will be exited from the conference room.

It does not take any parameters.

For example, in Android and Javascript,

mGroupcall.leave();

In iOS,

[GroupCallInstance leave]

createPublisher

Returns a MesiboParticipant object. It takes the following parameter:

  • sid, Arbitrary stream-ID.

For example, in Android

MesiboCall.MesiboParticipant publisher = mGroupCall.createPublisher(0);

In iOS,

//Create a participant object
MesiboParticipant *mParticipant = [GroupCallInstance createPublisher:0];

In Javascript,

mParticipant.setVideoSource(MESIBOCALL_VIDEOSOURCE_CAMERAFRONT, 0);

Once you create a publisher you can start publishing, by using the call method from this object.

setAudioDevice

Set the audio device to be used for the group call. The audio device can be Bluetooth, wired headset, earpiece, or the speaker.

Note that audio device selection algorithm varies between manufacturers (especially in Android) and hence it is recommended to only use speaker device in this function call - enable speaker when you’d like to use the speaker, disable otherwise and the API will automatically select the correct device. The selected device will be conveyed in the MesiboGroupCall_OnAudioDeviceChanged callback.

It takes the following parameters:

  • audioDevices, AudioDevice which specifies the type of audio device to be used
  • enable, Set to true to enable audio device, false otherwise

For example, in Android,

mGroupCall.setAudioDevice(MesiboCall.AudioDevice.SPEAKER, true);

Utility Functions

The following are utility functions available in MesiboGroupCall

playInCallSound

You can use this utility function to play a sound when a participant joins or leaves the conference call.

It takes the following parameters:

  • context, Application context.
  • audio file, In Android, pass the resource-ID of the audio that you need to play. In iOS, provide the path to the audio file as an NSUrl.
  • enable, Set to true, to enable playing the sound.

For example, in Android,

public void MesiboGroupcall_OnPublisher(MesiboCall.MesiboParticipant participant, boolean joined) {
	if (joined) {
		mGroupcall.playInCallSound(getContext(), R.raw.join, false);
		// Plays the audio file located at .../res/raw/join.mp3
	}
}

In iOS,

NSURL *sound = [NSURL fileURLWithPath:@"file:///path/to/audiofile/"];
[GroupCallInstance playInCallSound:sound]

stopInCallSound

Stops the in-call sound.

It does not take any parameters.

For example, in Android,

mGroupcall.stopInCallSound();
[GroupCallInstance stopInCallSound]
call, voice, video