Mesibo Video Conferencing API - Listeners

Estimated reading time: 7 minutes

The Mesibo Conferencing API provides the following listeners:

  • GroupCallListener, MesiboCall.GroupCallListener provides listeners that inform you about participants publishing and subscribing in the conference.

  • GroupCallInProgressListener, MesiboCall.GroupCallInProgressListener allows listeners to handle the stream that you are receiving from a participant such as, mute, hang up, talk detection, etc.

GroupCallListener

Your conferencing app needs to implement the GroupCallListener so that you will be notified when participants join and leave the conference. When participants join the conference, you can subscribe to their stream and view them.

The following are the listeners available in MesiboCall.GroupCallListener:

MesiboGroupcall_OnPublisher

Called when a particpiant is publishing audio/video.

Parameters

  • participant - The publisher, a MesiboParticipant object which you can use to make a call() to view their stream. Contains the name, address, ID, etc of the participant.
  • joined - true if they have started publishing, false when they stop publishing.

For example, in Java,

public void MesiboGroupcall_OnPublisher(MesiboCall.MesiboParticipant participant, boolean joined) {

    if (joined) {
        // call the publisher to view their stream
	// Add participant to list of publishers
    } else {
	// Remove participant from list of publishers	
    }
}

MesiboGroupcall_OnSubscriber

Called when a participant has subscribed to you.

  • participant - The subscriber, a MesiboParticipant object which contains the name, address, etc of the subscriber
  • joined - true when they start viewing you, false when they stop viewing you

For example, in Java

public void MesiboGroupcall_OnSubscriber(MesiboCall.MesiboParticipant p, boolean joined) {
        // This participant is viewing your stream
}

MesiboGroupcall_OnAudioDeviceChanged

MesiboGroupcall_OnAudioDeviceChanged is called when the active audio device is changed by a user action, for example, headset inserted, Bluetooth Audio Device was connected, etc while you are in an active group call. The UI can accordingly be updated. For example, when changing from speaker to headphone, you can disable the speaker button and enable a button with a headphone icon.

Parameters:

  • newAudioDevice,, The new AudioDevice that you the switched to and is considered to be active.
  • preAudioDevice, The previous AudioDevice that was active before you switched to a different one. The previous device is now considered to be inactive.

For example, In Android,

public void MesiboGroupcall_OnAudioDeviceChanged(MesiboCall.AudioDevice newAudioDevice, MesiboCall.AudioDevice prevAudioDevice) {
	// prevAudioDevice -> newAudioDevice
}

GroupCallInProgressListener

The GroupCallInProgressListener is invoked by mesibo for various events for a participant in an ongoing group call, such as when the participant mutes, hangs up, starts/stops talking, starts to stream audio and video, etc.

Using these callbacks, you get continuous feedback on what is happening on participant’s stream. If you are displaying the stream, and you can update your UI using this information. For example, if the participant has muted their audio then you may show an icon that indicates that the audio has been muted.

Note, that all the listeners in GroupCallInProgressListener will be called only for those publishers that you have subscribed to using call(). When you “subscribe” to a publisher, you are informing mesibo that you would like to view this publisher and you are “subscribing” to stream events for this publisher. So, mesibo will let you know of these “stream events” through GroupCallInProgressListener.

The following are the listeners in MesiboCall.GroupCallInProgressListener which will help you handle stream events.

MesiboGroupcall_OnMute

MesiboGroupcall_OnMute is called when a participant mutes their audio or video. Note that, you can use getMuteStatus() to know about the current mute status of a participant.

Parameters:

  • participant, The participant who you are viewing - a MesiboParticipant object
  • audioMuted, true if the participant has muted their audio, false otherwise
  • videMuted, true if the participant has muted their video(ie; they are not publishing their video), false otherwise

For example, In Android,

public void MesiboGroupcall_OnMute(MesiboCall.MesiboParticipant participant, boolean audioMuted, boolean videoMuted, boolean remote) {
    // Remote participant has muted
    // Check mute status
    if(audioMuted){
        // Audio Muted
    }

    if(videoMuted){
        // Video Muted
    }
}

MesiboGroupcall_OnHangup

MesiboGroupcall_OnHangup is called when the remote participant hangs up.

Parameters:

  • participant, The participant that hanged up, A MesiboParticipant object
  • reason, The reason for hangup indicated by any one of the following:
    • MESIBOCALL_HANGUP_REASON_REMOTE, The remote participant hanged up
    • MESIBOCALL_HANGUP_REASON_BACKGROUND, The application moved into the background
    • MESIBOCALL_HANGUP_REASON_USER, The user hung up the participant
    • MESIBOCALL_HANGUP_REASON_ERROR, An error occurred

For example, in Android,

public void MesiboGroupcall_OnHangup(MesiboCall.MesiboParticipant p, int reason) {
	if(MESIBOCALL_HANGUP_REASON_REMOTE == reason){
		// Remote user has hanged up
		// Cleanup
	}

MesiboGroupcall_OnConnected

MesiboGroupcall_OnConnected is called when connection to a publisher is established, after you subscribe to them and when the publisher is temporarily disconnected.

Parameters:

  • participant, The particpant who got connected/disconnected, A MesiboParticipant object
  • connected, true if connected, false otherwise

For example, in Java,

public void MesiboGroupcall_OnConnected(MesiboCall.MesiboParticipant participant, boolean connected) {
    if(connected){
        // Participant is connected
    } else {
        // Participant has been disconnected
    }
}

MesiboGroupcall_OnTalking

MesiboGroupcall_OnTalking is called when the participant starts or stops talking. Note, that you can use isTalking() to check if a participant is talking.

Parameters:

  • participant, The talking participant, A MesiboParticipant object
  • talking, Set to true if the participant has started talking. false if they stopped talking.
public void MesiboGroupcall_OnTalking(MesiboCall.MesiboParticipant participant, boolean talking) {
        if(participant.isTalking()){
                // Handle talking. Example, Show an indicator
        }
    }

MesiboGroupcall_OnVideoSourceChanged

MesiboGroupcall_OnVideoSourceChanged is called when the publisher changes their video source. For example, from camera feed to sharing their screen. Or from their front-facing camera to rear-facing camera (on Mobile)

Parameters:

  • participant, MesiboParticipant Object
  • source can be one of:
    • MESIBOCALL_VIDEOSOURCE_CAMERADEFAULT
    • MESIBOCALL_VIDEOSOURCE_CAMERAFRONT
    • MESIBOCALL_VIDEOSOURCE_CAMERAREAR
    • MESIBOCALL_VIDEOSOURCE_SCREEN
  • index, Camera Index

For example, in Android

public void MesiboGroupcall_OnVideoSourceChanged(MesiboParticipant participant, int source, int index) {
	if(MesiboCall.MESIBOCALL_VIDEOSOURCE_CAMERAFRONT == source){
		// The publisher is streaming from their camera, 
		... 
	}

}

MesiboGroupcall_OnVideo

MesiboGroupcall_OnVideo is called when you receive video from a participant who you have subscribed to. It is also called when any aspect of the video changes. For example, changes in aspect ratio, if video changes to landscape, etc. You can update the UI used to display the video accordingly for such changes.

Parameters:

  • participant, The participant who is publishing the video, A MesiboParticipant object
  • aspect_ratio, The ratio of width to height of the video
  • available, true if video available, false otherwise

For example, in Java

public void MesiboGroupcall_OnVideo(MesiboCall.MesiboParticipant participant, float aspect_ratio, boolean available) {
	// Display the video
}

MesiboGroupcall_OnAudio

MesiboGroupcall_OnAudio is called when you receive audio from a participant who you have subscribed to.

Parameters:

  • participant, The participant who is publishing the video, A MesiboParticipant object

For example, in Java

public void MesiboGroupcall_OnAudio(MesiboCall.MesiboParticipant mesiboParticipant) {
	// Receiving Audio
}
listeners, conferencing, voice, video