Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 28 additions & 8 deletions Classes/Process/EaseCallManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,26 +50,46 @@
/**
* 通话中对方加入会议时触发该回调
*/
-(void)remoteUserDidJoinChannel:( NSString*_Nonnull)aChannelName uid:(NSInteger)aUid username:(NSString*_Nullable)aUserName;
-(void)remoteUserDidJoinChannel:( NSString*_Nonnull)channel_id
agora_uid:(NSInteger)agora_uid
im_username:(NSString*_Nullable)im_username;

//下面两个回调二选一,具体需要根据加入音视频通道的方式来定
//下面两个回调二选一,具体需要根据加入音视频通道的方式来定
//下面两个回调二选一,具体需要根据加入音视频通道的方式来定
/**
* 通话中自己加入会议成功时触发该回调
* ⚠️通话中自己加入会议成功时触发该回调
*/
- (void)callDidJoinChannel:(NSString*_Nonnull)aChannelName uid:(NSUInteger)aUid;
- (void)callDidJoinChannel:(NSString*_Nonnull)channel_id
agora_uid:(NSUInteger)agora_uid;

/**
* ⚠️通话中自己加入会议成功时触发该回调(携带username) 只能使用im_username加入通道才会执行这个方法
*/
- (void)callDidJoinChannel:(NSString*_Nonnull)channel_id
agora_uid:(NSUInteger)agora_uid
im_username:(NSString *_Nonnull)im_username;

@end

@interface EaseCallManager : NSObject
+(instancetype _Nonnull ) alloc __attribute__((unavailable("call sharedManager instead")));
+(instancetype _Nonnull ) new __attribute__((unavailable("call sharedManager instead")));
-(instancetype _Nonnull ) copy __attribute__((unavailable("call sharedManager instead")));
-(instancetype _Nonnull ) mutableCopy __attribute__((unavailable("call sharedManager instead")));
+ (instancetype _Nonnull ) alloc __attribute__((unavailable("call sharedManager instead")));
+ (instancetype _Nonnull ) new __attribute__((unavailable("call sharedManager instead")));
- (instancetype _Nonnull ) copy __attribute__((unavailable("call sharedManager instead")));
- (instancetype _Nonnull ) mutableCopy __attribute__((unavailable("call sharedManager instead")));
+ (instancetype _Nonnull )sharedManager;
/**
* EaseCall模块初始化
* @param aConfig EaseCall的配置,包括用户昵称、头像、呼叫超时时间等
* @param aDelegate 回调监听
*/
- (void)initWithConfig:(EaseCallConfig*_Nullable)aConfig delegate:(id<EaseCallDelegate>_Nullable)aDelegate;
- (void)initWithConfig:(EaseCallConfig *_Nullable)aConfig delegate:(id<EaseCallDelegate>_Nullable)aDelegate;

/**
* EaseCall模块重置,切换账号使用
*/
- (void)reset:(NSString *_Nonnull)im_username;

/**
* 邀请成员进行单人通话
* @param uId 被邀请人的环信ID
Expand Down
961 changes: 460 additions & 501 deletions Classes/Process/EaseCallManager.m

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions Classes/Process/entities/EaseCallEventInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,12 @@ NS_ASSUME_NONNULL_BEGIN
*/
@property(nonatomic)bool toAudio;

//消息 from to type ...
@property(nonatomic,copy)NSString *from;
@property(nonatomic)EMChatType chat_type;
@property(nonatomic,copy)NSString *conversation_id;
@property(nonatomic,copy)NSString *to;

/**
isEffective
status
Expand Down
5 changes: 5 additions & 0 deletions Classes/Process/entities/EaseCallEventInfo.m
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ + (instancetype)infoWithMessage:(EMChatMessage *)message{
if (!info.call_id.length){
return nil;
}

info.chat_type = message.chatType;
info.conversation_id = message.conversationId;
info.from = message.from;
info.to = message.to;
return info;
}
//+ (EaseCallEventType)callEventTypeFromString:(NSString *)value;
Expand Down
11 changes: 11 additions & 0 deletions Classes/Store/EaseCallConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,17 @@ NS_ASSUME_NONNULL_BEGIN
*/
@property (nonatomic)bool enableOutputLog;

/*
* useIMUsernameJoinChannel 使用环信username加入通道
*/
@property (nonatomic)bool useIMUsernameJoinChannel;

/*
* em_username 环信的im username
*/
@property (nonatomic,copy)NSString *im_username;


- (void)setUser:(NSString*)aUser info:(EaseCallUser*)aInfo;
@end

Expand Down
11 changes: 11 additions & 0 deletions Classes/Store/EaseCallModal.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,17 @@ NS_ASSUME_NONNULL_BEGIN
// 使用的声网uid
@property (nonatomic) NSInteger agoraUid;












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

@end
Expand Down
49 changes: 33 additions & 16 deletions Classes/ViewController/EaseCallBaseViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,11 @@ - (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
[self setubSubViews];

self.speakerButton.selected = YES;
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(usersInfoUpdated) name:@"EaseCallUserUpdated" object:nil];
}

- (void)dealloc
{
- (void)dealloc{
[[NSNotificationCenter defaultCenter] removeObserver:self];
}

Expand All @@ -44,41 +42,60 @@ - (void)setubSubViews
[self.view addSubview:self.contentView];

[self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
if (@available(iOS 11,*)) {
make.top.equalTo(self.view.mas_safeAreaLayoutGuideTop);
make.left.equalTo(self.view.mas_safeAreaLayoutGuideLeft);
make.right.equalTo(self.view.mas_safeAreaLayoutGuideRight);
make.bottom.equalTo(self.view.mas_safeAreaLayoutGuideBottom);
}else {
make.edges.equalTo(self.view);
}

make.edges.equalTo(self.view);
// if (@available(iOS 11,*)) {
// make.top.equalTo(self.view.mas_safeAreaLayoutGuideTop);
// make.left.equalTo(self.view.mas_safeAreaLayoutGuideLeft);
// make.right.equalTo(self.view.mas_safeAreaLayoutGuideRight);
// make.bottom.equalTo(self.view.mas_safeAreaLayoutGuideBottom);
// }else {
// make.edges.equalTo(self.view);
// }
}];





self.miniButton = [[UIButton alloc] init];
self.miniButton.imageView.contentMode = UIViewContentModeScaleAspectFit;
[self.miniButton setImage:[UIImage imageNamedFromBundle:@"mini"] forState:UIControlStateNormal];
[self.miniButton addTarget:self action:@selector(miniAction) forControlEvents:UIControlEventTouchUpInside];
[self.contentView addSubview:self.miniButton];
[self.miniButton setTintColor:[UIColor whiteColor]];
[self.miniButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.contentView);
make.left.equalTo(@10);
make.width.height.equalTo(@40);
make.top.equalTo(self.view.mas_safeAreaLayoutGuideTop);
make.left.equalTo(@8);
make.width.height.equalTo(@44);
}];

// UIStackView *hstack = UIStackView.new;
// hstack.axis = UILayoutConstraintAxisHorizontal;
// hstack.alignment = UIStackViewAlignmentCenter;
//// hstack.description = UIStackViewDistributionEqualSpacing;
// [self.contentView addSubview:hstack];
// [hstack mas_makeConstraints:^(MASConstraintMaker *make) {
// make.left.mas_equalTo(32);
// make.right.mas_equalTo(-32);
// make.height.mas_equalTo(60);
// make.bottom.mas_equalTo(self.contentView.mas_safeAreaLayoutGuideBottom).offset(-30);
// }];
// hstack.backgroundColor = UIColor.yellowColor;

//挂断;
self.hangupButton = [[UIButton alloc] init];
self.hangupButton.imageView.contentMode = UIViewContentModeScaleAspectFit;
[self.hangupButton setImage:[UIImage imageNamedFromBundle:@"hangup"] forState:UIControlStateNormal];
[self.hangupButton addTarget:self action:@selector(hangupAction) forControlEvents:UIControlEventTouchUpInside];
[self.contentView addSubview:self.hangupButton];
[self.hangupButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.equalTo(self.contentView).offset(-60);
make.bottom.equalTo(self.contentView.mas_safeAreaLayoutGuideBottom).offset(-32);
make.left.equalTo(@30);
make.width.height.equalTo(@60);
//make.centerX.equalTo(@60);
}];

//接听;
self.answerButton = [[UIButton alloc] init];
self.answerButton.imageView.contentMode = UIViewContentModeScaleAspectFit;
[self.answerButton setImage:[UIImage imageNamedFromBundle:@"answer"] forState:UIControlStateNormal];
Expand Down
75 changes: 75 additions & 0 deletions Classes/ViewController/EaseCallMultiVC.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
//
// EaseCallMultiVC.h
// EaseCallKit
//
// Created by 杨剑 on 2025/7/24.
//

#import <UIKit/UIKit.h>
#import "EaseCallStreamView.h"
#import <HyphenateChat/HyphenateChat.h>
#import "EaseCallMultiItemModel.h"
NS_ASSUME_NONNULL_BEGIN

@interface EaseCallMultiVC : UIViewController
@property (nonatomic,strong) UIButton* microphoneButton;
@property (nonatomic,strong) UIButton* enableCameraButton;
@property (nonatomic,strong) UIButton* switchCameraButton;
@property (nonatomic,strong) UIButton* speakerButton;
@property (nonatomic,strong) UIButton* hangupButton;
@property (nonatomic,strong) UIButton* answerButton;
@property (nonatomic,strong) UILabel* timeLabel;
@property (strong, nonatomic) NSTimer *timeTimer;
@property (nonatomic, assign) int timeLength;
@property (nonatomic,strong) UILabel* microphoneLabel;
@property (nonatomic,strong) UILabel* enableCameraLabel;
@property (nonatomic,strong) UILabel* switchCameraLabel;
@property (nonatomic,strong) UILabel* speakerLabel;
@property (nonatomic,strong) UILabel* hangupLabel;
@property (nonatomic,strong) UILabel* acceptLabel;
@property (nonatomic,strong) UIButton* miniButton;
@property (nonatomic,strong) UIView* contentView;
//@property (nonatomic) EaseCallStreamView *floatingView;
@property (nonatomic) EaseCallMultiItemModel* floatingModel;

@property (nonatomic) BOOL isMini;

@property (nonatomic,strong) UILabel* remoteNameLable;
@property (nonatomic,strong) NSString* inviterId;
@property (nonatomic,strong) UIImageView* remoteHeadView;
//@property (nonatomic) EaseCallStreamView *localView;
@property (nonatomic) EaseCallMultiItemModel* localItemModel;

//@property (nonatomic) NSMutableDictionary* streamViewsDic;
//@property (nonatomic) NSMutableDictionary* placeHolderViewsDic;

@property (nonatomic,strong)NSMutableDictionary <NSString *,EaseCallMultiItemModel *>*itemModelsMap;

- (void)hangupAction;
- (void)muteAction;
- (void)enableVideoAction;
- (void)startTimer;
- (void)answerAction;
- (void)miniAction;
- (void)usersInfoUpdated;



- (void)addRemoteViewWithIMUsername:(NSString *)im_username enableVideo:(BOOL)enableVideo;
- (void)removeRemoteViewWithIMUsername:(NSString *)im_username;
- (void)setRemoteMuteWithIMUsername:(NSString *)im_username mute:(BOOL)mute;
- (void)setRemoteEnableVideoWithIMUsername:(NSString *)im_username enableVideo:(BOOL)enableVideo;
- (void)setLocalVideoViewWithIMUsername:(NSString *)im_username enableVideo:(BOOL)enableVideo;
- (void)setRemoteViewWithIMUsername:(NSString *)im_username showName:(NSString *)showName avatar_url:(NSURL *)avatar_url;
- (UIView *)getDisplayViewByIMUsername:(NSString *)im_username;
- (void)setAvatarUrlWithIMUsername:(NSString *)im_username avatar_url:(NSURL*)avatar_url;
- (void)removePlaceHolderViewWithIMUsername:(NSString *)im_username;






@end

NS_ASSUME_NONNULL_END
Loading