Commit 005e66a858a4f9a39f42fb9c20cce35ecfaa4feb

Authored by 王军波
1 parent 4ffbacf1

播放添加互动,互动添加切换视频手势,添加退出监听事件

LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Controller/LVCUGCLivePlayerController.m
@@ -68,6 +68,10 @@ @@ -68,6 +68,10 @@
68 [self.view addSubview:self.viewSecond]; 68 [self.view addSubview:self.viewSecond];
69 [self.view addSubview:self.viewThird]; 69 [self.view addSubview:self.viewThird];
70 70
  71 + if ([_model.activityStatus isEqualToString:@"1"]) {
  72 + [self addLiveBaseView];
  73 + }
  74 +
71 [self.view addSubview:self.bgView]; 75 [self.view addSubview:self.bgView];
72 76
73 if ([_model.activityStatus isEqualToString:@"0"]) { 77 if ([_model.activityStatus isEqualToString:@"0"]) {
@@ -86,9 +90,16 @@ @@ -86,9 +90,16 @@
86 90
87 - (void)addLiveBaseView 91 - (void)addLiveBaseView
88 { 92 {
  93 + [self.liveBaseView removeFromSuperview];
89 [_viewSecond addSubview:self.liveBaseView ]; 94 [_viewSecond addSubview:self.liveBaseView ];
90 } 95 }
91 96
  97 +- (void)quitBtnClick { // 退出
  98 +
  99 + [_player stop];
  100 + [self.navigationController popViewControllerAnimated:YES];
  101 +}
  102 +
92 - (void)setModel:(LVCUGCLivePlayerModel *)model { 103 - (void)setModel:(LVCUGCLivePlayerModel *)model {
93 104
94 if (_model != model) { 105 if (_model != model) {
@@ -99,7 +110,7 @@ @@ -99,7 +110,7 @@
99 [self installMovieNotificationObservers]; 110 [self installMovieNotificationObservers];
100 111
101 if ([model.activityStatus isEqualToString:@"1"]) { 112 if ([model.activityStatus isEqualToString:@"1"]) {
102 - [self addLiveBaseView]; 113 +
103 _player = [[CNLiveMoviePlayerController alloc] initLivePlayWithChannelId:model.channelId 114 _player = [[CNLiveMoviePlayerController alloc] initLivePlayWithChannelId:model.channelId
104 authSuccess:^{ 115 authSuccess:^{
105 116
@@ -109,7 +120,6 @@ @@ -109,7 +120,6 @@
109 [_player prepareToPlay]; 120 [_player prepareToPlay];
110 [self.viewSecond addSubview:_player.view]; 121 [self.viewSecond addSubview:_player.view];
111 [self.viewSecond sendSubviewToBack:_player.view]; 122 [self.viewSecond sendSubviewToBack:_player.view];
112 - [_player.view addGestureRecognizer:_pan];  
113 123
114 } authFailed:^(NSDictionary *errorInfo) { 124 } authFailed:^(NSDictionary *errorInfo) {
115 NSLog(@"初始化直播播放器失败:%@", errorInfo); 125 NSLog(@"初始化直播播放器失败:%@", errorInfo);
@@ -223,7 +233,6 @@ @@ -223,7 +233,6 @@
223 [_player prepareToPlay]; 233 [_player prepareToPlay];
224 [_viewSecond addSubview:_player.view]; 234 [_viewSecond addSubview:_player.view];
225 [_viewSecond sendSubviewToBack:_player.view]; 235 [_viewSecond sendSubviewToBack:_player.view];
226 - [_player.view addGestureRecognizer:_pan];  
227 236
228 } authFailed:^(NSDictionary *errorInfo) { 237 } authFailed:^(NSDictionary *errorInfo) {
229 NSLog(@"初始化直播播放器失败:%@", errorInfo); 238 NSLog(@"初始化直播播放器失败:%@", errorInfo);
@@ -311,7 +320,6 @@ @@ -311,7 +320,6 @@
311 [_player prepareToPlay]; 320 [_player prepareToPlay];
312 [_viewSecond addSubview:_player.view]; 321 [_viewSecond addSubview:_player.view];
313 [_viewSecond sendSubviewToBack:_player.view]; 322 [_viewSecond sendSubviewToBack:_player.view];
314 - [_player.view addGestureRecognizer:_pan];  
315 323
316 } authFailed:^(NSDictionary *errorInfo) { 324 } authFailed:^(NSDictionary *errorInfo) {
317 NSLog(@"初始化直播播放器失败:%@", errorInfo); 325 NSLog(@"初始化直播播放器失败:%@", errorInfo);
@@ -550,10 +558,11 @@ @@ -550,10 +558,11 @@
550 if (!_liveBaseView) 558 if (!_liveBaseView)
551 { 559 {
552 _liveBaseView = [LiveBaseView liveBaseView]; 560 _liveBaseView = [LiveBaseView liveBaseView];
553 - _liveBaseView.jumpType = JumpControllerTypePresent; 561 + _liveBaseView.jumpType = JumpControllerTypePush;
554 _liveBaseView.viewController = self; 562 _liveBaseView.viewController = self;
555 _liveBaseView.backgroundColor = [UIColor clearColor]; 563 _liveBaseView.backgroundColor = [UIColor clearColor];
556 [_liveBaseView.closeBtn addTarget:self action:@selector(quitBtnClick) forControlEvents:UIControlEventTouchUpInside]; 564 [_liveBaseView.closeBtn addTarget:self action:@selector(quitBtnClick) forControlEvents:UIControlEventTouchUpInside];
  565 + [_liveBaseView addGestureRecognizer:_pan];
557 } 566 }
558 return _liveBaseView; 567 return _liveBaseView;
559 } 568 }
@@ -601,7 +610,9 @@ @@ -601,7 +610,9 @@
601 _viewThird = [[UIView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT)]; 610 _viewThird = [[UIView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT)];
602 _viewThird.backgroundColor = [UIColor blackColor]; 611 _viewThird.backgroundColor = [UIColor blackColor];
603 _thirdLoadView = [[LVCUGCPlayerLoadingView alloc] initWithFrame:self.view.bounds]; 612 _thirdLoadView = [[LVCUGCPlayerLoadingView alloc] initWithFrame:self.view.bounds];
604 - [_thirdLoadView.bgImageView sd_setImageWithURL:[NSURL URLWithString:_playArray[_index+1].coverImgUrl] placeholderImage:_blurImage]; 613 + if (_index <= _playArray.count - 2 ) {
  614 + [_thirdLoadView.bgImageView sd_setImageWithURL:[NSURL URLWithString:_playArray[_index+1].coverImgUrl] placeholderImage:_blurImage];
  615 + }
605 [_viewThird addSubview:_thirdLoadView]; 616 [_viewThird addSubview:_thirdLoadView];
606 _ThirdY = SCREEN_HEIGHT; 617 _ThirdY = SCREEN_HEIGHT;
607 } 618 }