提交
This commit is contained in:
@@ -13,7 +13,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXAgoraEngineEx : NSObject
|
||||
+ (instancetype)sharedEngine;
|
||||
-(void)joinExWithAgora_token:(NSString*)agora_token channel:(NSString*)channel;
|
||||
-(void)joinExWithAgora_token:(NSString*)agora_token channel:(NSString*)channel pkUserId:(NSString*)pkUserId;
|
||||
- (void)muteLocalEXAudioStream:(BOOL)mute fromUserInfo:(QXUserHomeModel *)fromUserInfo;;
|
||||
|
||||
- (void)muteRemoteEXAudioStream:(BOOL)mute;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
@property (nonatomic,strong)NSString*channel;
|
||||
@property (nonatomic,strong)AgoraRtcConnection *connection;
|
||||
@property (nonatomic,strong)AgoraRtcChannelMediaOptions *option;
|
||||
@property (nonatomic,strong)NSString *pkUserId;
|
||||
@end
|
||||
@implementation QXAgoraEngineEx
|
||||
|
||||
@@ -22,18 +23,25 @@
|
||||
});
|
||||
return instance;
|
||||
}
|
||||
-(void)joinExWithAgora_token:(NSString*)agora_token channel:(NSString*)channel{
|
||||
-(void)joinExWithAgora_token:(NSString*)agora_token channel:(NSString*)channel pkUserId:(NSString*)pkUserId{
|
||||
// AgoraRtcChannelMediaOptions *option = [AgoraRtcChannelMediaOptions new];
|
||||
// option.publishMicrophoneTrack = YES;
|
||||
// option.publishMediaPlayerAudioTrack = YES;
|
||||
// option.enableAudioRecordingOrPlayout = YES;
|
||||
_pkUserId = pkUserId;
|
||||
AgoraRtcConnection *connection = [[AgoraRtcConnection alloc] initWithChannelId:channel localUid:QXGlobal.shareGlobal.loginModel.user_id.longLongValue];
|
||||
_channel = channel;
|
||||
_connection = connection;
|
||||
MJWeakSelf
|
||||
int result = [[QXAgoraEngine sharedEngine].agoraKit joinChannelExByToken:agora_token connection:connection delegate:self mediaOptions:self.option joinSuccess:^(NSString * _Nonnull channel, NSUInteger uid, NSInteger elapsed) {
|
||||
/// 此处为:声网加入扩展流成功回调
|
||||
|
||||
/// 打开自己在扩展流的推流权限
|
||||
[[QXAgoraEngine sharedEngine].agoraKit muteLocalAudioStreamEx:NO connection:connection];
|
||||
[[QXAgoraEngine sharedEngine].agoraKit muteAllRemoteAudioStreamsEx:NO connection:connection];;
|
||||
/// 屏蔽扩展流中所有人的流
|
||||
[[QXAgoraEngine sharedEngine].agoraKit muteAllRemoteAudioStreamsEx:YES connection:connection];;
|
||||
/// 只接收扩展流中对方主持的流 pkUserId
|
||||
[[QXAgoraEngine sharedEngine].agoraKit muteRemoteAudioStreamEx:pkUserId.longLongValue mute:NO connection:connection];;
|
||||
}];
|
||||
QXLOG(@"声网加入扩展流result---->%d",result)
|
||||
}
|
||||
@@ -67,8 +75,8 @@
|
||||
|
||||
}
|
||||
-(void)muteRemoteEXAudioStream:(BOOL)mute{
|
||||
int result = [[QXAgoraEngine sharedEngine].agoraKit muteAllRemoteAudioStreamsEx:mute connection:_connection];;
|
||||
|
||||
// int result = [[QXAgoraEngine sharedEngine].agoraKit muteAllRemoteAudioStreamsEx:mute connection:_connection];;
|
||||
int result = [[QXAgoraEngine sharedEngine].agoraKit muteRemoteAudioStreamEx:_pkUserId.longLongValue mute:mute connection:_connection];;
|
||||
QXLOG(@"声网屏蔽远端声音result---->%d",result)
|
||||
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/// 根据用户userid 插入消息
|
||||
-(void)didInsertMessge:(QXRoomChatListModel*)message userId:(NSString*)userId;
|
||||
/// 上下麦
|
||||
-(void)didUpDownSeatWithUser:(QXUserHomeModel*)user isUpSeat:(BOOL)isUpSeat pit_number:(NSInteger)pit_number;
|
||||
-(void)didUpDownSeatWithUser:(QXUserHomeModel*)user isUpSeat:(BOOL)isUpSeat pit_number:(NSInteger)pit_number isPK:(BOOL)isPK;
|
||||
/// 上麦模式发生变化 2 自由麦 | 1 排麦
|
||||
-(void)aplayPitModeDidChanged:(NSString*)upMicType;
|
||||
/// 排麦人数发生变化
|
||||
@@ -192,7 +192,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/// 10秒自动校正在线人数
|
||||
-(void)roomOnlineNumberDidChangedOnlineNumber:(NSString*)onlineNumber;
|
||||
/// 房间换麦
|
||||
-(void)roomSeatExchangedWithFromPitNumber:(NSInteger)fromPitNumber toPitNumber:(NSInteger)toPitNumber userInfo:(QXUserHomeModel*)userInfo;
|
||||
-(void)roomSeatExchangedWithFromPitNumber:(NSInteger)fromPitNumber toPitNumber:(NSInteger)toPitNumber userInfo:(QXUserHomeModel*)userInfo isPK:(BOOL)isPK;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -30,12 +30,6 @@
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
/// 设置聊天消息是否展示已读未读,只有旗舰版才支持
|
||||
#if DEVELOPENT == 1
|
||||
[TUIChatConfig defaultConfig].msgNeedReadReceipt = NO;
|
||||
#else
|
||||
[TUIChatConfig defaultConfig].msgNeedReadReceipt = YES;
|
||||
#endif
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -172,11 +166,14 @@
|
||||
QXRoomChatListModel *model = [QXRoomChatListModel yy_modelWithJSON:msg.Text];
|
||||
model.messageType = QXRoomChatMessageTypeSystem;
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(didInsertMessge:)]) {
|
||||
[self.delegate didInsertMessge:model];
|
||||
if (!model.is_pk) {
|
||||
// 非pk房间的消息插入公屏
|
||||
[self.delegate didInsertMessge:model];
|
||||
}
|
||||
}
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(didUpDownSeatWithUser:isUpSeat:pit_number:)]) {
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(didUpDownSeatWithUser:isUpSeat:pit_number:isPK:)]) {
|
||||
NSString *pit_number = [NSString stringWithFormat:@"%@",msg.Text[@"pit_number"]];
|
||||
[self.delegate didUpDownSeatWithUser:model.FromUserInfo isUpSeat:YES pit_number:pit_number.integerValue];
|
||||
[self.delegate didUpDownSeatWithUser:model.FromUserInfo isUpSeat:YES pit_number:pit_number.integerValue isPK:model.is_pk];
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -185,11 +182,14 @@
|
||||
QXRoomChatListModel *model = [QXRoomChatListModel yy_modelWithJSON:msg.Text];
|
||||
model.messageType = QXRoomChatMessageTypeSystem;
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(didInsertMessge:)]) {
|
||||
[self.delegate didInsertMessge:model];
|
||||
if (!model.is_pk) {
|
||||
// 非pk房间的消息插入公屏
|
||||
[self.delegate didInsertMessge:model];
|
||||
}
|
||||
}
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(didUpDownSeatWithUser:isUpSeat:pit_number:)]) {
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(didUpDownSeatWithUser:isUpSeat:pit_number:isPK:)]) {
|
||||
NSString *pit_number = [NSString stringWithFormat:@"%@",msg.Text[@"pit_number"]];
|
||||
[self.delegate didUpDownSeatWithUser:model.FromUserInfo isUpSeat:NO pit_number:pit_number.integerValue];
|
||||
[self.delegate didUpDownSeatWithUser:model.FromUserInfo isUpSeat:NO pit_number:pit_number.integerValue isPK:model.is_pk];
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -599,12 +599,15 @@
|
||||
QXRoomChatListModel *model = [QXRoomChatListModel yy_modelWithJSON:msg.Text];
|
||||
NSInteger fromPitNumber = [msg.Text[@"from_pit_number"] integerValue];
|
||||
NSInteger toPitNumber = [msg.Text[@"to_pit_number"] integerValue];
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(roomSeatExchangedWithFromPitNumber:toPitNumber:userInfo:)]) {
|
||||
[self.delegate roomSeatExchangedWithFromPitNumber:fromPitNumber toPitNumber:toPitNumber userInfo:model.FromUserInfo];
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(roomSeatExchangedWithFromPitNumber:toPitNumber:userInfo:isPK:)]) {
|
||||
[self.delegate roomSeatExchangedWithFromPitNumber:fromPitNumber toPitNumber:toPitNumber userInfo:model.FromUserInfo isPK:model.is_pk];
|
||||
}
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(didInsertMessge:)]) {
|
||||
model.messageType = QXRoomChatMessageTypeSystem;
|
||||
[self.delegate didInsertMessge:model];
|
||||
if (!model.is_pk) {
|
||||
// 非pk房间的消息插入公屏
|
||||
model.messageType = QXRoomChatMessageTypeSystem;
|
||||
[self.delegate didInsertMessge:model];
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user