Audio/Video Broadcast

The Methods below are available for Video Broadcast:

Method Description
SendAVBroadcastRequest Allows logged-in user to initiate a video Broadcast
StartAVBroadCast Starts the Video Broadcast in a provided UI container
InviteUsersInBroadcast Invite Other users to view a video Broadcast
EndAVBroadcastCall Ends the Video Broadcast
MuteAudio Allows logged in user to mute/unmute his audio
SwitchSpeakers Allows logged-in user to switch the speaker
PauseVideo Allows logged in user to turn off/on his video
ToggleCamera Allows logged-in user to switch the camera

SendAVBroadcastRequest

Allows logged-in user to initiate an Video Broadcast Method Signature:

SendAVBroadcastRequest(String userId, ICallbacks callback )

Example:

cometChat.SendAVBroadcastRequest("15", new MyCallbacks(success => successcallback(success), fail => failcallback(fail)));

    public void successcallback(JSONObject p0)
        {
           //block of code
        }

        public void failcallback(JSONObject p0)
        {
      //block of code
        }

Arguments:

Argument Description
toId userId of a viewer
callback success and failure callbacks

Response for successCallback:

{
    "id": "15",
    "callid": "bf1e7055f8e15d6f8662c7c4b6f8adb9"
}

Description:

Response Property Description
id userId of a viewer
callid id of the call session

StartAVBroadCast

Starts the AV Broadcast in the provided UI container
Method Signature:

StartAVBroadCast(Context context, String callid ,boolean iamBroadcaster ,RelativeLayout container,ICallbacks callbacks)

Example:

cometChat.StartAVBroadCast(MainActivity.this,"bf1e7055f8e15d6f8662c7c4b6f8adb9" , true , container, new MyCallbacks(success => successcallback(success), fail => failcallback(fail)));

    public void successcallback(JSONObject p0)
        {
           //block of code
        }

        public void failcallback(JSONObject p0)
        {
      //block of code
        }

Arguments:

Argument Description
context instance of the activity
callId id of a call received in onAvchatMessageReceived() callback
iamBroadcaster set to true if you initiate the broadcast, else set to false
container UI container to hold AV Broadcast UI
callback failure callbacks

InviteUsersInBroadcast

Invite Other users to view a video Broadcast Method Signature:

InviteUsersInBroadcast(JSONArray users, String callId, ICallbacks callbacks)

Example:

JSONArray users = new JSONArray();
users.put(1);
users.put(2);
cometChat.InviteUsersInBroadcast(users,new MyCallbacks(success => successcallback(success), fail => failcallback(fail)));

    public void successcallback(JSONObject p0)
        {
           //block of code
        }

        public void failcallback(JSONObject p0)
        {
      //block of code
        }

Arguments:

Argument Description
users JSONArray containg userId of the users
callId id of a call received in onAVBroadcastMessageReceived() callback
callback success and failure callbacks

Response for successCallback:

{ 
    "message": "users invited successfully"
}

Description:

Response Property Description
message a success message

EndAVBroadcastCall

Ends the Video Broadcast Method Signature:

EndAVBroadcastRequest(String userId, ICallbacks callback )

Example:

cometChat.EndAVBroadcastCall("15",new MyCallbacks(success => successcallback(success), fail => failcallback(fail)));

    public void successcallback(JSONObject p0)
        {
           //block of code
        }

        public void failcallback(JSONObject p0)
        {
      //block of code
        }

Arguments:

Argument Description
userId userId of other chat participant
callId id of a call received in onAVBroadcastMessageReceived() callback
callback success and failure callbacks

Response for successCallback:

{ 
    "id": "15"
}

Description:

Response Property Description
id userId of other chat participant

MuteAudio

Allows logged in user to mute/unmute the audio
Method Signature:

MuteAudio(Boolean flag)

Example:

cometChat.MuteAudio(true);

Arguments:

Argument Description
flag turn audio on/off

SwitchSpeakers

Allows logged-in user to switch the speaker
Method Signature:

SwitchSpeakers()

Example:

cometChat.SwitchSpeakers();

PauseVideo

Allows logged in user to pause/unpause the video
Method Signature:

PauseVideo(Boolean flag)

Example:

cometChat.PauseVideo(true);

Arguments:

Argument Description
flag turn video on/off

ToggleCamera

Allows logged-in user to switch the camera
Method Signature:

ToggleCamera()

Example:

cometChat.ToggleCamera();

  • Was this helpful?
  • Yes   No