Mesibo Video & Voice Conferencing
MesiboParticipant Class Reference
The following is a list of methods available in the MesiboParticipant
class.
You MUST not directly create an instance of MesiboParticipant
. You will get a new MesiboParticipant
object:
When you create a publisher using GroupCall.createPublisher()
Or through listeners, MesiboGroupcall_OnPublisher and MesiboGroupcall_OnSubscriber
Refer to Conferencing API Documentation to learn more.
Call Functions
The following methods handle the call to a participant
call
The call()
method takes the following parameters:
- audio, true if you would like to receive the audio stream, false otherwise
- video, true if you would like to receive the video stream, false otherwise
- groupCallInProgressListener, An instance of GroupCallInProgressListener
For example, in Android, if you would like to have both audio and video while viewing a publisher, make a call as follows
public void MesiboGroupcall_OnPublisher(MesiboCall.MesiboParticipant participant, boolean joined) {
if (joined) {
participant.call(true, true , this);
// If you have implemented GroupCallInProgressListener in "this" context
}
}
In iOS,
-(void) MesiboGroupcall_OnPublisher:(MesiboParticipant *)participant joined:(BOOL)joined{
if (joined) {
// call the publisher to subscribe to their stream
[participant call:YES video:YES inProgressListener:self];
}
}
In Javascript,
GroupCallListener.prototype.MesiboGroupcall_OnPublisher = function(participant, joined) {
if (joined) {
// call the publisher to subscribe to their stream
participant.call(true, true , this);
}
}
To make an audio-only call,
In Android,
participant.call(true, false, this);
In iOS,
[participant call:YES video:NO listener:self];
In Javascript,
mParticipant.call(true, false, this);
Publishing a Stream
While publishing your stream, create a Participant by calling createPublisher()
and then use call()
.
For example, in Android, to publish a video stream from the front camera along with your audio
//Publish self stream
mLocalPublisher = mGroupcall.createPublisher(0);
mLocalPublisher.setVideoSource(MesiboCall.MESIBOCALL_VIDEOSOURCE_CAMERAFRONT, 0);
mLocalPublisher.call(true, true, this);
In iOS,
//Create a participant object
MesiboParticipant *mParticipant = [GroupCallInstance createPublisher:0];
//Set the source. For example, camera
[mParticipant setVideoSource:MESIBOCALL_VIDEOSOURCE_CAMERAFRONT index:0];
//Make a call. "this" is an instance of GroupCallInProgressListener
[mParticipant call:YES video:YES listener:self];
In Javascript,
//Create a participant object
let mParticipant = mGroupcall.createPublisher(0);
//Set the source. For example, camera
mParticipant.setVideoSource(MESIBOCALL_VIDEOSOURCE_CAMERAFRONT, 0);
mParticipant.call(true, true, this);
hangup
Stop publishing or viewing the stream.
It does not take any parameters.
For example, in Android and Javascript,
participant.hangup();
In iOS,
[participant hangup]
setListener
Set the listener instance which will be invoked for participant events
Takes the following parameter.
- listener, An instance of
GroupCallInProgressListener
For example, in Android and Javascript,
participant.setListener(this)
// If you have implemented GroupCallInProgressListener in "this" context
Stream Handling Functions
mute
Mute or unmute voice and/or video of a participant
It takes the following parameters:
- audio, audio mute/unmute operation
- video, video mute/unmute operation
- enable, Pass true to mute, false to unmute.
For example, in Android and Javascript, to mute audio
participant.mute(true, false, true)
Video Handling Functions
setVideoView
Set the video view for displaying video from a participant
In Android and iOS, setVideoView
takes the following parameter:
- mesiboVideoView, An instance of MesiboVideoView to display the video
In Android, you can have a MesiboVideoView
in your XML Layout file like below,
<com.mesibo.calls.api.MesiboVideoView
android:id="@+id/participant_stream_view"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
You can display the stream in this view, as follows:
if(participant.hasVideo()){
MesiboVideoView videoView = findViewById(R.id.participant_stream_view);
participant.setVideoView(videoView);
}
In Javascript, setVideoView()
takes the following parameters:
- videoView, the ID of the HTML element where you want to display the stream
- on_setvideo, function that will be called when
setVideoView()
is completed - retryTimeout - Time in milliseconds, after which attach will be called again if the previous attach failed
- maxRetries - Maximum number of retries to attach
If you have an HTML element where you would like to display the stream, like below:
<video class="centered" id="video-publisher" autoplay playsinline width="100%" height="100%" />
You need to call setVideoView()
as follows
function on_setvideo(set){
if(set){
...
}
else {
// setVideoView failed
}
}
participant.setVideoView('video-publisher', on_setvideo, 100, 50);
getVideoView
Returns a
MesiboVideoView object, if set using setVideoView()
It does not take any parameters.
For example, in Android,
MesiboVideoView mv = particpant.getVideoView()
In iOS,
MesiboVideoView *mv = [particpant getVideoView]
In Javascript,
let mv = particpant.getVideoView()
setVideoSource
Set the video source while publishing a video.
It takes the following parameters:
- videoSource , Video source type specified by a
VideoSource
constant. Can be one ofMESIBOCALL_VIDEOSOURCE_CAMERADEFAULT
Default camera to publish fromMESIBOCALL_VIDEOSOURCE_CAMERAFRONT
to publish stream from the device's front camera (on Mobile)MESIBOCALL_VIDEOSOURCE_CAMERAREAR
to publish stream from the device's rear camera (on Mobile)MESIBOCALL_VIDEOSOURCE_SCREEN
to share live screen
- Index, Camera index. If there are multiple(in addition to the front and rear) cameras on mobile, set the camera index.
For example, in Android & Javascript,
mParticipant.setVideoSource(MESIBOCALL_VIDEOSOURCE_CAMERAFRONT, 0);
In iOS,
[mParticipant setVideoSource:MESIBOCALL_VIDEOSOURCE_CAMERAFRONT index:0];
switchCamera
Switch between the back-facing camera and front-facing camera.
It does not take any parameters.
For example, in Android and Javascript,
participant.switchCamera();
In iOS,
[participant switchCamera];
switchSource
Switch between camera and screen.
It does not take any parameters.
For example, in Android and Javascript,
participant.switchSource();
In iOS,
[participant switchSource];
getVideoSource
Returns the active video source. Can be one of
MESIBOCALL_VIDEOSOURCE_CAMERADEFAULT
Default camera to publish fromMESIBOCALL_VIDEOSOURCE_CAMERAFRONT
to publish stream from the device's front camera (on Mobile)MESIBOCALL_VIDEOSOURCE_CAMERAREAR
to publish stream from the device's rear camera (on Mobile)MESIBOCALL_VIDEOSOURCE_SCREEN
to publish live screen
It does not take any parameters.
For example, in Android and Javascript,
participant.getVideoSource()
In iOS,
[participant getVideoSource];
toggleVideoMute
Toggle mute the video. That is, unmute the video if it is muted and mute it otherwise. While publishing, it stops video capture through the camera or screen, if the video is muted.
It does not take any parameters.
For example, in Android and Javascript,
participant.toggleVideoMute();
In iOS,
[participant toggleVideoMute];
getAspectRatio
Returns the width to height ratio of the video as a float value.
It does not take any parameters.
For example, in Android and Javascript,
participant.getAspectRatio();
In iOS,
[participant getAspectRatio];
isVideoLandscape
Returns true, if the video is landscape(ie; width of the video is greater than height, the aspect ratio is > 1) false otherwise.
It does not take any parameters.
For example, in Android and Javascript,
participant.isVideoLandscape()
In iOS,
[participant isVideoLandscape];
hasVideo
Returns true, if the stream has a video, false
otherwise
It does not take any parameters.
For example, in Android and Javascript,
participant.hasVideo()
In iOS,
[participant hasVideo];
Voice Handling Functions
toggleAudioMute
Toggle mute the audio. That is, unmute the audio if it is muted and mute it otherwise.
It does not take any parameters.
For example, in Android and Javascript,
participant.toggleAudioMute();
In iOS,
[participant toggleAudioMute];
hasAudio
Returns true, if the stream has audio, false
otherwise
It does not take any parameters.
For example, in Android and Javascript,
participant.hasAudio()
In iOS,
[participant hasAudio];
Stream Status/Information Functions
The following methods return information about the stream such as mute status, aspect ratio, talking status, name and address of the publisher, etc.
getMuteStatus
getMuteStatus
Returns the current mute status of the stream. Whenever a participant mutes the audio/video the mute status will be updated.
It takes the following parameters:
- video, Pass true to check video mute status, false for voice mute status.
Returns: true if muted, false otherwise
For example, in Android and Javascript, to check if a participant has muted their audio
participant.getMuteStatus(false)
In iOS,
[participant getMuteStatus:YES]; // Get Audio Mute Status
[participant getMuteStatus:NO]; // Get Video Mute Status
Note, that When a participant mutes MesiboGroupcall_OnMute will be called.
getTalkTimstamp
Returns the last timestamp at which the user talked.
It does not take any parameters.
For example, in Android,
long lastTalked = participant.getTalkTimstamp();
In Javascript,
let lastTalked = participant.getTalkTimstamp();
In iOS,
long lastTalked = [participant getTalkTimstamp];
getId
Returns the unique ID of the participant
It does not take any parameters.
For example, in Android and Javascript,
participant.getId();
In iOS,
[participant getId];
getName
Returns the name of the participant
It does not take any parameters.
For example, in Android and Javascript,
participant.getName();
In iOS,
[participant getName];
getAddress
Returns the address of the participant
It does not take any parameters.
For example, in Android and Javascript,
participant.getAddress();
In iOS,
[participant getAddress];
setName
Set the name of the participant. For example, while publishing a stream you can set your name, as the name of the publisher.
It takes the following parameter.
- name, Name of the participant
For example, in Android and Javascript,
participant.setName("John Doe");
In iOS,
[participant setName:@"John Doe"];
isCallConnected
Returns true if the participant is connected on the call, false otherwise.
It does not take any parameters.
For example, in Android and Javascript,
participant.isCallConnected();
In iOS,
[participant isCallConnected];
isCallInProgress
Returns true if the call to the participant is in progress, false otherwise.
It does not take any parameters.
For example, in Android and Javascript,
participant.isCallInProgress();
In iOS,
[participant isCallInProgress];
isVideoCall
Returns true, if video call false otherwise
It does not take any parameters.
For example, in Android and Javascript,
participant.isVideoCall()
In iOS,
[participant isVideoCall];
isMe
Returns true, if the participant is self, false otherwise
It does not take any parameters.
For example, in Android and Javascript,
participant.isMe()
In iOS,
[participant isMe];
isFrontCamera
Returns true, if the participant is publishing from their front camera(on mobile), false otherwise
It does not take any parameters.
For example, in Android and Javascript,
participant.isFrontCamera()
In iOS,
[participant isFrontCamera];
isTalking()
Returns true, if the participant is talking, false otherwise
It does not take any parameters.
For example, in Android and Javascript,
participant.isTalking()
In iOS,
[participant isTalking];
Utility Functions
The following are utility functions in MesiboParticipant
setUserData
Store any object - can be an object of a user-defined class, etc. Once set, you can access this object using getUserData
Takes the following parameter.
- object, Any Object
For example, in Android and Javascript,
participant.setUserData(myData);
In iOS,
[participant setUserData:myData];
getUserData
Access the data, set using setUserData
It does not take any parameters.
For example, in Android,
MyData mData = (MyData)participant.getUserData();
In Javascript,
let mData = participant.getUserData();
In iOS,
MyData mData = [participant getUserData];