Audio/Video Group Conference

To use Audio/Video Chat functionality, you must have downloaded the Audio/Video Chat enabled Xamarin SDK. To start using GroupAVChat functionality you must have GroupAVChat instance which can be obtained as follows:

GroupAVChat grpchat = GroupAVChat.GetGroupChatInstance(this.ApplicationContext);

Note that GroupAVChat works only with the chatrooms, so you need to subscribe to the chatroom and join the chatroom.

1. Send Conference request
Before you start a conference, you need to send the conference request to the chatroom you have joined. The syntax is as follows:

SendConferenceRequest(Callbacks callback )


grpchat.SendConferenceRequest(new MyCallback(successObj=>this.onSucess(successObj)));

Where MyCallback is as follows :

class MyCallback : Java.Lang.Object, ICallback{
     Action <Org.Json.JSONObject> _onSuccess;
     Action <Org.Json.JSONObject> _onFail;
     public MyCallback(Action<Org.Json.JSONObject> onSuccess, Action<Org.Json.JSONObject> onFail = null)
	this._onFail = onFail;
	this._onSuccess = onSuccess;
      void SuccessCallbac(JSONObject){...}
      void FailCallback(JSONObject){...}

You will get success response as follows:

{ "status":"Conference request sent successfully" }

2. Join the conference
You can join the already started conference by using the function joinConference(). The syntax is as follows:

JoinConference(Callbacks callback )

The success response will be as follows:

{"status":"conference join success"}

3. Start Conference
Once you have sent the request for conference or made the ‘join conference’ request successfully then you can start the conference. The syntax is as follows:

StartConference(RelativeLayout container,Callbacks callback )


grpchat.StartConference(container,new MyCallback(successObj=>this.onSucess(successObj)));

Here the container is the relative layout in which video will be displayed. There is no success callback fired here.
Make sure that before calling this function you have either sent the request for conference or called the join conference function as mentioned below, else you will get error code ‘52’ with message ‘call details not found’.

4. End conference
You can leave the conference by calling endConference() function. The conference will end when all the members leave the conference. The syntax is as follows:

EndConference(Callbacks callback )

5.Toggle audio
While having conference you can turn on/off audio, so that other user cannot listen your voice. For this you can use toggleAudio() function. The syntax is as follows:

ToggleAudio(Boolean flag)

6. Toggle video
While having conference you can turn on/off video, so that other user cannot see your video. For this you can use toggleVideo() function. The syntax is as follows:

ToggleVideo(Boolean flag)

7. Switch camera
While having a conference you can switch between your front camera and back main camera. For this you can use SwitchCamera() function. This function doesn’t require any parameter.

8. Rotation handling
As you know Android devices are sensitive to the rotation, you need to handle the rotation especially while having a conference, so that you don’t find any difficulties and have a smooth transition while rotating the device. You need to use the following function to do so:



Pass the container which you have used in the function startConference() function.

Not finding what you need?

The CometChat team is here to help!