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