Commit ca9f3d3fce886d4a23af83f85229749bf847ce8c
1 parent
38ed8805
更改点播退出按钮位置,加载时也可退出;增加播放错误提示窗
Showing
1 changed file
with
21 additions
and
5 deletions
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Controller/LVCUGCLivePlayerController.m
| @@ -125,7 +125,6 @@ | @@ -125,7 +125,6 @@ | ||
| 125 | [self.viewSecond addSubview:_player.view]; | 125 | [self.viewSecond addSubview:_player.view]; |
| 126 | [self.viewSecond sendSubviewToBack:_player.view]; | 126 | [self.viewSecond sendSubviewToBack:_player.view]; |
| 127 | [_player.view addGestureRecognizer:_pan]; | 127 | [_player.view addGestureRecognizer:_pan]; |
| 128 | - [_player.view addSubview:self.vodPlayerQuitBtn]; | ||
| 129 | 128 | ||
| 130 | } authFailed:^(NSDictionary *errorInfo) { | 129 | } authFailed:^(NSDictionary *errorInfo) { |
| 131 | NSLog(@"初始化点播播放器失败%@", errorInfo); | 130 | NSLog(@"初始化点播播放器失败%@", errorInfo); |
| @@ -188,6 +187,7 @@ | @@ -188,6 +187,7 @@ | ||
| 188 | if (_index >= 0) { | 187 | if (_index >= 0) { |
| 189 | if ([_playArray[_index].activityStatus isEqualToString:@"2"]) { | 188 | if ([_playArray[_index].activityStatus isEqualToString:@"2"]) { |
| 190 | 189 | ||
| 190 | + [_viewSecond addSubview:self.vodPlayerQuitBtn]; | ||
| 191 | _player = [[CNLiveMoviePlayerController alloc] initVodPlayWithVId:_playArray[_index].activityId | 191 | _player = [[CNLiveMoviePlayerController alloc] initVodPlayWithVId:_playArray[_index].activityId |
| 192 | authSuccess:^{ | 192 | authSuccess:^{ |
| 193 | 193 | ||
| @@ -198,7 +198,6 @@ | @@ -198,7 +198,6 @@ | ||
| 198 | [_viewSecond addSubview:_player.view]; | 198 | [_viewSecond addSubview:_player.view]; |
| 199 | [_viewSecond sendSubviewToBack:_player.view]; | 199 | [_viewSecond sendSubviewToBack:_player.view]; |
| 200 | [_player.view addGestureRecognizer:_pan]; | 200 | [_player.view addGestureRecognizer:_pan]; |
| 201 | - [_player.view addSubview:self.vodPlayerQuitBtn]; | ||
| 202 | 201 | ||
| 203 | } authFailed:^(NSDictionary *errorInfo) { | 202 | } authFailed:^(NSDictionary *errorInfo) { |
| 204 | NSLog(@"初始化点播播放器失败%@", errorInfo); | 203 | NSLog(@"初始化点播播放器失败%@", errorInfo); |
| @@ -276,6 +275,7 @@ | @@ -276,6 +275,7 @@ | ||
| 276 | 275 | ||
| 277 | if ([_playArray[_index].activityStatus isEqualToString:@"2"]) { | 276 | if ([_playArray[_index].activityStatus isEqualToString:@"2"]) { |
| 278 | 277 | ||
| 278 | + [_viewSecond addSubview:self.vodPlayerQuitBtn]; | ||
| 279 | _player = [[CNLiveMoviePlayerController alloc] initVodPlayWithVId:_playArray[_index].activityId | 279 | _player = [[CNLiveMoviePlayerController alloc] initVodPlayWithVId:_playArray[_index].activityId |
| 280 | authSuccess:^{ | 280 | authSuccess:^{ |
| 281 | 281 | ||
| @@ -286,7 +286,6 @@ | @@ -286,7 +286,6 @@ | ||
| 286 | [_viewSecond addSubview:_player.view]; | 286 | [_viewSecond addSubview:_player.view]; |
| 287 | [_viewSecond sendSubviewToBack:_player.view]; | 287 | [_viewSecond sendSubviewToBack:_player.view]; |
| 288 | [_player.view addGestureRecognizer:_pan]; | 288 | [_player.view addGestureRecognizer:_pan]; |
| 289 | - [_player.view addSubview:self.vodPlayerQuitBtn]; | ||
| 290 | 289 | ||
| 291 | } authFailed:^(NSDictionary *errorInfo) { | 290 | } authFailed:^(NSDictionary *errorInfo) { |
| 292 | NSLog(@"初始化点播播放器失败%@", errorInfo); | 291 | NSLog(@"初始化点播播放器失败%@", errorInfo); |
| @@ -355,8 +354,8 @@ | @@ -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 | [[NSNotificationCenter defaultCenter] addObserver:self | 361 | [[NSNotificationCenter defaultCenter] addObserver:self |
| @@ -387,9 +386,23 @@ | @@ -387,9 +386,23 @@ | ||
| 387 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(anchorStatusChanged:) | 386 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(anchorStatusChanged:) |
| 388 | name:CNLiveAnchorStatusChangedNotification | 387 | name:CNLiveAnchorStatusChangedNotification |
| 389 | object:nil]; | 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 | #pragma mark - 通知 Action !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 406 | #pragma mark - 通知 Action !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 394 | - (void)loadStateDidChange:(NSNotification *)notification //视频加载状态改变 | 407 | - (void)loadStateDidChange:(NSNotification *)notification //视频加载状态改变 |
| 395 | { | 408 | { |
| @@ -429,6 +442,7 @@ | @@ -429,6 +442,7 @@ | ||
| 429 | 442 | ||
| 430 | case MPMovieFinishReasonPlaybackError: | 443 | case MPMovieFinishReasonPlaybackError: |
| 431 | NSLog(@"playbackStateDidChange: MPMovieFinishReasonPlaybackError: %d\n", reason); | 444 | NSLog(@"playbackStateDidChange: MPMovieFinishReasonPlaybackError: %d\n", reason); |
| 445 | + [self toast:@"MPMovieFinishReasonPlaybackError"]; | ||
| 432 | break; | 446 | break; |
| 433 | 447 | ||
| 434 | default: | 448 | default: |
| @@ -553,6 +567,8 @@ | @@ -553,6 +567,8 @@ | ||
| 553 | _secondLoadView = [[LVCUGCPlayerLoadingView alloc] initWithFrame:self.view.bounds]; | 567 | _secondLoadView = [[LVCUGCPlayerLoadingView alloc] initWithFrame:self.view.bounds]; |
| 554 | [_secondLoadView.bgImageView sd_setImageWithURL:[NSURL URLWithString:_model.coverImgUrl] placeholderImage:_blurImage]; | 568 | [_secondLoadView.bgImageView sd_setImageWithURL:[NSURL URLWithString:_model.coverImgUrl] placeholderImage:_blurImage]; |
| 555 | [_viewSecond addSubview:_secondLoadView]; | 569 | [_viewSecond addSubview:_secondLoadView]; |
| 570 | + // 点播退出按钮 | ||
| 571 | + [_viewSecond addSubview:self.vodPlayerQuitBtn]; | ||
| 556 | _SecondY = 0; | 572 | _SecondY = 0; |
| 557 | } | 573 | } |
| 558 | return _viewSecond; | 574 | return _viewSecond; |