Skip to content

Commit 4ff68a9

Browse files
authored
Merge pull request #4 from easemob/dev
Dev
2 parents 67b716d + 5593e9d commit 4ff68a9

File tree

13 files changed

+575
-207
lines changed

13 files changed

+575
-207
lines changed

Classes/Process/EaseCallManager+Private.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
-(void) enableVideo:(BOOL)aEnable;
1717
-(void) muteAudio:(BOOL)aMuted;
1818
-(void) speakeOut:(BOOL)aEnable;
19-
-(NSString*) getNicknameFromUid:(NSString*)uId;
20-
-(NSURL*) getHeadImageFromUid:(NSString*)uId;
19+
-(NSString*) getNicknameByUserName:(NSString*)aUserName;
20+
-(NSURL*) getHeadImageByUserName:(NSString*)aUserName;
21+
-(NSString*) getUserNameByUid:(NSNumber*)uId;
2122
- (void)setupLocalVideo;
2223
- (void)setupRemoteVideoView:(NSUInteger)uid;
2324
- (void)joinChannel;

Classes/Process/EaseCallManager.h

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,16 @@
4646
* @param aChannelName 呼叫使用的频道名称
4747
* @param aUserAccount 用户使用的环信账户
4848
*/
49-
- (void)callDidRequestRTCTokenForAppId:(NSString*_Nonnull)aAppId channelName:(NSString*_Nonnull)aChannelName account:(NSString*_Nonnull)aUserAccount;
49+
- (void)callDidRequestRTCTokenForAppId:(NSString*_Nonnull)aAppId channelName:(NSString*_Nonnull)aChannelName account:(NSString*_Nonnull)aUserAccount uid:(NSInteger)aAgoraUid;
50+
/**
51+
* 通话中对方加入会议时触发该回调
52+
*/
53+
-(void)remoteUserDidJoinChannel:( NSString*_Nonnull)aChannelName uid:(NSInteger)aUid username:(NSString*_Nullable)aUserName;
54+
55+
/**
56+
* 通话中自己加入会议成功时触发该回调
57+
*/
58+
- (void)callDidJoinChannel:(NSString*_Nonnull)aChannelName uid:(NSUInteger)aUid;
5059
@end
5160

5261
@interface EaseCallManager : NSObject
@@ -87,6 +96,13 @@
8796
* 设置声网频道及token
8897
* @param aToken 声网token
8998
* @param aChannelName token对应的频道名称
99+
* @param aUid 声网账户
100+
*/
101+
- (void)setRTCToken:(NSString*_Nullable)aToken channelName:(NSString*_Nonnull)aChannelName uid:(NSUInteger)aUid;
102+
/**
103+
* 设置用户环信ID与声网账户的映射表
104+
* @param aUsers 用户环信ID与声网账户的映射表
105+
* @param aChannel 对应的频道名称
90106
*/
91-
- (void)setRTCToken:(NSString*_Nullable)aToken channelName:(NSString*_Nonnull)aChannelName;
107+
- (void)setUsers:(NSDictionary<NSNumber*,NSString*>*_Nonnull)aUsers channelName:(NSString*_Nonnull)aChannel;
92108
@end

Classes/Process/EaseCallManager.m

Lines changed: 107 additions & 71 deletions
Large diffs are not rendered by default.

Classes/Store/EaseCallConfig.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
//
88

99
#import <Foundation/Foundation.h>
10+
#import <AgoraRtcKit/AgoraRtcEngineKit.h>
1011

1112
NS_ASSUME_NONNULL_BEGIN
1213
/**
@@ -21,6 +22,7 @@ NS_ASSUME_NONNULL_BEGIN
2122
* nickName 用户头像
2223
*/
2324
@property (nonatomic,strong) NSURL* _Nullable headImage;
25+
+(instancetype)userWithNickName:(NSString*)aNickName image:(NSURL*)aUrl;
2426
@end
2527

2628
// 增加铃声、标题文本、环信ID与昵称的映射
@@ -36,7 +38,7 @@ NS_ASSUME_NONNULL_BEGIN
3638
/*
3739
* users 用户信息字典,key为环信ID,value为EaseCallUser
3840
*/
39-
@property (nonatomic,strong) NSMutableDictionary* users;
41+
@property (nonatomic,strong) NSMutableDictionary<NSString*,EaseCallUser*>* users;
4042
/*
4143
* ringFileUrl 振铃文件
4244
*/
@@ -49,6 +51,13 @@ NS_ASSUME_NONNULL_BEGIN
4951
* enableRTCTokenValidate 是否开启声网token验证,默认不开启,开启后必须实现callDidRequestRTCTokenForAppId回调,并在收到回调后调用setRTCToken才能进行通话
5052
*/
5153
@property (nonatomic) BOOL enableRTCTokenValidate;
54+
/*
55+
* encoderConfiguration 声网RTC Video配置
56+
*/
57+
@property (nonatomic,strong) AgoraVideoEncoderConfiguration *encoderConfiguration;
58+
@property (nonatomic) NSUInteger* agoraUid;
59+
60+
- (void)setUser:(NSString*)aUser info:(EaseCallUser*)aInfo;
5261
@end
5362

5463
NS_ASSUME_NONNULL_END

Classes/Store/EaseCallConfig.m

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@ - (instancetype)init
2121
}
2222
return self;
2323
}
24+
+(instancetype)userWithNickName:(NSString*)aNickName image:(NSURL*)aUrl
25+
{
26+
EaseCallUser* user = [[EaseCallUser alloc] init];
27+
if(aNickName.length > 0)
28+
user.nickName = aNickName;
29+
if(aUrl && aUrl.absoluteString.length > 0)
30+
user.headImage = aUrl;
31+
return user;
32+
}
2433
@end
2534

2635
@interface EaseCallConfig ()
@@ -53,4 +62,29 @@ - (void)_initParams
5362
_agoraAppId = @"15cb0d28b87b425ea613fc46f7c9f974";
5463
}
5564

65+
- (AgoraVideoEncoderConfiguration*)encoderConfiguration
66+
{
67+
if(!_encoderConfiguration) {
68+
_encoderConfiguration = [[AgoraVideoEncoderConfiguration alloc] initWithSize:AgoraVideoDimension640x360
69+
frameRate:AgoraVideoFrameRateFps15
70+
bitrate:AgoraVideoBitrateStandard
71+
orientationMode:AgoraVideoOutputOrientationModeAdaptative];
72+
}
73+
return _encoderConfiguration;
74+
}
75+
76+
- (void)setUsers:(NSMutableDictionary<NSString *,EaseCallUser *> *)users
77+
{
78+
_users = [users mutableCopy];
79+
[[NSNotificationCenter defaultCenter] postNotificationName:@"EaseCallUserUpdated" object:nil];
80+
}
81+
82+
- (void)setUser:(NSString*)aUser info:(EaseCallUser*)aInfo
83+
{
84+
if(aUser.length > 0 && aInfo) {
85+
[self.users setObject:aInfo forKey:aUser];
86+
[[NSNotificationCenter defaultCenter] postNotificationName:@"EaseCallUserUpdated" object:nil];
87+
}
88+
}
89+
5690
@end

Classes/Store/EaseCallModal.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,8 @@ NS_ASSUME_NONNULL_BEGIN
4040
@property (nonatomic) BOOL isCaller;
4141
// 自己在频道中的声网ID
4242
@property (nonatomic) NSInteger uid;
43-
// 多人通话使用,会议中的人员使用的声网账户
44-
@property (nonatomic,strong) NSMutableDictionary* remoteUsers;
45-
// 多人通话使用,会议中的人员使用的环信ID
46-
@property (nonatomic,strong) NSMutableArray* remoteUserAccounts;
47-
// 单人通话使用,对方的声网账户
48-
@property (nonatomic,strong) AgoraUserInfo* remoteUserInfo;
43+
// 多人通话使用,会议中的人员使用的声网uid与环信id映射表<声网uid,环信ID>
44+
@property (nonatomic,strong) NSMutableDictionary<NSNumber*,NSString*>* allUserAccounts;
4945
// 频道名称
5046
@property (nonatomic,strong) NSString* channelName;
5147
// 扩展字段
@@ -65,6 +61,10 @@ NS_ASSUME_NONNULL_BEGIN
6561
@property (nonatomic,strong) NSString* agoraRTCToken;
6662
// 通话的呼叫状态
6763
@property (nonatomic) EaseCallState state;
64+
// 自己是否加入频道成功
65+
@property (nonatomic) BOOL hasJoinedChannel;
66+
// 使用的声网uid
67+
@property (nonatomic) NSInteger agoraUid;
6868

6969
- (instancetype)initWithDelegate:(id<EaseCallModalDelegate>)delegate;
7070

Classes/Store/EaseCallModal.m

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,13 @@
99
#import "EaseCallModal.h"
1010

1111
@implementation ECCall
12-
- (NSMutableDictionary*)remoteUsers
13-
{
14-
if(!_remoteUsers) {
15-
_remoteUsers = [NSMutableDictionary dictionary];
16-
}
17-
return _remoteUsers;
18-
}
19-
- (NSMutableArray*)remoteUserAccounts
12+
13+
- (NSMutableDictionary*)allUserAccounts
2014
{
21-
if(!_remoteUserAccounts) {
22-
_remoteUserAccounts = [NSMutableArray array];
15+
if(!_allUserAccounts) {
16+
_allUserAccounts = [NSMutableDictionary dictionary];
2317
}
24-
return _remoteUserAccounts;
18+
return _allUserAccounts;
2519
}
2620
@end
2721

@@ -37,6 +31,7 @@ - (instancetype)initWithDelegate:(id<EaseCallModalDelegate>)delegate
3731
if(self) {
3832
self.delegate = delegate;
3933
self.currentCall = nil;
34+
self.hasJoinedChannel = NO;
4035
}
4136
return self;
4237
}

Classes/ViewController/EaseCallBaseViewController.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ NS_ASSUME_NONNULL_BEGIN
2929
@property (nonatomic,strong) UILabel* hangupLabel;
3030
@property (nonatomic,strong) UILabel* acceptLabel;
3131
@property (nonatomic,strong) UIButton* miniButton;
32+
@property (nonatomic,strong) UIView* contentView;
3233
@property (nonatomic) EaseCallStreamView* floatingView;
3334
@property (nonatomic) BOOL isMini;
3435

@@ -38,6 +39,7 @@ NS_ASSUME_NONNULL_BEGIN
3839
- (void)startTimer;
3940
- (void)answerAction;
4041
- (void)miniAction;
42+
- (void)usersInfoUpdated;
4143
@end
4244

4345
NS_ASSUME_NONNULL_END

0 commit comments

Comments
 (0)