|
@@ -764,12 +764,42 @@ typedef NS_ENUM(NSInteger, LIVEPAGE) {
|
|
|
|
|
|
self.seatContainer.seatMemberArray = [NSMutableArray arrayWithArray:seatArray];
|
|
|
[self.seatContainer refreshSeatUI];
|
|
|
+ [self refreshSeatApplyList];
|
|
|
+
|
|
|
}
|
|
|
else {
|
|
|
[self removeSeatContainer];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+- (void)refreshSeatApplyList {
|
|
|
+ // 查询不在列表的成员
|
|
|
+ NSMutableArray *requestArray = [NSMutableArray array];
|
|
|
+ NSMutableArray *memberArray = [self.seatContainer.seatMemberArray mutableCopy];
|
|
|
+ NSMutableArray *seatApplyArray = [self.seatApplyArray mutableCopy];
|
|
|
+ for (NSString *userId in memberArray) {
|
|
|
+ BOOL containUser = NO;
|
|
|
+ for (LiveSeatMember *member in seatApplyArray) {
|
|
|
+ if ([member.userId isEqualToString:userId]) {
|
|
|
+ containUser = YES;
|
|
|
+ NSLog(@"---- continue --");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (containUser == NO) {
|
|
|
+ LiveSeatMember *member = [[LiveSeatMember alloc] init];
|
|
|
+ member.isConnected = YES;
|
|
|
+ member.userId = userId;
|
|
|
+ [requestArray addObject:member];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (requestArray.count) {
|
|
|
+ self.seatApplyArray = [NSMutableArray arrayWithArray:requestArray];
|
|
|
+ [self refreshSeatApplyView];
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
- (void)removeSeatContainer {
|
|
|
if ([self.livePageView.subviews containsObject:self.seatContainer]) {
|
|
|
[self.seatContainer removeFromSuperview];
|
|
@@ -981,7 +1011,7 @@ typedef NS_ENUM(NSInteger, LIVEPAGE) {
|
|
|
if (code == RCRTCCodeSignalServerNotConnect || code == RCRTCCodeParameterError || code == RCRTCCodeNotInRTCRoom || code == RCRTCCodeRTCTokenIsNull || code == RCRTCCodeHttpTimeoutError || code == RCRTCCodeHttpError || code == RCRTCCodeVoIPNotAvailable) {
|
|
|
NSLog(@"%@",[NSString stringWithFormat:@"加入失败 code %ld",code]);
|
|
|
[strongSelf MBPShow:@"加入直播间失败"];
|
|
|
-// [strongSelf.navigationController dismissViewControllerAnimated:YES completion:nil];
|
|
|
+ // [strongSelf.navigationController dismissViewControllerAnimated:YES completion:nil];
|
|
|
}
|
|
|
else {
|
|
|
[strongSelf notiferJoinSuccessToServiceCallback:^{
|
|
@@ -991,7 +1021,9 @@ typedef NS_ENUM(NSInteger, LIVEPAGE) {
|
|
|
strongSelf.room = room;
|
|
|
strongSelf.room.delegate = self;
|
|
|
}
|
|
|
- // 订阅流数据
|
|
|
+ // 订阅流数据
|
|
|
+ [strongSelf renderSeatView];
|
|
|
+
|
|
|
[strongSelf countMemberCount];
|
|
|
// 发布本地视频流
|
|
|
if (strongSelf.isPauseLive == NO && strongSelf.isEnterBackground == NO) {
|
|
@@ -1021,6 +1053,7 @@ typedef NS_ENUM(NSInteger, LIVEPAGE) {
|
|
|
[self.room.localUser publishDefaultLiveStreams:^(BOOL isSuccess, RCRTCCode code, RCRTCLiveInfo * _Nullable liveInfo) {
|
|
|
if (code == RCRTCCodeSuccess) {
|
|
|
weakSelf.needPublishStream = NO;
|
|
|
+ [weakSelf renderSeatView];
|
|
|
}
|
|
|
else {
|
|
|
[weakSelf MBPShow:@"视频流发布失败"];
|
|
@@ -1036,6 +1069,7 @@ typedef NS_ENUM(NSInteger, LIVEPAGE) {
|
|
|
_room = nil;
|
|
|
MJWeakSelf;
|
|
|
[[RCRTCEngine sharedInstance] leaveRoom:^(BOOL isSuccess, RCRTCCode code) {
|
|
|
+ NSLog(@"----- leave code -----%zd",code);
|
|
|
dispatch_main_async_safe(^{
|
|
|
[weakSelf sendLeaveMessageCallback:^(BOOL success) {
|
|
|
callback(success);
|
|
@@ -1301,7 +1335,18 @@ typedef NS_ENUM(NSInteger, LIVEPAGE) {
|
|
|
|
|
|
- (void)refreshSeatApplyView {
|
|
|
if (self.seatApplyArray.count) {
|
|
|
- [self showSeatTips:self.seatApplyArray.count];
|
|
|
+ NSInteger count = 0;
|
|
|
+ for (LiveSeatMember *obj in self.seatApplyArray) {
|
|
|
+ if (obj.isConnected == NO) {
|
|
|
+ count++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (count > 0) {
|
|
|
+ [self showSeatTips:count];
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ [self hideSeatTips];
|
|
|
+ }
|
|
|
}
|
|
|
else {
|
|
|
[self hideSeatTips];
|