Commit 0e4a3cb43595044496f43cd70ecac93765119251

Authored by 王军波
1 parent 68183f61

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

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