To add Audio/Video Group Conference support in your application,
Include the MessageSDKBinding.iOS in the .cs file of your ViewController.
All the method calls will invoke their respective callback blocks as defined below.
1. Initialize the GroupAVChat object:
GroupAVChat groupAVChat = new GroupAVChat();
2. Send conference call request
Send audio-video call request to all the users of the currently joined chatroom. (Ensure that logged-in user has joined a chatroom)
void SendConferenceRequest(Action success, Action failure);
Return type: void
Callback Blocks:
(i). Action response
Invocation: After audio video call request is sent successfully.
Response: NSDictionary containing success message
Eg:
{
"status"="Conference request sent successfully";
}
(ii). Actionfailure
Invocation: If an error occurs while sending audio video call request
Response: NSError containing error code and message
Usage:
private void OnSuccess(NSDictionary dict) {
Console.WriteLine("OnSuccess : " + dict);
}
private void OnFailure(NSError err) {
Console.WriteLine("OnFailure : " + err);
}
groupAVChat.SendConferenceRequest((dict) => { this.OnSuccess(dict); },
(err) => { this.OnFailure(err);});
3. Join conference
Join the Audio/Video conference started by another member of the current chatroom. HAS STARTED A VIDEO CONVERSATION message is received in the onAVChatMessageReceived callback block.
void JoinConference(Action success, Action failure);
Return type: void
Callback Blocks:
(i). Action response
Invocation: After joining the audio/video conference successfully
Response: NSDictionary containing success message
Eg:
{
"status" = "Conference joined successfully";
}
(ii). Actionfailure
Invocation: If an error occurs while sending audio/video conference request
Response: NSError containing error code and message
Usage:
private void OnSuccess(NSDictionary dict) {
Console.WriteLine("OnSuccess : " + dict);
}
private void OnFailure(NSError err) {
Console.WriteLine("OnFailure : " + err);
}
groupAVChat JoinConference((dict) => { this.OnSuccess(dict); },
(err) => { this.OnFailure(err);});
4. Start Audio/Video call
Start an audio-video call the currently joined conference within the container view. This function has to be called after sending/joining a conference request.
void StartConferenceInContainer(UIView view, Action failure);
Return type: void
Callback Blocks:
(i). Actionfailure
Invocation: If an error occurs while starting audio/video conference
Response: NSError containing error code and message
Usage:
private void OnFailure(NSError err) {
Console.WriteLine("OnFailure : " + err);
}
groupAVChat.startConferenceInContainer(view,(err) => { this.OnFailure(err);});
5. End/Leave conference call
End audio-video call with the user corresponding to userID specified. (Ensure that userID specified should be same as given when starting the audio-video call and also userID cannot be nil or empty)
void EndConference(Action success, Action failure);
Return type: void
Callback Blocks:
(i). Action response
Invocation: After ending audio video call successfully
Response: NSDictionary containing id of the user with whom audio/video call has been ended
Eg:
{
"status"="Conference ended successfully";
}
(ii). Actionfailure
Invocation: If an error occurs while ending audio/video conference request
Response: NSError containing error code and message
Usage:
private void OnSuccess(NSDictionary dict) {
Console.WriteLine("OnSuccess : " + dict);
}
private void OnFailure(NSError err) {
Console.WriteLine("OnFailure : " + err);
}
groupAVChat.EndConference((dict) => { this.OnSuccess(dict); },
(err) => { this.OnFailure(err);});
6. Toggle Audio to ON(YES) or OFF(NO) state
void ToggleAudio(bool audioControlFlag);
Return type: void
Usage:
groupAVChat.ToggleAudio(true);
7. Toggle Video to ON(YES) or OFF(NO) state
void ToggleVideo(bool videoControlFlag);
Return type: void
Usage:
groupAVChat.ToggleVideo(true);
8. Switch between front and rear camera in Group Video call
void SwitchCamera();
Return type: void
Usage:
groupAVChat.SwitchCamera();
Please refer error codes for failure responses.
Not finding what you need?
The CometChat team is here to help!