Audio/Video Broadcast

The Methods below are available for Video Broadcast:

Method Description
sendAVBroadcastRequestToUser Allows logged-in user to initiate a video Broadcast
startAVBroadcastWithInitiator Starts the Video Broadcast in a provided UI container
inviteUser Invite Other users to view a video Broadcast
endAVBroadcastWithUser 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

sendAVBroadcastRequestToUser

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

- (void)sendAVBroadcastRequestToUser:(NSString *)userID
                             isGroup:(BOOL)isGroup
                             success:(void (^)(NSDictionary *response))response
                             failure:(void (^)(NSError *error))failure;

Example:

[cometChat sendAVBroadcastRequestToUser:@"15" isGroup:NO success:^(NSDictionary *response) {
    /* Code Block */
} failure:^(NSError *error) {
    /* Code Block */
}];

Arguments:

Argument Description
userID userId of a viewer
isGroup set isGroup to yes if AV Broadcast is initiated in groups
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

startAVBroadcastWithInitiator

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

- (void)startAVBroadcastWithInitiator:(BOOL)initiator
                               callID:(NSString *)callID
                        containerView:(UIView *)container
                        connectedUser:(void (^)(NSDictionary *response))response
                   changeInAudioRoute:(void (^)(NSDictionary *route))audioRouteInformation
                              failure:(void (^)(NSError *error))failure;

Example:

[cometChat startAVBroadcastWithInitiator:YES callID:@"bf1e7055f8e15d6f8662c7c4b6f8adb9" containerView:self connectedUser:^(NSDictionary *response) {
    /* Code Block */
} changeInAudioRoute:^(NSDictionary *route) {
    /* Code Block */
} failure:^(NSError *error) {
    /* Code Block */
}];

Arguments:

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

inviteUser

Invite Other users to view a video Broadcast Method Signature:

- (void)inviteUser:(NSString *)userID
            callID:(NSString *)callID
           success:(void (^)(NSDictionary *response))response
           failure:(void (^)(NSError *error))failure;

Example:

NSString *invitearray = @"1,2,3,4";
[cometChat inviteUser:invitearray callID:@"" success:^(NSDictionary *response) {
    /* Code Block */
} failure:^(NSError *error) {
    /* Code Block */
}];

Arguments:

Argument Description
userID String 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:

- (void)endAVBroadcastWithUser:(BOOL)initiator
                        userID:(NSString *)userID
                        callID:(NSString *)callID
                       success:(void (^)(NSDictionary *response))response
                       failure:(void (^)(NSError *error))failure;

Example:

[cometChat endAVBroadcastWithUser:YES userID:@"15" callID:@"bf1e7055f8e15d6f8662c7c4b6f8adb9" success:^(NSDictionary *response) {
    /* Code Block */
} failure:^(NSError *error) {
    /* Code Block */
}];

Arguments:

Argument Description
initiator Set Yes if you were the initiator of Broadcast else set to No
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:

- (void)toggleAudioSDK:(BOOL)audioControlFlag;

Example:

[cometChat toggleAudioSDK:YES];

Arguments:

Argument Description
audioControlFlag turn audio on/off

switchSpeakers

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

- (void)switchAudioRouteSDK;

Example:

[cometChat switchAudioRouteSDK];

pauseVideo

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

- (void)toggleVideoSDK:(BOOL)videoControlFlag;

Example:

[cometChat toggleVideoSDK:YES];

Arguments:

Argument Description
videoControlFlag turn video on/off

toggleCamera

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

- (void)switchCameraSDK;

Example:

[cometChat switchCameraSDK];

  • Was this helpful?
  • Yes   No