Audio/Video Group Conference

To add Audio/Video Group Conference support in your application,

Include the class <CometChatSDK/GroupAVChat.h> in the .h file of your class.

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

1. Initialize the GroupAVChat object:

GroupAVChat *groupAVChat = [[GroupAVChat alloc] init];

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:(void(^)(NSDictionary *))response
                        failure:(void (^)(NSError *))failure;

Return type: void
Callback Blocks:
(i). (void(^)(NSDictionary *response))response
Invocation: After audio video call request is sent successfully.
Response: NSDictionary containing success message
Eg:

{  
   "status"="Conference request sent successfully";
}

(ii). (void(^)(NSError *error))failure
Invocation: If an error occurs while sending audio video call request
Response: NSError containing error code and message
Usage:

[groupAVChat sendConferenceRequest:^(NSDictionary *response) {
                    } failure:^(NSError *error) {
}];

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:(void(^)(NSDictionary *response))response
             failure:(void(^)(NSError *error))failure;

Return type: void
Callback Blocks:
(i). (void(^)(NSDictionary *response))response
Invocation: After joining the audio/video conference successfully
Response: NSDictionary containing success message
Eg:

{
   "status" = "Conference joined successfully";
}

(ii). (void(^)(NSError *error))failure
Invocation: If an error occurs while sending audio/video conference request
Response: NSError containing error code and message
Usage:

[groupAVChat joinConference:^(NSDictionary *response) {
            } failure:^(NSError *error) {
}];

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 *)container
              failure:(void(^)(NSError *error))failure;

Return type: void
Callback Blocks:
(i). (void(^)(NSError *error))failure
Invocation: If an error occurs while starting audio/video conference
Response: NSError containing error code and message
Usage:

[groupAVChat startConferenceInContainer:containerView
               failure:^(NSError *error) {
}];

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:(void(^)(NSDictionary *response))response
          failure:(void(^)(NSError *error))failure;

Return type: void
Callback Blocks:
(i). (void(^)(NSDictionary *response))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). (void(^)(NSError *error))failure
Invocation: If an error occurs while ending audio/video conference request
Response: NSError containing error code and message
Usage:

[groupAVChat endConference:^(NSDictionary *response) {
               } failure:^(NSError *error) {
}];

6. Toggle Audio to ON(YES) or OFF(NO) state

- (void)toggleAudio:(BOOL)audioControlFlag;

Return type: void
Usage:

[groupAVChat toggleAudio:YES];

7. Toggle Video to ON(YES) or OFF(NO) state

- (void)toggleVideo:(BOOL)videoControlFlag;

Return type: void
Usage:

[groupAVChat toggleVideo:YES];

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!