Audio/Video Broadcast

To add Audio/Video Broadcast support in your application,

Include CustomUI.js in your index.html file to access the Custom UI functionality in your Cordova app

All the method calls will invoke their respective callback blocks as defined below.

1. Send call request
Send Audio Video Broadcast call request to the userID specified. (Ensure that userID cannot be nil or empty)


function callbackmeth(result){

   alert(result);

}
CustomUI.sendAVBroadcastRequestToUser("5","2be701b036ff9b6e3085d35049e59483",callbackmeth);

Invocation: After audio video broadcast call request is sent successfully.
Response: Callback containing id of the user to whom audio video broadcast request has been sent.
Eg:

"success"={
  callID = 2be701b036ff9b6e3085d35049e59483;
  userID = 5;
}

2. Start audio video broadcast
Start an audio-video broadcast within the container view. This function has to be called after sending/accepting audio-video broadcast request only. (Ensure that userID specified here should be the same while sending/accepting the request and also userID cannot be nil or empty)


function callbackmeth(result){

   alert(result);

}

CustomUI.startAVBroadcastWithInitiator(true,"2be701b036ff9b6e3085d35049e59483",this,callbackmeth);

Receiver

[avbroadcast startAVBroadcastWithInitiator:NO
                                    callID:@”2be701b036ff9b6e3085d35049e59483”
                           inContainerView:containerView
                                   failure:^(NSError * error) {
}];

3. End call
End audio-video broadcast with the user corresponding to userID specified. (Ensure that userID specified should be same as given when starting the audio-video broadcast and also userID cannot be nil or empty)


function callbackmeth(result){

   alert(result);

}

CustomUI.endAVBroadcastWithUser("6",callbackmeth);

Invocation: After ending audio video broadcast successfully.
Response: Callback containing id of the user with whom audio video broadcast has been ended.
Eg:

"success"={  
 success = 1;
}

4. Switch between front and rear camera in a Video call


function callbackmeth(result){

   alert(result);

}

CustomUI.switchCameraAVBroadcastSDK();

Please refer ‎error codes for failure responses.

Not finding what you need?

The CometChat team is here to help!