Skip to content

Commit

Permalink
Merge pull request #11 from lixm1988/main
Browse files Browse the repository at this point in the history
1. upgrade rtc version to 4.1.1
  • Loading branch information
lixm1988 authored Mar 8, 2023
2 parents bffa49d + 5d9e3b6 commit 20ae552
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 38 deletions.
4 changes: 2 additions & 2 deletions AgoraChatCallKit.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'AgoraChatCallKit'
s.version = '1.0.9'
s.version = '1.1.0'
s.summary = 'A AgoraChat Call UIKit'
s.description = <<-DESC
‘‘AgoraChatCallKit is a UI library that implements audio and video calls by using Agora Chat and Agora RTC. Using this SDK, you can make one-to-one audio and video calls and multi-party audio and video calls.’’
Expand Down Expand Up @@ -30,7 +30,7 @@ Pod::Spec.new do |s|
}
s.dependency 'Agora_Chat_iOS'
s.dependency 'Masonry'
s.dependency 'AgoraRtcEngine_iOS/RtcBasic','~> 3.6.3'
s.dependency 'AgoraRtcEngine_iOS/RtcBasic','~> 4.1.1'
s.dependency 'SDWebImage'

s.pod_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64',
Expand Down
6 changes: 2 additions & 4 deletions Classes/Process/AgoraChatCallManager+CallKit.m
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ - (void)reportNewIncomingCall:(AgoraChatCall *)call

callKitCurrentCallUUID = [NSUUID UUID];
[self.provider reportNewIncomingCallWithUUID:callKitCurrentCallUUID update:update completion:^(NSError * _Nullable error) {
NSLog(@"%@", error);
}];
}

Expand Down Expand Up @@ -166,14 +165,14 @@ - (void)pushRegistry:(PKPushRegistry *)registry didUpdatePushCredentials:(PKPush
{
[AgoraChatClient.sharedClient registerPushKitToken:pushCredentials.token completion:^(AgoraChatError *aError) {
if (aError) {
NSLog(@"AgoraChatClient registerPushKitToken error: %@", aError.description);
[AgoraChatClient.sharedClient log:[NSString stringWithFormat:@"AgoraChatClient registerPushKitToken error: %@", aError.description]];
}
}];
}

- (void)pushRegistry:(PKPushRegistry *)registry didInvalidatePushTokenForType:(PKPushType)type
{
NSLog(@"PushKit %s type=%d", __FUNCTION__, type);
[AgoraChatClient.sharedClient log:[NSString stringWithFormat:@"PushKit %s type=%d", __FUNCTION__, type]];
}

- (void)pushRegistry:(PKPushRegistry *)registry didReceiveIncomingPushWithPayload:(PKPushPayload *)payload forType:(PKPushType)type withCompletionHandler:(void (^)(void))completion
Expand Down Expand Up @@ -203,7 +202,6 @@ - (void)pushRegistry:(PKPushRegistry *)registry didReceiveIncomingPushWithPayloa

callKitCurrentCallUUID = NSUUID.UUID;
[self.provider reportNewIncomingCallWithUUID:callKitCurrentCallUUID update:update completion:^(NSError * _Nullable error) {
NSLog(@"%@", error);
}];
completion();
}
Expand Down
52 changes: 26 additions & 26 deletions Classes/Process/AgoraChatCallManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ - (void)initWithConfig:(AgoraChatCallConfig *)aConfig delegate:(id<AgoraChatCall
self.agoraKit = [AgoraRtcEngineKit sharedEngineWithAppId:self.config.agoraAppId delegate:self];
[self.agoraKit setChannelProfile:AgoraChannelProfileLiveBroadcasting];
[self.agoraKit setClientRole:AgoraClientRoleBroadcaster];
[self.agoraKit enableAudioVolumeIndication:1000 smooth:5 report_vad:NO];
[self.agoraKit enableAudioVolumeIndication:1000 smooth:5 reportVad:NO];

AgoraCameraCapturerConfiguration *cameraConfig = [[AgoraCameraCapturerConfiguration alloc] init];
cameraConfig.cameraDirection = AgoraCameraDirectionFront;
Expand Down Expand Up @@ -184,7 +184,7 @@ - (NSMutableDictionary*)alertTimerDic

- (void)startInviteUsers:(NSArray<NSString *> *)aUsers groupId:(NSString *)groupId callType:(AgoraChatCallType)callType ext:(NSDictionary *)aExt completion:(void(^)(NSString *callId, AgoraChatCallError *))aCompletionBlock {
if (aUsers.count == 0) {
NSLog(@"InviteUsers faild!!remoteUid is empty");
[AgoraChatClient.sharedClient log:@"InviteUsers faild!!remoteUid is empty"];
if (aCompletionBlock) {
AgoraChatCallError *error = [AgoraChatCallError errorWithType:AgoarChatCallErrorTypeProcess code:AgoraChatCallProcessErrorCodeInvalidParams description:@"Require remoteUid"];
aCompletionBlock(nil,error);
Expand All @@ -196,7 +196,7 @@ - (void)startInviteUsers:(NSArray<NSString *> *)aUsers groupId:(NSString *)group
__weak typeof(self) weakself = self;
dispatch_async(weakself.workQueue, ^{
if (weakself.modal.currentCall && weakself.callVC) {
NSLog(@"inviteUsers in group");
[AgoraChatClient.sharedClient log:@"inviteUsers in group"];
NSArray<NSString *> *joinedUsernameList = [self getJoinedUsernameList];

for (NSString *uId in aUsers) {
Expand Down Expand Up @@ -241,7 +241,7 @@ - (void)startInviteUsers:(NSArray<NSString *> *)aUsers groupId:(NSString *)group

- (void)startSingleCallWithUId:(NSString*)uId type:(AgoraChatCallType)aType ext:(NSDictionary*)aExt completion:(void (^)(NSString* callId,AgoraChatCallError*))aCompletionBlock {
if (uId.length <= 0) {
NSLog(@"makeCall faild!!remoteUid is empty");
[AgoraChatClient.sharedClient log:@"makeCall faild!!remoteUid is empty"];
if (aCompletionBlock) {
AgoraChatCallError *error = [AgoraChatCallError errorWithType:AgoarChatCallErrorTypeProcess code:AgoraChatCallProcessErrorCodeInvalidParams description:@"Require remoteUid"];
aCompletionBlock(nil,error);
Expand All @@ -254,7 +254,7 @@ - (void)startSingleCallWithUId:(NSString*)uId type:(AgoraChatCallType)aType ext:
dispatch_async(weakself.workQueue, ^{
AgoraChatCallError * error = nil;
if ([self isBusy]) {
NSLog(@"makeCall faild!!current is busy");
[AgoraChatClient.sharedClient log:@"makeCall faild!!current is busy"];
if (aCompletionBlock) {
error = [AgoraChatCallError errorWithType:AgoarChatCallErrorTypeProcess code:AgoraChatCallProcessErrorCodeBusy description:@"current is busy "];
aCompletionBlock(nil,error);
Expand Down Expand Up @@ -294,11 +294,11 @@ - (void)clearRes

- (void)clearResWithViewController:(BOOL)withViewController
{
NSLog(@"cleraRes");
[AgoraChatClient.sharedClient log:@"cleraRes"];
dispatch_async(self.workQueue, ^{
self.modal.hasJoinedChannel = NO;
[self.agoraKit leaveChannel:^(AgoraChannelStats * _Nonnull stat) {
NSLog(@"leaveChannel");
[AgoraChatClient.sharedClient log:@"leaveChannel"];
//[[EMClient sharedClient] log:@"leaveChannel"];
}];
});
Expand All @@ -315,7 +315,7 @@ - (void)clearResWithViewController:(BOOL)withViewController
self.callVC = nil;
}
}
NSLog(@"invite timer count:%lu",(unsigned long)self.callTimerDic.count);
[AgoraChatClient.sharedClient log:[NSString stringWithFormat:@"invite timer count:%lu",(unsigned long)self.callTimerDic.count]];
NSArray *timers = [self.callTimerDic allValues];
for (NSTimer *tm in timers) {
[tm invalidate];
Expand Down Expand Up @@ -448,7 +448,7 @@ - (AgoraChatCallMultiViewController*)getMultiVC
#pragma mark - AgoraChatCallModalDelegate
- (void)callStateWillChangeTo:(AgoraChatCallState)newState from:(AgoraChatCallState)preState
{
NSLog(@"callState will chageto:%ld from:%ld",newState,(long)preState);
[AgoraChatClient.sharedClient log:[NSString stringWithFormat:@"callState will chageto:%ld from:%ld",newState,(long)preState]];
dispatch_async(dispatch_get_main_queue(), ^{
self.callVC.callState = newState;
switch (newState) {
Expand Down Expand Up @@ -958,7 +958,7 @@ - (void)_startCallTimer:(NSString*)aRemoteUser
dispatch_async(dispatch_get_main_queue(), ^{
if([weakself.callTimerDic objectForKey:aRemoteUser])
return;
NSLog(@"_startCallTimer,user:%@",aRemoteUser);
[AgoraChatClient.sharedClient log:[NSString stringWithFormat:@"_startCallTimer,user:%@",aRemoteUser]];
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:self.config.callTimeOut target:weakself selector:@selector(_timeoutCall:) userInfo:aRemoteUser repeats:NO];
[weakself.callTimerDic setObject:timer forKey:aRemoteUser];
});
Expand All @@ -970,7 +970,7 @@ - (void)_stopCallTimer:(NSString*)aRemoteUser
dispatch_async(dispatch_get_main_queue(), ^{
NSTimer *tm = [weakself.callTimerDic objectForKey:aRemoteUser];
if (tm) {
NSLog(@"stopCallTimer:%@",aRemoteUser);
[AgoraChatClient.sharedClient log:[NSString stringWithFormat:@"stopCallTimer:%@",aRemoteUser]];
[tm invalidate];
[weakself.callTimerDic removeObjectForKey:aRemoteUser];
}
Expand All @@ -980,7 +980,7 @@ - (void)_stopCallTimer:(NSString*)aRemoteUser
- (void)_timeoutCall:(NSTimer*)timer
{
NSString *aRemoteUser = (NSString*)[timer userInfo];
NSLog(@"_timeoutCall,user:%@",aRemoteUser);
[AgoraChatClient.sharedClient log:[NSString stringWithFormat:@"_timeoutCall,user:%@",aRemoteUser]];
[self.callTimerDic removeObjectForKey:aRemoteUser];
[self sendCancelCallMsgToCallee:aRemoteUser callId:self.modal.currentCall.callId];
if (self.modal.currentCall.callType != AgoraChatCallTypeMultiVideo && self.modal.currentCall.callType != AgoraChatCallTypeMultiAudio) {
Expand All @@ -996,7 +996,7 @@ - (void)_timeoutCall:(NSTimer*)timer

- (void)_startAlertTimer:(NSString*)callId
{
NSLog(@"_startAlertTimer,callId:%@",callId);
[AgoraChatClient.sharedClient log:[NSString stringWithFormat:@"_startAlertTimer,callId:%@",callId]];
__weak typeof(self) weakself = self;
dispatch_async(dispatch_get_main_queue(), ^{
NSTimer *tm = [NSTimer scheduledTimerWithTimeInterval:10.0 target:self selector:@selector(_timeoutAlert:) userInfo:callId repeats:NO];
Expand All @@ -1006,7 +1006,7 @@ - (void)_startAlertTimer:(NSString*)callId

- (void)_stopAlertTimer:(NSString*)callId
{
NSLog(@"_stopAlertTimer,callId:%@",callId);
[AgoraChatClient.sharedClient log:[NSString stringWithFormat:@"_stopAlertTimer,callId:%@",callId]];
__weak typeof(self) weakself = self;
dispatch_async(dispatch_get_main_queue(), ^{
NSTimer *tm = [weakself.alertTimerDic objectForKey:callId];
Expand All @@ -1019,7 +1019,7 @@ - (void)_stopAlertTimer:(NSString*)callId

- (void)_stopAllAlertTimer
{
NSLog(@"_stopAllAlertTimer");
[AgoraChatClient.sharedClient log:@"_stopAllAlertTimer"];
__weak typeof(self) weakself = self;
dispatch_async(dispatch_get_main_queue(), ^{
NSArray *tms = [weakself.alertTimerDic allValues];
Expand All @@ -1033,7 +1033,7 @@ - (void)_stopAllAlertTimer
- (void)_timeoutAlert:(NSTimer*)tm
{
NSString* callId = (NSString*)[tm userInfo];
NSLog(@"_timeoutAlert,callId:%@",callId);
[AgoraChatClient.sharedClient log:[NSString stringWithFormat:@"_timeoutAlert,callId:%@",callId]];
[self.alertTimerDic removeObjectForKey:callId];
}

Expand Down Expand Up @@ -1062,7 +1062,7 @@ - (void)_stopConfirmTimer:(NSString*)callId
- (void)_timeoutConfirm:(NSTimer*)tm
{
NSString *callId = (NSString*)[tm userInfo];
NSLog(@"_timeoutConfirm,callId:%@",callId);
[AgoraChatClient.sharedClient log:[NSString stringWithFormat:@"_timeoutConfirm,callId:%@",callId]];
if (self.modal.currentCall && [self.modal.currentCall.callId isEqualToString:callId]) {
[self callBackCallEnd:AgoraChatCallEndReasonNoResponse];
self.modal.state = AgoraChatCallState_Idle;
Expand Down Expand Up @@ -1094,7 +1094,7 @@ - (void)_stopRingTimer
- (void)_timeoutRing:(NSTimer*)tm
{
NSString *callId = (NSString*)[tm userInfo];
NSLog(@"_timeoutConfirm,callId:%@",callId);
[AgoraChatClient.sharedClient log:[NSString stringWithFormat:@"_timeoutConfirm,callId:%@",callId]];
[self stopSound];
if (self.modal.currentCall && [self.modal.currentCall.callId isEqualToString:callId]) {
[self callBackCallEnd:AgoraChatCallEndReasonNoResponse];
Expand Down Expand Up @@ -1137,7 +1137,7 @@ - (void)stopSound
#pragma mark - AgoraRtcEngineKitDelegate
- (void)rtcEngine:(AgoraRtcEngineKit *)engine didOccurError:(AgoraErrorCode)errorCode
{
NSLog(@"rtcEngine didOccurError:%ld",(long)errorCode);
[AgoraChatClient.sharedClient log:[NSString stringWithFormat:@"rtcEngine didOccurError:%ld",(long)errorCode]];
if (errorCode == AgoraErrorCodeTokenExpired || errorCode == AgoraErrorCodeInvalidToken) {
self.modal.state = AgoraChatCallState_Idle;
[self callBackError:AgoarChatCallErrorTypeRTC code:errorCode description:@"RTC Error"];
Expand All @@ -1157,7 +1157,7 @@ - (void)rtcEngine:(AgoraRtcEngineKit *)engine remoteAudioStats:(AgoraRtcRemoteAu
// 加入频道成功
- (void)rtcEngine:(AgoraRtcEngineKit *)engine didJoinChannel:(NSString *)channel withUid:(NSUInteger)uid elapsed:(NSInteger)elapsed
{
NSLog(@"join channel success!!! channel:%@,uid:%lu",channel,(unsigned long)uid);
[AgoraChatClient.sharedClient log:[NSString stringWithFormat:@"join channel success!!! channel:%@,uid:%lu",channel,(unsigned long)uid]];
}

// 注册账户成功
Expand Down Expand Up @@ -1245,12 +1245,12 @@ - (void)rtcEngine:(AgoraRtcEngineKit *)engine firstRemoteVideoDecodedOfUid:(NSUI

- (void)rtcEngine:(AgoraRtcEngineKit *)engine firstRemoteAudioFrameOfUid:(NSUInteger)uid elapsed:(NSInteger)elapsed
{
NSLog(@"firstRemoteAudioFrameOfUid:%lu",(unsigned long)uid);
[AgoraChatClient.sharedClient log:[NSString stringWithFormat:@"firstRemoteAudioFrameOfUid:%lu",(unsigned long)uid]];
}

- (void)rtcEngine:(AgoraRtcEngineKit *)engine remoteVideoStateChangedOfUid:(NSUInteger)uid state:(AgoraVideoRemoteState)state reason:(AgoraVideoRemoteStateReason)reason elapsed:(NSInteger)elapsed
- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine remoteVideoStateChangedOfUid:(NSUInteger)uid state:(AgoraVideoRemoteState)state reason:(AgoraVideoRemoteReason)reason elapsed:(NSInteger)elapsed
{
NSLog(@"remoteVideoStateChangedOfUid uid:%d staate:%d,reason:%d", uid, state,reason);
[AgoraChatClient.sharedClient log:[NSString stringWithFormat:@"remoteVideoStateChangedOfUid uid:%d staate:%d,reason:%d", uid, state,reason]];
// if (reason == AgoraVideoRemoteStateReasonRemoteMuted && self.modal.currentCall.callType == AgoraChatCallType1v1Video) {
// __weak typeof(self) weakself = self;
// dispatch_async(dispatch_get_main_queue(), ^{
Expand Down Expand Up @@ -1306,7 +1306,7 @@ - (void)fetchToken {
self.modal.agoraUid = arc4random();
[self.delegate callDidRequestRTCTokenForAppId:self.config.agoraAppId channelName:self.modal.currentCall.channelName account:AgoraChatClient.sharedClient.currentUsername uid:self.config.agoraUid];
} else {
NSLog(@"Warning: You have not implement interface callDidRequestRTCTokenForAppId:channelName:account:!!!!");
[AgoraChatClient.sharedClient log:[NSString stringWithFormat:@"Warning: You have not implement interface callDidRequestRTCTokenForAppId:channelName:account:!!!!"]];
}
} else {
[self setRTCToken:nil channelName:self.modal.currentCall.channelName uid:arc4random()];
Expand All @@ -1320,7 +1320,7 @@ @implementation AgoraChatCallManager (Private)

- (void)hangupAction
{
NSLog(@"hangupAction,curState:%ld", (long)self.modal.state);
[AgoraChatClient.sharedClient log:[NSString stringWithFormat:@"hangupAction,curState:%ld", (long)self.modal.state]];
if (self.modal.state == AgoraChatCallState_Answering) {
// 正常挂断
if (self.modal.currentCall.callType == AgoraChatCallTypeMultiVideo || self.modal.currentCall.callType == AgoraChatCallTypeMultiAudio) {
Expand Down Expand Up @@ -1477,7 +1477,7 @@ - (void)joinChannel
[weakself.agoraKit leaveChannel:nil];
}
[weakself.agoraKit joinChannelByToken:weakself.modal.agoraRTCToken channelId:weakself.modal.currentCall.channelName info:@"" uid:self.modal.agoraUid joinSuccess:^(NSString * _Nonnull channel, NSUInteger uid, NSInteger elapsed) {
NSLog(@"join success");
[AgoraChatClient.sharedClient log:@"join success"];
if ([weakself.delegate respondsToSelector:@selector(callDidJoinChannel:uid:)]) {
[weakself.delegate callDidJoinChannel:channel uid:uid];
}
Expand Down
6 changes: 1 addition & 5 deletions Classes/Store/AgoraChatCallConfig.m
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,7 @@ - (void)_initParams
- (AgoraVideoEncoderConfiguration*)encoderConfiguration
{
if(!_encoderConfiguration) {
_encoderConfiguration = [[AgoraVideoEncoderConfiguration alloc]
initWithSize:AgoraVideoDimension640x360
frameRate:AgoraVideoFrameRateFps15
bitrate:AgoraVideoBitrateStandard
orientationMode:AgoraVideoOutputOrientationModeAdaptative];
_encoderConfiguration = [[AgoraVideoEncoderConfiguration alloc] initWithSize:AgoraVideoDimension640x360 frameRate:AgoraVideoFrameRateFps15 bitrate:AgoraVideoBitrateStandard orientationMode:AgoraVideoOutputOrientationModeAdaptative mirrorMode:AgoraVideoMirrorModeAuto];
}
return _encoderConfiguration;
}
Expand Down
1 change: 0 additions & 1 deletion Classes/ViewController/AgoraChatCallBaseViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,6 @@ - (void)enableVideoAction
{
self.enableCameraButton.selected = !self.enableCameraButton.isSelected;
int state = [AgoraChatCallManager.sharedManager muteLocalVideoStream:self.enableCameraButton.selected];
NSLog(@"%d", state);
}

- (void)miniAction
Expand Down

0 comments on commit 20ae552

Please sign in to comment.