|  | @@ -58,6 +58,7 @@
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  #import "TXDanMuView.h"
 | 
	
		
			
				|  |  |  #import "TXTimeView.h"
 | 
	
		
			
				|  |  | +#import "CoursewareAlertView.h"
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  #define MAXBIGPHOTONUMBER (3)
 | 
	
		
			
				|  |  |  #define MAXPHOTONUMBER (3)
 | 
	
	
		
			
				|  | @@ -135,6 +136,8 @@
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  @property (nonatomic, assign) NSInteger soundVolume; // 伴奏音量
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +@property (nonatomic, strong) CoursewareAlertView *coursewareView;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  @property (nonatomic, strong) TRTCCloud *engine;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -163,6 +166,10 @@
 | 
	
		
			
				|  |  |  - (void)changeOrientation:(BOOL)isLandScape {
 | 
	
		
			
				|  |  |      if (isLandScape) {
 | 
	
		
			
				|  |  |          // 切换到横屏
 | 
	
		
			
				|  |  | +        if (IS_IPAD) {
 | 
	
		
			
				|  |  | +            self.zh_statusBarHidden = YES;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          AppDelegate* delegate = (AppDelegate*)[UIApplication sharedApplication].delegate;
 | 
	
		
			
				|  |  |          delegate.allowAutoRotate = YES;
 | 
	
		
			
				|  |  |          [UIDevice switchNewOrientation:UIInterfaceOrientationLandscapeRight inController:self];
 | 
	
	
		
			
				|  | @@ -172,6 +179,9 @@
 | 
	
		
			
				|  |  |          AppDelegate* delegate = (AppDelegate*)[UIApplication sharedApplication].delegate;
 | 
	
		
			
				|  |  |          delegate.allowAutoRotate = NO;
 | 
	
		
			
				|  |  |          dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
 | 
	
		
			
				|  |  | +            if (IS_IPAD) {
 | 
	
		
			
				|  |  | +                self.zh_statusBarHidden = NO;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  |              [UIDevice switchNewOrientation:UIInterfaceOrientationPortrait inController:self];
 | 
	
		
			
				|  |  |          });
 | 
	
		
			
				|  |  |      }
 | 
	
	
		
			
				|  | @@ -197,6 +207,7 @@
 | 
	
		
			
				|  |  |          [self judgeShowAlert];
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |      [IQKeyboardManager sharedManager].enableAutoToolbar = YES;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  - (void)hideAlertView {
 | 
	
	
		
			
				|  | @@ -250,6 +261,7 @@
 | 
	
		
			
				|  |  |      [super viewDidLoad];
 | 
	
		
			
				|  |  |      // Do any additional setup after loading the view.
 | 
	
		
			
				|  |  |      self.ks_prefersNavigationBarHidden = YES;
 | 
	
		
			
				|  |  | +    
 | 
	
		
			
				|  |  |      self.view.backgroundColor = [UIColor whiteColor];
 | 
	
		
			
				|  |  |      [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(leaveRoomAction) name:@"classroomLogout" object:nil];
 | 
	
		
			
				|  |  |      [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(quitRoomAction) name:@"classroomQuit" object:nil];
 | 
	
	
		
			
				|  | @@ -379,12 +391,10 @@
 | 
	
		
			
				|  |  |          case ClassTitleViewActionTagMic:
 | 
	
		
			
				|  |  |          {
 | 
	
		
			
				|  |  |              
 | 
	
		
			
				|  |  | -            if (tagButton.isSelected == NO) {
 | 
	
		
			
				|  |  | -                
 | 
	
		
			
				|  |  | +            if (tagButton.isSelected == NO) { // 关闭
 | 
	
		
			
				|  |  |                  [[ClassroomService sharedService] enableDevice:NO songId:0 withType:DeviceTypeMicrophone];
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | -            else {
 | 
	
		
			
				|  |  | -                tagButton.isSelected = NO;
 | 
	
		
			
				|  |  | +            else { // 打开
 | 
	
		
			
				|  |  |                  [[ClassroomService sharedService] enableDevice:YES songId:0 withType:DeviceTypeMicrophone];
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
	
		
			
				|  | @@ -392,7 +402,6 @@
 | 
	
		
			
				|  |  |          case ClassTitleViewActionTagCamera:
 | 
	
		
			
				|  |  |          {
 | 
	
		
			
				|  |  |              if (tagButton.isSelected == NO) {
 | 
	
		
			
				|  |  | -                
 | 
	
		
			
				|  |  |                  [[ClassroomService sharedService] enableDevice:NO songId:0 withType:DeviceTypeCamera];
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              else {
 | 
	
	
		
			
				|  | @@ -444,7 +453,6 @@
 | 
	
		
			
				|  |  |              break;
 | 
	
		
			
				|  |  |          case ClassTitleViewActionTagHangup:
 | 
	
		
			
				|  |  |          {
 | 
	
		
			
				|  |  | -            
 | 
	
		
			
				|  |  |              [self showQuitAlert];
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          default:
 | 
	
	
		
			
				|  | @@ -926,6 +934,8 @@
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |      self.toolView.isVideoDisplay = NO;
 | 
	
		
			
				|  |  |      [self.view bringSubviewToFront:self.timeView];
 | 
	
		
			
				|  |  | +    [self.view bringSubviewToFront:self.titleView];
 | 
	
		
			
				|  |  | +    
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  - (void)refreshWhiteBoardFrame {
 | 
	
	
		
			
				|  | @@ -1148,12 +1158,9 @@
 | 
	
		
			
				|  |  |              case MainToolButtonTagMic: // 麦克风
 | 
	
		
			
				|  |  |              {
 | 
	
		
			
				|  |  |                  if (toolButton.isSelected) { // 打开
 | 
	
		
			
				|  |  | -                    toolButton.isSelected = NO;
 | 
	
		
			
				|  |  |                      [[ClassroomService sharedService] enableDevice:YES songId:0 withType:DeviceTypeMicrophone];
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  else { // 关闭
 | 
	
		
			
				|  |  | -                    
 | 
	
		
			
				|  |  | -                    toolButton.isSelected = YES;
 | 
	
		
			
				|  |  |                      [[ClassroomService sharedService] enableDevice:NO songId:0 withType:DeviceTypeMicrophone];
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |              }
 | 
	
	
		
			
				|  | @@ -1161,12 +1168,10 @@
 | 
	
		
			
				|  |  |              case MainToolButtonTagCamero: // 摄像头
 | 
	
		
			
				|  |  |              {
 | 
	
		
			
				|  |  |                  if (toolButton.isSelected) { // 打开
 | 
	
		
			
				|  |  | -                    toolButton.isSelected = NO;
 | 
	
		
			
				|  |  |                      [[ClassroomService sharedService] enableDevice:YES songId:0 withType:DeviceTypeCamera];
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  else { // 关闭
 | 
	
		
			
				|  |  |                      
 | 
	
		
			
				|  |  | -                    toolButton.isSelected = YES;
 | 
	
		
			
				|  |  |                      [[ClassroomService sharedService] enableDevice:NO songId:0 withType:DeviceTypeCamera];
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |              }
 | 
	
	
		
			
				|  | @@ -1350,14 +1355,16 @@
 | 
	
		
			
				|  |  |  - (void)showNetworkingStatus:(TRTCQuality)quality remoteQuality:(NSArray<TRTCQualityInfo *> *)remoteQuality  {
 | 
	
		
			
				|  |  |      dispatch_async(dispatch_get_main_queue(), ^{
 | 
	
		
			
				|  |  |          // 本地
 | 
	
		
			
				|  |  | -        if ([self.containerView.member.userId isEqualToString:UserDefault(UIDKey)]) {
 | 
	
		
			
				|  |  | +        NSString *currentUserID = [ClassroomService sharedService].currentRoom.currentMemberId;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        if ([self.containerView.member.userId isEqualToString:currentUserID]) {
 | 
	
		
			
				|  |  |              [self.containerView.displayView updateUserQualityNetWorkingStatus:[self getNetStatusWithQuality:quality]];
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        [self.videoListView updateUserQuality:UserDefault(UIDKey) netWorkingStatus:[self getNetStatusWithQuality:quality]];
 | 
	
		
			
				|  |  | +        [self.videoListView updateUserQuality:currentUserID netWorkingStatus:[self getNetStatusWithQuality:quality]];
 | 
	
		
			
				|  |  |          // 更新full
 | 
	
		
			
				|  |  |          if (self.squareOn) {
 | 
	
		
			
				|  |  | -            [self.squareView updateUserQuality:UserDefault(UIDKey) netWorkingStatus:[self getNetStatusWithQuality:quality]];
 | 
	
		
			
				|  |  | +            [self.squareView updateUserQuality:currentUserID netWorkingStatus:[self getNetStatusWithQuality:quality]];
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          // 远端
 | 
	
		
			
				|  |  |          for (TRTCQualityInfo *info in remoteQuality) {
 | 
	
	
		
			
				|  | @@ -1397,14 +1404,16 @@
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  - (void)didReportUserVolume:(NSArray<TRTCVolumeInfo *> *)userVolumes {
 | 
	
		
			
				|  |  | +    NSString *currentUserID = [ClassroomService sharedService].currentRoom.currentMemberId;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      for (TRTCVolumeInfo *info in userVolumes) {
 | 
	
		
			
				|  |  |          NSString *userId = info.userId;
 | 
	
		
			
				|  |  |          if ([NSString isEmptyString:userId]) {
 | 
	
		
			
				|  |  | -            userId = UserDefault(UIDKey);
 | 
	
		
			
				|  |  | +            userId = currentUserID;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          [self.videoListView updateMicStatus:userId volume:info.volume];
 | 
	
		
			
				|  |  |          // 更新title
 | 
	
		
			
				|  |  | -        if ([UserDefault(UIDKey) isEqualToString:userId]) {
 | 
	
		
			
				|  |  | +        if ([currentUserID isEqualToString:userId]) {
 | 
	
		
			
				|  |  |              [self.titleView updateUserVolume:info.volume];
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          // 更新container
 | 
	
	
		
			
				|  | @@ -1590,6 +1599,7 @@
 | 
	
		
			
				|  |  |      if (!_wBoardCtrl) {
 | 
	
		
			
				|  |  |          CGRect frame = [self getWBoardFrame];
 | 
	
		
			
				|  |  |          _wBoardCtrl = [[KSWhiteboardControl alloc] initWithDelegate:self viewFrame:frame];
 | 
	
		
			
				|  |  | +        NSLog(@"----%@", [ClassroomService sharedService].currentRoom.roomId);
 | 
	
		
			
				|  |  |          _wBoardCtrl.randomNumeric = [ClassroomService sharedService].currentRoom.randomNumeric;
 | 
	
		
			
				|  |  |          NSString *roomId = [ClassroomService sharedService].currentRoom.roomId;
 | 
	
		
			
				|  |  |          if ([roomId containsString:@"S"] || [roomId containsString:@"I"]) {
 | 
	
	
		
			
				|  | @@ -1929,18 +1939,7 @@
 | 
	
		
			
				|  |  |      NSLog(@"-------sound volume %zd", self.soundVolume);
 | 
	
		
			
				|  |  |      if (action == ACCOMPANYACTION_ADDSONG) {
 | 
	
		
			
				|  |  |          // 添加伴奏
 | 
	
		
			
				|  |  | -        MJWeakSelf;
 | 
	
		
			
				|  |  | -        SongListViewController *songVC = [[SongListViewController alloc] init];
 | 
	
		
			
				|  |  | -//        songVC.isChooseSong = YES;
 | 
	
		
			
				|  |  | -        [songVC chooseSongCallback:^(NSString * _Nonnull songId, NSString * _Nonnull songName, NSString * _Nullable songUrl, NSString * _Nullable accompanyUrl) {
 | 
	
		
			
				|  |  | -            
 | 
	
		
			
				|  |  | -            [weakSelf notiferStudentDownload:songId songUrl:songUrl accompanyUrl:accompanyUrl songName:songName];
 | 
	
		
			
				|  |  | -        }];
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        CustomNavViewController *navCtrl = [[CustomNavViewController alloc] initWithRootViewController:songVC];
 | 
	
		
			
				|  |  | -        navCtrl.modalPresentationStyle = UIModalPresentationFullScreen;
 | 
	
		
			
				|  |  | -        _isPushChooseView = YES;
 | 
	
		
			
				|  |  | -        [self presentViewController:navCtrl animated:YES completion:nil];
 | 
	
		
			
				|  |  | +        [self.coursewareView showView];
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |      else if (action == ACCOMPANYACTION_STOP) {
 | 
	
		
			
				|  |  |          
 | 
	
	
		
			
				|  | @@ -1994,7 +1993,7 @@
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  - (void)notiferStudentDownload:(NSString *)songId songUrl:(NSString *)songUrl accompanyUrl:(NSString *)accompanyUrl songName:(NSString *)songName {
 | 
	
		
			
				|  |  | -    
 | 
	
		
			
				|  |  | +    [self.coursewareView hideView];
 | 
	
		
			
				|  |  |      dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
 | 
	
		
			
				|  |  |          for (RoomMember *member in [ClassroomService sharedService].currentRoom.memberList) {
 | 
	
		
			
				|  |  |              
 | 
	
	
		
			
				|  | @@ -2080,6 +2079,19 @@
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |      return _danView;
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +- (CoursewareAlertView *)coursewareView {
 | 
	
		
			
				|  |  | +    if (!_coursewareView) {
 | 
	
		
			
				|  |  | +        _coursewareView = [CoursewareAlertView shareInstance];
 | 
	
		
			
				|  |  | +        [_coursewareView configUI];
 | 
	
		
			
				|  |  | +        MJWeakSelf;
 | 
	
		
			
				|  |  | +        [_coursewareView chooseCoursewareCallback:^(NSString * _Nonnull musicUrl, NSString * _Nonnull musicName, NSString * _Nonnull songId) {
 | 
	
		
			
				|  |  | +            
 | 
	
		
			
				|  |  | +            [weakSelf notiferStudentDownload:songId songUrl:musicUrl accompanyUrl:nil songName:musicName];
 | 
	
		
			
				|  |  | +        }];
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    return _coursewareView;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  |  /*
 | 
	
		
			
				|  |  |  #pragma mark - Navigation
 | 
	
		
			
				|  |  |  
 |