|
@@ -19,6 +19,7 @@
|
|
#import "SeatContentView.h"
|
|
#import "SeatContentView.h"
|
|
#import "LiveSeatApplyView.h"
|
|
#import "LiveSeatApplyView.h"
|
|
#import "LiveroomTimeManager.h"
|
|
#import "LiveroomTimeManager.h"
|
|
|
|
+#import "SeatTipsView.h"
|
|
|
|
|
|
@interface LiveVideoRoomViewController ()<RCRTCRoomEventDelegate,RCRTCStatusReportDelegate,UIGestureRecognizerDelegate,KSChatInputBarControlDelegate,UITableViewDataSource,UITableViewDelegate,LiveroomTimeManagerDelegate>
|
|
@interface LiveVideoRoomViewController ()<RCRTCRoomEventDelegate,RCRTCStatusReportDelegate,UIGestureRecognizerDelegate,KSChatInputBarControlDelegate,UITableViewDataSource,UITableViewDelegate,LiveroomTimeManagerDelegate>
|
|
|
|
|
|
@@ -77,6 +78,9 @@
|
|
// 远端连麦用户
|
|
// 远端连麦用户
|
|
@property (nonatomic, strong) NSMutableArray *remoteMemberArray;
|
|
@property (nonatomic, strong) NSMutableArray *remoteMemberArray;
|
|
|
|
|
|
|
|
+/// 连麦申请统计数据
|
|
|
|
+@property (nonatomic, strong) SeatTipsView *seatApplyTips;
|
|
|
|
+
|
|
@end
|
|
@end
|
|
|
|
|
|
@implementation LiveVideoRoomViewController
|
|
@implementation LiveVideoRoomViewController
|
|
@@ -456,6 +460,7 @@
|
|
// }
|
|
// }
|
|
// else { // 加入直播间成功
|
|
// else { // 加入直播间成功
|
|
strongSelf.room = room;
|
|
strongSelf.room = room;
|
|
|
|
+ strongSelf.room.delegate = self;
|
|
[strongSelf countMemberCount];
|
|
[strongSelf countMemberCount];
|
|
// 发布本地视频流
|
|
// 发布本地视频流
|
|
[self publishLocalStream];
|
|
[self publishLocalStream];
|
|
@@ -556,36 +561,36 @@
|
|
if ([rcMessage.content isMemberOfClass:[KSLiveChatroomLike class]]) {
|
|
if ([rcMessage.content isMemberOfClass:[KSLiveChatroomLike class]]) {
|
|
KSLiveChatroomLike *likeMessage = (KSLiveChatroomLike *)rcMessage.content;
|
|
KSLiveChatroomLike *likeMessage = (KSLiveChatroomLike *)rcMessage.content;
|
|
// 统计点赞数量
|
|
// 统计点赞数量
|
|
- self.likeCount += likeMessage.counts;
|
|
|
|
- [self countLikeMessageCount];
|
|
|
|
|
|
+ __blockSelf.likeCount += likeMessage.counts;
|
|
|
|
+ [__blockSelf countLikeMessageCount];
|
|
}
|
|
}
|
|
else if ([rcMessage.content isMemberOfClass:[KSLiveChatroomWelcome class]]) {
|
|
else if ([rcMessage.content isMemberOfClass:[KSLiveChatroomWelcome class]]) {
|
|
// 过滤自己发送的欢迎消息
|
|
// 过滤自己发送的欢迎消息
|
|
if ([rcMessage.senderUserId isEqualToString:UserDefault(UIDKey)]) {
|
|
if ([rcMessage.senderUserId isEqualToString:UserDefault(UIDKey)]) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- self.totalCount++;
|
|
|
|
- [self countMemberCount];
|
|
|
|
|
|
+ __blockSelf.totalCount++;
|
|
|
|
+ [__blockSelf countMemberCount];
|
|
}
|
|
}
|
|
// 用户退出消息
|
|
// 用户退出消息
|
|
else if ([rcMessage.content isMemberOfClass:[KSLiveChatroomLeave class]]) {
|
|
else if ([rcMessage.content isMemberOfClass:[KSLiveChatroomLeave class]]) {
|
|
KSLiveChatroomLeave *memberLeaveMsg = (KSLiveChatroomLeave *)rcMessage.content;
|
|
KSLiveChatroomLeave *memberLeaveMsg = (KSLiveChatroomLeave *)rcMessage.content;
|
|
- self.totalCount--;
|
|
|
|
- [self countMemberCount];
|
|
|
|
- if ([self judgeContainMember:memberLeaveMsg.userId]) {
|
|
|
|
- [self removeMember:memberLeaveMsg.userId];
|
|
|
|
- [self refreshSeatApplyView];
|
|
|
|
|
|
+ __blockSelf.totalCount--;
|
|
|
|
+ [__blockSelf countMemberCount];
|
|
|
|
+ if ([__blockSelf judgeContainMember:memberLeaveMsg.userId]) {
|
|
|
|
+ [__blockSelf removeMember:memberLeaveMsg.userId];
|
|
|
|
+ [__blockSelf refreshSeatApplyView];
|
|
}
|
|
}
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
// 用户退出消息
|
|
// 用户退出消息
|
|
else if ([rcMessage.content isMemberOfClass:[KSLiveChatroomUserQuit class]]) {
|
|
else if ([rcMessage.content isMemberOfClass:[KSLiveChatroomUserQuit class]]) {
|
|
KSLiveChatroomUserQuit *memberLeaveMsg = (KSLiveChatroomUserQuit *)rcMessage.content;
|
|
KSLiveChatroomUserQuit *memberLeaveMsg = (KSLiveChatroomUserQuit *)rcMessage.content;
|
|
- self.totalCount--;
|
|
|
|
- [self countMemberCount];
|
|
|
|
- if ([self judgeContainMember:memberLeaveMsg.userId]) {
|
|
|
|
- [self removeMember:memberLeaveMsg.userId];
|
|
|
|
- [self refreshSeatApplyView];
|
|
|
|
|
|
+ __blockSelf.totalCount--;
|
|
|
|
+ [__blockSelf countMemberCount];
|
|
|
|
+ if ([__blockSelf judgeContainMember:memberLeaveMsg.userId]) {
|
|
|
|
+ [__blockSelf removeMember:memberLeaveMsg.userId];
|
|
|
|
+ [__blockSelf refreshSeatApplyView];
|
|
}
|
|
}
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -599,15 +604,15 @@
|
|
member.name = seatApplyMessage.audienceName;
|
|
member.name = seatApplyMessage.audienceName;
|
|
member.userId = seatApplyMessage.audienceId;
|
|
member.userId = seatApplyMessage.audienceId;
|
|
member.isConnected = NO;
|
|
member.isConnected = NO;
|
|
- if (![self judgeContainMember:member.userId]) {
|
|
|
|
- [self.seatApplyArray addObject:member];
|
|
|
|
- [self refreshSeatApplyView];
|
|
|
|
|
|
+ if (![__blockSelf judgeContainMember:member.userId]) {
|
|
|
|
+ [__blockSelf.seatApplyArray addObject:member];
|
|
|
|
+ [__blockSelf refreshSeatApplyView];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else if (seatApplyMessage.type == SEATHANDLE_CANCELAPPLY) { // 观众取消申请 从申请中剔除
|
|
else if (seatApplyMessage.type == SEATHANDLE_CANCELAPPLY) { // 观众取消申请 从申请中剔除
|
|
- if ([self judgeContainMember:seatApplyMessage.audienceId]) {
|
|
|
|
- [self removeMember:seatApplyMessage.audienceId];
|
|
|
|
- [self refreshSeatApplyView];
|
|
|
|
|
|
+ if ([__blockSelf judgeContainMember:seatApplyMessage.audienceId]) {
|
|
|
|
+ [__blockSelf removeMember:seatApplyMessage.audienceId];
|
|
|
|
+ [__blockSelf refreshSeatApplyView];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return;
|
|
return;
|
|
@@ -618,9 +623,9 @@
|
|
}
|
|
}
|
|
else if ([rcMessage.content isMemberOfClass:[KSLiveChatroomDownSeat class]]) { // 观众下麦,从列表中移除
|
|
else if ([rcMessage.content isMemberOfClass:[KSLiveChatroomDownSeat class]]) { // 观众下麦,从列表中移除
|
|
KSLiveChatroomDownSeat *downSeatMessage = (KSLiveChatroomDownSeat *)rcMessage.content;
|
|
KSLiveChatroomDownSeat *downSeatMessage = (KSLiveChatroomDownSeat *)rcMessage.content;
|
|
- if ([self judgeContainMember:downSeatMessage.audienceId]) {
|
|
|
|
- [self removeMember:downSeatMessage.audienceId];
|
|
|
|
- [self refreshSeatApplyView];
|
|
|
|
|
|
+ if ([__blockSelf judgeContainMember:downSeatMessage.audienceId]) {
|
|
|
|
+ [__blockSelf removeMember:downSeatMessage.audienceId];
|
|
|
|
+ [__blockSelf refreshSeatApplyView];
|
|
}
|
|
}
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -665,10 +670,31 @@
|
|
}
|
|
}
|
|
|
|
|
|
- (void)refreshSeatApplyView {
|
|
- (void)refreshSeatApplyView {
|
|
|
|
+ if (self.seatApplyArray.count) {
|
|
|
|
+ [self showSeatTips:self.seatApplyArray.count];
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ [self hideSeatTips];
|
|
|
|
+ }
|
|
[self.seatApplyView refreshSeatApplyTable:self.seatApplyArray];
|
|
[self.seatApplyView refreshSeatApplyTable:self.seatApplyArray];
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+- (void)showSeatTips:(NSInteger)count {
|
|
|
|
+ NSString *countDesc = count >= 100 ? @"99+" : [NSString stringWithFormat:@"%zd",count];
|
|
|
|
+ if (![self.view.subviews containsObject:self.seatApplyTips]) {
|
|
|
|
+ [self.view addSubview:self.seatApplyTips];
|
|
|
|
+ [self.seatApplyTips mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
+ make.bottom.mas_equalTo(self.bottomView.mas_top).offset(2);
|
|
|
|
+ make.height.mas_equalTo(20);
|
|
|
|
+ make.left.mas_equalTo(self.bottomView.mas_right).offset(-72);
|
|
|
|
+ }];
|
|
|
|
+ }
|
|
|
|
+ [self.seatApplyTips configCountMessage:countDesc];
|
|
|
|
+}
|
|
|
|
|
|
|
|
+- (void)hideSeatTips {
|
|
|
|
+ [self.seatApplyTips removeFromSuperview];
|
|
|
|
+}
|
|
// 发送人数同步消息
|
|
// 发送人数同步消息
|
|
- (void)sendMemberCountMessage {
|
|
- (void)sendMemberCountMessage {
|
|
KSLiveChatroomMemberCount *syncMessage = [[KSLiveChatroomMemberCount alloc] init];
|
|
KSLiveChatroomMemberCount *syncMessage = [[KSLiveChatroomMemberCount alloc] init];
|
|
@@ -699,8 +725,6 @@
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
#pragma mark ---- sendMessage/showMessage
|
|
#pragma mark ---- sendMessage/showMessage
|
|
- (void)sendMessage:(RCMessageContent *)messageContent displayMessage:(BOOL)displayMessage callback:(void(^)(BOOL success))callback {
|
|
- (void)sendMessage:(RCMessageContent *)messageContent displayMessage:(BOOL)displayMessage callback:(void(^)(BOOL success))callback {
|
|
if (_roomId == nil) {
|
|
if (_roomId == nil) {
|
|
@@ -763,7 +787,7 @@
|
|
// view刷新
|
|
// view刷新
|
|
[self.conversationMessageTableView insertRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
[self.conversationMessageTableView insertRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
|
if ([self isAtTheBottomOfTableView] || self.isNeedScrollToButtom) {
|
|
if ([self isAtTheBottomOfTableView] || self.isNeedScrollToButtom) {
|
|
- [self scrollToBottomAnimated:NO];
|
|
|
|
|
|
+ [self scrollToBottomAnimated:YES];
|
|
self.isNeedScrollToButtom=NO;
|
|
self.isNeedScrollToButtom=NO;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -905,9 +929,15 @@
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+- (SeatTipsView *)seatApplyTips {
|
|
|
|
+ if (!_seatApplyTips) {
|
|
|
|
+ _seatApplyTips = [[SeatTipsView alloc] init];
|
|
|
|
+ }
|
|
|
|
+ return _seatApplyTips;
|
|
|
|
+}
|
|
- (void)displaySeatView {
|
|
- (void)displaySeatView {
|
|
[self.view addSubview:self.seatApplyView];
|
|
[self.view addSubview:self.seatApplyView];
|
|
- [self.seatApplyView refreshSeatApplyTable:self.seatApplyArray];
|
|
|
|
|
|
+ [self refreshSeatApplyView];
|
|
}
|
|
}
|
|
|
|
|
|
- (void)quitAction {
|
|
- (void)quitAction {
|
|
@@ -1060,7 +1090,7 @@
|
|
else {
|
|
else {
|
|
member.isConnected = YES;
|
|
member.isConnected = YES;
|
|
}
|
|
}
|
|
- [self.seatApplyView refreshSeatApplyTable:self.seatApplyArray];
|
|
|
|
|
|
+ [self refreshSeatApplyView];
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|