Commit 0e4a3cb43595044496f43cd70ecac93765119251

Authored by 王军波
1 parent 68183f61

点播退出按钮,在直播播放去除

LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Controller/LVCUGCLivePlayerController.m
@@ -97,8 +97,12 @@ @@ -97,8 +97,12 @@
97 97
98 - (void)addLiveBaseView 98 - (void)addLiveBaseView
99 { 99 {
100 - [self.liveBaseView removeFromSuperview]; 100 + if (_vodPlayerQuitBtn) {
  101 + [_vodPlayerQuitBtn removeFromSuperview];
  102 + }
  103 + [_liveBaseView removeFromSuperview];
101 [_viewSecond addSubview:self.liveBaseView ]; 104 [_viewSecond addSubview:self.liveBaseView ];
  105 + [_liveBaseView addGestureRecognizer:_pan];
102 } 106 }
103 107
104 - (void)quitBtnClick { // 退出 108 - (void)quitBtnClick { // 退出
@@ -199,10 +203,11 @@ @@ -199,10 +203,11 @@
199 if (_vodPlayerQuitBtn) { 203 if (_vodPlayerQuitBtn) {
200 [_vodPlayerQuitBtn removeFromSuperview]; 204 [_vodPlayerQuitBtn removeFromSuperview];
201 } 205 }
  206 + [_bottomView removeFromSuperview];
  207 + [_currentTimer invalidate]; //时间重置
202 [_player.view removeFromSuperview]; 208 [_player.view removeFromSuperview];
203 [_player stop]; 209 [_player stop];
204 _player = nil; 210 _player = nil;
205 - [_currentTimer invalidate]; //时间重置  
206 // 停止后的视图,拿到自己的加载图来显示 211 // 停止后的视图,拿到自己的加载图来显示
207 [_viewSecond addSubview:_secondLoadView]; 212 [_viewSecond addSubview:_secondLoadView];
208 213
@@ -216,6 +221,7 @@ @@ -216,6 +221,7 @@
216 if (_index >= 0) { 221 if (_index >= 0) {
217 if ([_playArray[_index].activityStatus isEqualToString:@"2"]) { 222 if ([_playArray[_index].activityStatus isEqualToString:@"2"]) {
218 223
  224 + [_liveBaseView removeFromSuperview];
219 [_viewSecond addSubview:self.vodPlayerQuitBtn]; 225 [_viewSecond addSubview:self.vodPlayerQuitBtn];
220 _currentTimer = [NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(timeChange) userInfo:nil repeats:YES]; 226 _currentTimer = [NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(timeChange) userInfo:nil repeats:YES];
221 227
@@ -290,9 +296,10 @@ @@ -290,9 +296,10 @@
290 if (_vodPlayerQuitBtn) { 296 if (_vodPlayerQuitBtn) {
291 [_vodPlayerQuitBtn removeFromSuperview]; 297 [_vodPlayerQuitBtn removeFromSuperview];
292 } 298 }
  299 + [_bottomView removeFromSuperview];
  300 + [_currentTimer invalidate]; //时间重置
293 [_player.view removeFromSuperview]; 301 [_player.view removeFromSuperview];
294 [_player stop]; 302 [_player stop];
295 - [_currentTimer invalidate]; //时间重置  
296 _player = nil; 303 _player = nil;
297 // 停止后的视图,拿到自己的加载图来显示 304 // 停止后的视图,拿到自己的加载图来显示
298 [_viewSecond addSubview:_secondLoadView]; 305 [_viewSecond addSubview:_secondLoadView];
@@ -308,6 +315,7 @@ @@ -308,6 +315,7 @@
308 315
309 if ([_playArray[_index].activityStatus isEqualToString:@"2"]) { 316 if ([_playArray[_index].activityStatus isEqualToString:@"2"]) {
310 317
  318 + [_liveBaseView removeFromSuperview];
311 [_viewSecond addSubview:self.vodPlayerQuitBtn]; 319 [_viewSecond addSubview:self.vodPlayerQuitBtn];
312 _currentTimer = [NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(timeChange) userInfo:nil repeats:YES]; 320 _currentTimer = [NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(timeChange) userInfo:nil repeats:YES];
313 321
@@ -469,6 +477,7 @@ @@ -469,6 +477,7 @@
469 { 477 {
470 case MPMovieFinishReasonPlaybackEnded: 478 case MPMovieFinishReasonPlaybackEnded:
471 _bgView.anchorStatus = 3; // 点播播放结束 479 _bgView.anchorStatus = 3; // 点播播放结束
  480 + [_currentTimer invalidate];
472 NSLog(@"playbackStateDidChange: MPMovieFinishReasonPlaybackEnded: %d\n", reason); 481 NSLog(@"playbackStateDidChange: MPMovieFinishReasonPlaybackEnded: %d\n", reason);
473 break; 482 break;
474 483
@@ -566,9 +575,6 @@ @@ -566,9 +575,6 @@
566 575
567 - (void)anchorStatusChanged:(NSNotification *)notification // 获取主播状态通知 576 - (void)anchorStatusChanged:(NSNotification *)notification // 获取主播状态通知
568 { 577 {
569 - if (_player.anchorStatus == 2) { // 已结束  
570 -  
571 - }  
572 _bgView.anchorStatus = _player.anchorStatus; 578 _bgView.anchorStatus = _player.anchorStatus;
573 } 579 }
574 580
@@ -595,7 +601,6 @@ @@ -595,7 +601,6 @@
595 _liveBaseView.viewController = self; 601 _liveBaseView.viewController = self;
596 _liveBaseView.backgroundColor = [UIColor clearColor]; 602 _liveBaseView.backgroundColor = [UIColor clearColor];
597 [_liveBaseView.closeBtn addTarget:self action:@selector(quitBtnClick) forControlEvents:UIControlEventTouchUpInside]; 603 [_liveBaseView.closeBtn addTarget:self action:@selector(quitBtnClick) forControlEvents:UIControlEventTouchUpInside];
598 - [_liveBaseView addGestureRecognizer:_pan];  
599 } 604 }
600 return _liveBaseView; 605 return _liveBaseView;
601 } 606 }
@@ -631,7 +636,7 @@ @@ -631,7 +636,7 @@
631 _secondLoadView = [[LVCUGCPlayerLoadingView alloc] initWithFrame:self.view.bounds]; 636 _secondLoadView = [[LVCUGCPlayerLoadingView alloc] initWithFrame:self.view.bounds];
632 [_secondLoadView.bgImageView sd_setImageWithURL:[NSURL URLWithString:_model.coverImgUrl] placeholderImage:_blurImage]; 637 [_secondLoadView.bgImageView sd_setImageWithURL:[NSURL URLWithString:_model.coverImgUrl] placeholderImage:_blurImage];
633 [_viewSecond addSubview:_secondLoadView]; 638 [_viewSecond addSubview:_secondLoadView];
634 - // 点播退出按钮 639 + // 点播退出按钮(直播播放前期也需要,在直播加载完成后去掉)
635 [_viewSecond addSubview:self.vodPlayerQuitBtn]; 640 [_viewSecond addSubview:self.vodPlayerQuitBtn];
636 _SecondY = 0; 641 _SecondY = 0;
637 } 642 }
@@ -753,7 +758,7 @@ @@ -753,7 +758,7 @@
753 758
754 // 当前播放时间 759 // 当前播放时间
755 NSInteger currentSeconds = (NSInteger)_player.currentPlaybackTime; 760 NSInteger currentSeconds = (NSInteger)_player.currentPlaybackTime;
756 - NSLog(@"当前时间------> %ld",(long)currentSeconds); 761 + //NSLog(@"当前时间------> %ld",(long)currentSeconds);
757 NSInteger seconds = currentSeconds % 60; 762 NSInteger seconds = currentSeconds % 60;
758 NSInteger minutes = currentSeconds / 60; 763 NSInteger minutes = currentSeconds / 60;
759 NSInteger hours = minutes / 60; 764 NSInteger hours = minutes / 60;