To add Audio/Video Group Conference support in your application,
Include the class <MessageSDKFramework/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 conference request to all the users of particular chatroom. (Specify chatroomID and chatroomID cannot be nil or empty)
- (void)sendConferenceRequest:(NSString *)chatroomID
success:(void (^)(NSDictionary *))success
failure:(void (^)(NSError *))failure;
Return type: void
Callback Blocks:
(i). (void(^)(NSDictionary *response))response
Invocation: After audio/video conference request is sent successfully.
Response: NSDictionary containing success message
Eg:
{
callID = ec6a50f23eed63dc4cd1bf1498d9c4aa;
chatroomid = 5;
status = "Conference request sent 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 sendConferenceRequest:@"5" success:^(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. (Ensure that callID specified should be same as the callID received in HAS STARTED A VIDEO CONVERSATION message and also callID cannot be nil or empty)
- (void)joinConference:(NSString *)callID
success:(void (^)(NSDictionary *response))success
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 joining audio/video conference.
Response: NSError containing error code and message
Usage:
[groupAVChat joinConference:@"ec6a50f23eed63dc4cd1bf1498d9c4aa" success:^(NSDictionary *response) {
} failure:^(NSError *error) {
}];
4. Start Audio/Video call
Once you have sent the request for conference or made join conference request successfully then you can start the conference. Start a conference call within the container view. (Ensure that callID specified here should be the same while sending/accepting a conference request and also callID cannot be nil or empty)
- (void)startConferenceInContainer:(NSString *)callID
containerView:(UIView *)container
changeInAudioRoute:(void(^)(NSDictionary *audioRouteInformation))audioRouteInformation
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:@"ec6a50f23eed63dc4cd1bf1498d9c4aa" containerView:containerView changeInAudioRoute:^(NSDictionary *audioRouteInformation) {
} failure:^(NSError *error) {
}];
5. End/Leave conference call
You can leave the conference by calling endConference() function. The conference will end when all the members leave the conference. Specify chatroomID & callID. (Ensure that callID specified should be same as given when starting the audio-video call and also callID cannot be nil or empty)
- (void)endConference:(NSString *)chatroomID
callID:(NSString *)callID
success:(void (^)(NSDictionary *response))success
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 success message.
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:@"5" callID:@"ec6a50f23eed63dc4cd1bf1498d9c4aa" success:^(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!