Commit ca9f3d3fce886d4a23af83f85229749bf847ce8c

Authored by 王军波
1 parent 38ed8805

更改点播退出按钮位置,加载时也可退出;增加播放错误提示窗

LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Controller/LVCUGCLivePlayerController.m
... ... @@ -125,7 +125,6 @@
125 125 [self.viewSecond addSubview:_player.view];
126 126 [self.viewSecond sendSubviewToBack:_player.view];
127 127 [_player.view addGestureRecognizer:_pan];
128   - [_player.view addSubview:self.vodPlayerQuitBtn];
129 128  
130 129 } authFailed:^(NSDictionary *errorInfo) {
131 130 NSLog(@"初始化点播播放器失败%@", errorInfo);
... ... @@ -188,6 +187,7 @@
188 187 if (_index >= 0) {
189 188 if ([_playArray[_index].activityStatus isEqualToString:@"2"]) {
190 189  
  190 + [_viewSecond addSubview:self.vodPlayerQuitBtn];
191 191 _player = [[CNLiveMoviePlayerController alloc] initVodPlayWithVId:_playArray[_index].activityId
192 192 authSuccess:^{
193 193  
... ... @@ -198,7 +198,6 @@
198 198 [_viewSecond addSubview:_player.view];
199 199 [_viewSecond sendSubviewToBack:_player.view];
200 200 [_player.view addGestureRecognizer:_pan];
201   - [_player.view addSubview:self.vodPlayerQuitBtn];
202 201  
203 202 } authFailed:^(NSDictionary *errorInfo) {
204 203 NSLog(@"初始化点播播放器失败%@", errorInfo);
... ... @@ -276,6 +275,7 @@
276 275  
277 276 if ([_playArray[_index].activityStatus isEqualToString:@"2"]) {
278 277  
  278 + [_viewSecond addSubview:self.vodPlayerQuitBtn];
279 279 _player = [[CNLiveMoviePlayerController alloc] initVodPlayWithVId:_playArray[_index].activityId
280 280 authSuccess:^{
281 281  
... ... @@ -286,7 +286,6 @@
286 286 [_viewSecond addSubview:_player.view];
287 287 [_viewSecond sendSubviewToBack:_player.view];
288 288 [_player.view addGestureRecognizer:_pan];
289   - [_player.view addSubview:self.vodPlayerQuitBtn];
290 289  
291 290 } authFailed:^(NSDictionary *errorInfo) {
292 291 NSLog(@"初始化点播播放器失败%@", errorInfo);
... ... @@ -355,8 +354,8 @@
355 354 }
356 355 }
357 356  
358   -#pragma mark - 添加通知监听 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
359   --(void)installMovieNotificationObservers //添加视频播放通知
  357 +#pragma mark - Action !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  358 +-(void)installMovieNotificationObservers //添加视频播放通知监听
360 359 {
361 360 //视频加载状态改变
362 361 [[NSNotificationCenter defaultCenter] addObserver:self
... ... @@ -387,9 +386,23 @@
387 386 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(anchorStatusChanged:)
388 387 name:CNLiveAnchorStatusChangedNotification
389 388 object:nil];
  389 +}
  390 +
  391 +- (void)toast:(NSString*)message { // 提示框
390 392  
  393 + UIAlertView *toast = [[UIAlertView alloc] initWithTitle:nil
  394 + message:message
  395 + delegate:nil
  396 + cancelButtonTitle:nil
  397 + otherButtonTitles:nil, nil];
  398 + [toast show];
  399 + double duration = 2.5;
  400 + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(duration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  401 + [toast dismissWithClickedButtonIndex:0 animated:NO];
  402 + });
391 403 }
392 404  
  405 +
393 406 #pragma mark - 通知 Action !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
394 407 - (void)loadStateDidChange:(NSNotification *)notification //视频加载状态改变
395 408 {
... ... @@ -429,6 +442,7 @@
429 442  
430 443 case MPMovieFinishReasonPlaybackError:
431 444 NSLog(@"playbackStateDidChange: MPMovieFinishReasonPlaybackError: %d\n", reason);
  445 + [self toast:@"MPMovieFinishReasonPlaybackError"];
432 446 break;
433 447  
434 448 default:
... ... @@ -553,6 +567,8 @@
553 567 _secondLoadView = [[LVCUGCPlayerLoadingView alloc] initWithFrame:self.view.bounds];
554 568 [_secondLoadView.bgImageView sd_setImageWithURL:[NSURL URLWithString:_model.coverImgUrl] placeholderImage:_blurImage];
555 569 [_viewSecond addSubview:_secondLoadView];
  570 + // 点播退出按钮
  571 + [_viewSecond addSubview:self.vodPlayerQuitBtn];
556 572 _SecondY = 0;
557 573 }
558 574 return _viewSecond;
... ...