Commit 6fe20d89af8dc7dfa8e17c524bd7a5b0aae9ca75
1 parent
93d0c87d
点播退出按钮,根据播放状态设置背景图,判越界
Showing
2 changed files
with
232 additions
and
74 deletions
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Controller/LVCUGCLivePlayerController.h
| @@ -7,7 +7,14 @@ | @@ -7,7 +7,14 @@ | ||
| 7 | // | 7 | // |
| 8 | 8 | ||
| 9 | #import <UIKit/UIKit.h> | 9 | #import <UIKit/UIKit.h> |
| 10 | +#import "LVCUGCLivePlayerModel.h" | ||
| 10 | 11 | ||
| 11 | @interface LVCUGCLivePlayerController : UIViewController | 12 | @interface LVCUGCLivePlayerController : UIViewController |
| 12 | 13 | ||
| 14 | +@property (nonatomic, strong) LVCUGCLivePlayerModel *model; | ||
| 15 | + | ||
| 16 | +@property (nonatomic, strong) NSArray <LVCUGCLivePlayerModel *>*playArray; | ||
| 17 | + | ||
| 18 | +@property (nonatomic, assign) NSInteger index; | ||
| 19 | + | ||
| 13 | @end | 20 | @end |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Controller/LVCUGCLivePlayerController.m
| @@ -10,6 +10,7 @@ | @@ -10,6 +10,7 @@ | ||
| 10 | #import <CNLivePlayerSDK/CNLiveWebcastManager.h> | 10 | #import <CNLivePlayerSDK/CNLiveWebcastManager.h> |
| 11 | #import "LVCUGCPlayerLoadingView.h" | 11 | #import "LVCUGCPlayerLoadingView.h" |
| 12 | #import "LVCUGCBackgroundView.h" | 12 | #import "LVCUGCBackgroundView.h" |
| 13 | +#import "UIImage+LVCVagueImage.h" | ||
| 13 | 14 | ||
| 14 | 15 | ||
| 15 | @interface LVCUGCLivePlayerController () { | 16 | @interface LVCUGCLivePlayerController () { |
| @@ -22,6 +23,7 @@ | @@ -22,6 +23,7 @@ | ||
| 22 | LVCUGCPlayerLoadingView *_firstLoadView; | 23 | LVCUGCPlayerLoadingView *_firstLoadView; |
| 23 | LVCUGCPlayerLoadingView *_secondLoadView; | 24 | LVCUGCPlayerLoadingView *_secondLoadView; |
| 24 | LVCUGCPlayerLoadingView *_thirdLoadView; | 25 | LVCUGCPlayerLoadingView *_thirdLoadView; |
| 26 | + UIImage *_blurImage; | ||
| 25 | } | 27 | } |
| 26 | 28 | ||
| 27 | @property (nonatomic, strong) UIView *viewOne; | 29 | @property (nonatomic, strong) UIView *viewOne; |
| @@ -32,6 +34,8 @@ | @@ -32,6 +34,8 @@ | ||
| 32 | 34 | ||
| 33 | @property (nonatomic, strong) LVCUGCBackgroundView *bgView; // 背景视图 | 35 | @property (nonatomic, strong) LVCUGCBackgroundView *bgView; // 背景视图 |
| 34 | 36 | ||
| 37 | +@property (nonatomic, strong) UIButton *vodPlayerQuitBtn; | ||
| 38 | + | ||
| 35 | @end | 39 | @end |
| 36 | 40 | ||
| 37 | @implementation LVCUGCLivePlayerController | 41 | @implementation LVCUGCLivePlayerController |
| @@ -54,44 +58,92 @@ | @@ -54,44 +58,92 @@ | ||
| 54 | [super viewDidLoad]; | 58 | [super viewDidLoad]; |
| 55 | 59 | ||
| 56 | self.view.backgroundColor = [UIColor whiteColor]; | 60 | self.view.backgroundColor = [UIColor whiteColor]; |
| 61 | + NSString *path = [[NSBundle mainBundle] pathForResource:@"UGCLoading" ofType:@"jpeg"]; | ||
| 62 | + UIImage *image = [UIImage imageWithContentsOfFile:path]; | ||
| 63 | + _blurImage = [UIImage boxblurImage:image withBlurNumber:0.6]; | ||
| 57 | 64 | ||
| 58 | [self.view addSubview:self.viewOne]; | 65 | [self.view addSubview:self.viewOne]; |
| 59 | [self.view addSubview:self.viewSecond]; | 66 | [self.view addSubview:self.viewSecond]; |
| 60 | [self.view addSubview:self.viewThird]; | 67 | [self.view addSubview:self.viewThird]; |
| 61 | 68 | ||
| 62 | - _pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panGesture:)]; | 69 | + [self.view addSubview:self.bgView]; |
| 63 | 70 | ||
| 64 | - [self installMovieNotificationObservers]; | 71 | + if ([_model.activityStatus isEqualToString:@"0"]) { |
| 72 | + | ||
| 73 | + _bgView.anchorStatus = 4; | ||
| 74 | + | ||
| 75 | + } else if ([_model.activityStatus isEqualToString:@"4"]) { | ||
| 76 | + | ||
| 77 | + _bgView.anchorStatus = 5; | ||
| 78 | + | ||
| 79 | + } else if ([_model.activityStatus isEqualToString:@"-2"]) { | ||
| 80 | + | ||
| 81 | + _bgView.anchorStatus = 6; | ||
| 82 | + } | ||
| 83 | +} | ||
| 84 | + | ||
| 85 | +- (void)setModel:(LVCUGCLivePlayerModel *)model { | ||
| 65 | 86 | ||
| 66 | - _player = [[CNLiveMoviePlayerController alloc] initLivePlayWithChannelId:@"iOStest" | ||
| 67 | - authSuccess:^{ | ||
| 68 | - | ||
| 69 | - _player.videoDecoderMode = CNLiveMovieVideoDecoderMode_AUTO; | ||
| 70 | - _player.view.frame = self.view.bounds; | ||
| 71 | - _player.shouldAutoplay = YES; | ||
| 72 | - [_player prepareToPlay]; | ||
| 73 | - [_viewSecond addSubview:_player.view]; | ||
| 74 | - [_viewSecond sendSubviewToBack:_player.view]; | ||
| 75 | - [_player.view addGestureRecognizer:_pan]; | ||
| 76 | - | ||
| 77 | - } authFailed:^(NSDictionary *errorInfo) { | ||
| 78 | - NSLog(@"初始化直播播放器失败:%@", errorInfo); | ||
| 79 | - | ||
| 80 | - } getAnchorStatusResult:^(BOOL result) { | ||
| 81 | - | ||
| 82 | - NSLog(@"-------------获取主播状态%d", result ? YES : NO); | ||
| 83 | - | ||
| 84 | - }]; | 87 | + if (_model != model) { |
| 88 | + _model = model; | ||
| 89 | + } | ||
| 85 | 90 | ||
| 86 | - [self.view addSubview:self.bgView]; | 91 | + _pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panGesture:)]; |
| 92 | + [self installMovieNotificationObservers]; | ||
| 93 | + | ||
| 94 | + if ([model.activityStatus isEqualToString:@"1"]) { | ||
| 95 | + | ||
| 96 | + _player = [[CNLiveMoviePlayerController alloc] initLivePlayWithChannelId:model.channelId | ||
| 97 | + authSuccess:^{ | ||
| 98 | + | ||
| 99 | + _player.videoDecoderMode = CNLiveMovieVideoDecoderMode_AUTO; | ||
| 100 | + _player.view.frame = self.view.bounds; | ||
| 101 | + _player.shouldAutoplay = YES; | ||
| 102 | + [_player prepareToPlay]; | ||
| 103 | + [self.viewSecond addSubview:_player.view]; | ||
| 104 | + [self.viewSecond sendSubviewToBack:_player.view]; | ||
| 105 | + [_player.view addGestureRecognizer:_pan]; | ||
| 106 | + | ||
| 107 | + } authFailed:^(NSDictionary *errorInfo) { | ||
| 108 | + NSLog(@"初始化直播播放器失败:%@", errorInfo); | ||
| 109 | + | ||
| 110 | + } getAnchorStatusResult:^(BOOL result) { | ||
| 111 | + | ||
| 112 | + NSLog(@"-------------获取主播状态%d", result ? YES : NO); | ||
| 113 | + | ||
| 114 | + }]; | ||
| 115 | + | ||
| 116 | + } else if ([model.activityStatus isEqualToString:@"2"]) { | ||
| 117 | + | ||
| 118 | + _player = [[CNLiveMoviePlayerController alloc] initVodPlayWithVId:model.activityId | ||
| 119 | + authSuccess:^{ | ||
| 120 | + | ||
| 121 | + _player.videoDecoderMode = CNLiveMovieVideoDecoderMode_AUTO; | ||
| 122 | + _player.view.frame = self.view.bounds; | ||
| 123 | + _player.shouldAutoplay = YES; | ||
| 124 | + [_player prepareToPlay]; | ||
| 125 | + [self.viewSecond addSubview:_player.view]; | ||
| 126 | + [self.viewSecond sendSubviewToBack:_player.view]; | ||
| 127 | + [_player.view addGestureRecognizer:_pan]; | ||
| 128 | + [_player.view addSubview:self.vodPlayerQuitBtn]; | ||
| 129 | + | ||
| 130 | + } authFailed:^(NSDictionary *errorInfo) { | ||
| 131 | + NSLog(@"初始化点播播放器失败%@", errorInfo); | ||
| 132 | + }]; | ||
| 133 | + | ||
| 134 | + } | ||
| 87 | } | 135 | } |
| 88 | 136 | ||
| 89 | #pragma mark - UIPanGestureRecognizer !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 137 | #pragma mark - UIPanGestureRecognizer !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 90 | - (void)panGesture:(UIPanGestureRecognizer *)recognizer { | 138 | - (void)panGesture:(UIPanGestureRecognizer *)recognizer { |
| 91 | 139 | ||
| 92 | - CGPoint t = [recognizer translationInView:_viewSecond]; | 140 | + CGPoint t = [recognizer translationInView:self.viewSecond]; |
| 93 | NSLog(@"移动距离>>>>>>>>>>>>>>%f",t.y); | 141 | NSLog(@"移动距离>>>>>>>>>>>>>>%f",t.y); |
| 94 | 142 | ||
| 143 | + if (((_index == 0) && (t.y > 0)) || ((_index == (_playArray.count - 1)) && (t.y < 0))) { | ||
| 144 | + return; | ||
| 145 | + } | ||
| 146 | + | ||
| 95 | _viewOne.frame = CGRectMake(0, _oneY + t.y, SCREEN_WIDTH, SCREEN_HEIGHT); | 147 | _viewOne.frame = CGRectMake(0, _oneY + t.y, SCREEN_WIDTH, SCREEN_HEIGHT); |
| 96 | _viewSecond.frame = CGRectMake(0, _SecondY + t.y, SCREEN_WIDTH, SCREEN_HEIGHT); | 148 | _viewSecond.frame = CGRectMake(0, _SecondY + t.y, SCREEN_WIDTH, SCREEN_HEIGHT); |
| 97 | _viewThird.frame = CGRectMake(0, _ThirdY + t.y, SCREEN_WIDTH, SCREEN_HEIGHT); | 149 | _viewThird.frame = CGRectMake(0, _ThirdY + t.y, SCREEN_WIDTH, SCREEN_HEIGHT); |
| @@ -116,6 +168,10 @@ | @@ -116,6 +168,10 @@ | ||
| 116 | 168 | ||
| 117 | } completion:^(BOOL finished) { | 169 | } completion:^(BOOL finished) { |
| 118 | 170 | ||
| 171 | + _index = _index - 1; | ||
| 172 | + if (_vodPlayerQuitBtn) { | ||
| 173 | + [_vodPlayerQuitBtn removeFromSuperview]; | ||
| 174 | + } | ||
| 119 | [_player.view removeFromSuperview]; | 175 | [_player.view removeFromSuperview]; |
| 120 | [_player stop]; | 176 | [_player stop]; |
| 121 | _player = nil; | 177 | _player = nil; |
| @@ -127,26 +183,63 @@ | @@ -127,26 +183,63 @@ | ||
| 127 | _viewOne = _viewThird; | 183 | _viewOne = _viewThird; |
| 128 | _viewThird = _viewSecond; | 184 | _viewThird = _viewSecond; |
| 129 | _viewSecond = _tempView; | 185 | _viewSecond = _tempView; |
| 186 | + | ||
| 130 | //往下滑 播放上一个 | 187 | //往下滑 播放上一个 |
| 131 | - _player = [[CNLiveMoviePlayerController alloc] initLivePlayWithChannelId:@"iOStest" | ||
| 132 | - authSuccess:^{ | ||
| 133 | - | ||
| 134 | - _player.videoDecoderMode = CNLiveMovieVideoDecoderMode_AUTO; | ||
| 135 | - _player.view.frame = self.view.bounds; | ||
| 136 | - _player.shouldAutoplay = YES; | ||
| 137 | - [_player prepareToPlay]; | ||
| 138 | - [_viewSecond addSubview:_player.view]; | ||
| 139 | - [_viewSecond sendSubviewToBack:_player.view]; | ||
| 140 | - [_player.view addGestureRecognizer:_pan]; | ||
| 141 | - | ||
| 142 | - } authFailed:^(NSDictionary *errorInfo) { | ||
| 143 | - NSLog(@"初始化直播播放器失败:%@", errorInfo); | ||
| 144 | - | ||
| 145 | - } getAnchorStatusResult:^(BOOL result) { | ||
| 146 | - | ||
| 147 | - NSLog(@"-------------获取主播状态%d", result ? YES : NO); | ||
| 148 | - | ||
| 149 | - }]; | 188 | + if (_index >= 0) { |
| 189 | + if ([_playArray[_index].activityStatus isEqualToString:@"2"]) { | ||
| 190 | + | ||
| 191 | + _player = [[CNLiveMoviePlayerController alloc] initVodPlayWithVId:_playArray[_index].activityId | ||
| 192 | + authSuccess:^{ | ||
| 193 | + | ||
| 194 | + _player.videoDecoderMode = CNLiveMovieVideoDecoderMode_AUTO; | ||
| 195 | + _player.view.frame = self.view.bounds; | ||
| 196 | + _player.shouldAutoplay = YES; | ||
| 197 | + [_player prepareToPlay]; | ||
| 198 | + [_viewSecond addSubview:_player.view]; | ||
| 199 | + [_viewSecond sendSubviewToBack:_player.view]; | ||
| 200 | + [_player.view addGestureRecognizer:_pan]; | ||
| 201 | + [_player.view addSubview:self.vodPlayerQuitBtn]; | ||
| 202 | + | ||
| 203 | + } authFailed:^(NSDictionary *errorInfo) { | ||
| 204 | + NSLog(@"初始化点播播放器失败%@", errorInfo); | ||
| 205 | + }]; | ||
| 206 | + | ||
| 207 | + } else if ([_playArray[_index].activityStatus isEqualToString:@"1"]) { | ||
| 208 | + | ||
| 209 | + | ||
| 210 | + _player = [[CNLiveMoviePlayerController alloc] initLivePlayWithChannelId:_playArray[_index].channelId | ||
| 211 | + authSuccess:^{ | ||
| 212 | + | ||
| 213 | + _player.videoDecoderMode = CNLiveMovieVideoDecoderMode_AUTO; | ||
| 214 | + _player.view.frame = self.view.bounds; | ||
| 215 | + _player.shouldAutoplay = YES; | ||
| 216 | + [_player prepareToPlay]; | ||
| 217 | + [_viewSecond addSubview:_player.view]; | ||
| 218 | + [_viewSecond sendSubviewToBack:_player.view]; | ||
| 219 | + [_player.view addGestureRecognizer:_pan]; | ||
| 220 | + | ||
| 221 | + } authFailed:^(NSDictionary *errorInfo) { | ||
| 222 | + NSLog(@"初始化直播播放器失败:%@", errorInfo); | ||
| 223 | + | ||
| 224 | + } getAnchorStatusResult:^(BOOL result) { | ||
| 225 | + | ||
| 226 | + NSLog(@"-------------获取主播状态%d", result ? YES : NO); | ||
| 227 | + | ||
| 228 | + }]; | ||
| 229 | + } else if ([_playArray[_index].activityStatus isEqualToString:@"0"]) { | ||
| 230 | + | ||
| 231 | + | ||
| 232 | + _bgView.anchorStatus = 4; | ||
| 233 | + | ||
| 234 | + } else if ([_playArray[_index].activityStatus isEqualToString:@"4"]) { | ||
| 235 | + | ||
| 236 | + _bgView.anchorStatus = 5; | ||
| 237 | + | ||
| 238 | + } else if ([_playArray[_index].activityStatus isEqualToString:@"-2"]) { | ||
| 239 | + | ||
| 240 | + _bgView.anchorStatus = 6; | ||
| 241 | + } | ||
| 242 | + } | ||
| 150 | 243 | ||
| 151 | _oneY = _viewOne.frame.origin.y; | 244 | _oneY = _viewOne.frame.origin.y; |
| 152 | _SecondY = _viewSecond.frame.origin.y; | 245 | _SecondY = _viewSecond.frame.origin.y; |
| @@ -162,6 +255,10 @@ | @@ -162,6 +255,10 @@ | ||
| 162 | 255 | ||
| 163 | } completion:^(BOOL finished) { | 256 | } completion:^(BOOL finished) { |
| 164 | 257 | ||
| 258 | + _index = _index + 1; | ||
| 259 | + if (_vodPlayerQuitBtn) { | ||
| 260 | + [_vodPlayerQuitBtn removeFromSuperview]; | ||
| 261 | + } | ||
| 165 | [_player.view removeFromSuperview]; | 262 | [_player.view removeFromSuperview]; |
| 166 | [_player stop]; | 263 | [_player stop]; |
| 167 | _player = nil; | 264 | _player = nil; |
| @@ -173,27 +270,63 @@ | @@ -173,27 +270,63 @@ | ||
| 173 | _viewOne = _viewSecond; | 270 | _viewOne = _viewSecond; |
| 174 | _viewSecond = _viewThird; | 271 | _viewSecond = _viewThird; |
| 175 | _viewThird = _tempView; | 272 | _viewThird = _tempView; |
| 176 | - [_viewSecond addGestureRecognizer:_pan]; | 273 | + |
| 177 | //往上滑 播放下一个 | 274 | //往上滑 播放下一个 |
| 178 | - _player = [[CNLiveMoviePlayerController alloc] initLivePlayWithChannelId:@"iOStest" | ||
| 179 | - authSuccess:^{ | ||
| 180 | - | ||
| 181 | - _player.videoDecoderMode = CNLiveMovieVideoDecoderMode_AUTO; | ||
| 182 | - _player.view.frame = self.view.bounds; | ||
| 183 | - _player.shouldAutoplay = YES; | ||
| 184 | - [_player prepareToPlay]; | ||
| 185 | - [_viewSecond addSubview:_player.view]; | ||
| 186 | - [_viewSecond sendSubviewToBack:_player.view]; | ||
| 187 | - [_player.view addGestureRecognizer:_pan]; | ||
| 188 | - | ||
| 189 | - } authFailed:^(NSDictionary *errorInfo) { | ||
| 190 | - NSLog(@"初始化直播播放器失败:%@", errorInfo); | ||
| 191 | - | ||
| 192 | - } getAnchorStatusResult:^(BOOL result) { | ||
| 193 | - | ||
| 194 | - NSLog(@"-------------获取主播状态%d", result ? YES : NO); | ||
| 195 | - | ||
| 196 | - }]; | 275 | + if (_index < _playArray.count) { // 判越界 |
| 276 | + | ||
| 277 | + if ([_playArray[_index].activityStatus isEqualToString:@"2"]) { | ||
| 278 | + | ||
| 279 | + _player = [[CNLiveMoviePlayerController alloc] initVodPlayWithVId:_playArray[_index].activityId | ||
| 280 | + authSuccess:^{ | ||
| 281 | + | ||
| 282 | + _player.videoDecoderMode = CNLiveMovieVideoDecoderMode_AUTO; | ||
| 283 | + _player.view.frame = self.view.bounds; | ||
| 284 | + _player.shouldAutoplay = YES; | ||
| 285 | + [_player prepareToPlay]; | ||
| 286 | + [_viewSecond addSubview:_player.view]; | ||
| 287 | + [_viewSecond sendSubviewToBack:_player.view]; | ||
| 288 | + [_player.view addGestureRecognizer:_pan]; | ||
| 289 | + [_player.view addSubview:self.vodPlayerQuitBtn]; | ||
| 290 | + | ||
| 291 | + } authFailed:^(NSDictionary *errorInfo) { | ||
| 292 | + NSLog(@"初始化点播播放器失败%@", errorInfo); | ||
| 293 | + }]; | ||
| 294 | + | ||
| 295 | + } else if ([_playArray[_index].activityStatus isEqualToString:@"1"]) { | ||
| 296 | + | ||
| 297 | + _player = [[CNLiveMoviePlayerController alloc] initLivePlayWithChannelId:_playArray[_index].channelId | ||
| 298 | + authSuccess:^{ | ||
| 299 | + | ||
| 300 | + _player.videoDecoderMode = CNLiveMovieVideoDecoderMode_AUTO; | ||
| 301 | + _player.view.frame = self.view.bounds; | ||
| 302 | + _player.shouldAutoplay = YES; | ||
| 303 | + [_player prepareToPlay]; | ||
| 304 | + [_viewSecond addSubview:_player.view]; | ||
| 305 | + [_viewSecond sendSubviewToBack:_player.view]; | ||
| 306 | + [_player.view addGestureRecognizer:_pan]; | ||
| 307 | + | ||
| 308 | + } authFailed:^(NSDictionary *errorInfo) { | ||
| 309 | + NSLog(@"初始化直播播放器失败:%@", errorInfo); | ||
| 310 | + | ||
| 311 | + } getAnchorStatusResult:^(BOOL result) { | ||
| 312 | + | ||
| 313 | + NSLog(@"-------------获取主播状态%d", result ? YES : NO); | ||
| 314 | + | ||
| 315 | + }]; | ||
| 316 | + } else if ([_playArray[_index].activityStatus isEqualToString:@"0"]) { | ||
| 317 | + | ||
| 318 | + _bgView.anchorStatus = 4; | ||
| 319 | + | ||
| 320 | + } else if ([_playArray[_index].activityStatus isEqualToString:@"4"]) { | ||
| 321 | + | ||
| 322 | + _bgView.anchorStatus = 5; | ||
| 323 | + | ||
| 324 | + } else if ([_playArray[_index].activityStatus isEqualToString:@"-2"]) { | ||
| 325 | + | ||
| 326 | + _bgView.anchorStatus = 6; | ||
| 327 | + } | ||
| 328 | + | ||
| 329 | + } | ||
| 197 | 330 | ||
| 198 | _oneY = _viewOne.frame.origin.y; | 331 | _oneY = _viewOne.frame.origin.y; |
| 199 | _SecondY = _viewSecond.frame.origin.y; | 332 | _SecondY = _viewSecond.frame.origin.y; |
| @@ -209,6 +342,7 @@ | @@ -209,6 +342,7 @@ | ||
| 209 | _viewThird.frame = CGRectMake(0, _ThirdY, SCREEN_WIDTH, SCREEN_HEIGHT); | 342 | _viewThird.frame = CGRectMake(0, _ThirdY, SCREEN_WIDTH, SCREEN_HEIGHT); |
| 210 | 343 | ||
| 211 | } completion:^(BOOL finished) { | 344 | } completion:^(BOOL finished) { |
| 345 | + | ||
| 212 | _oneY = _viewOne.frame.origin.y; | 346 | _oneY = _viewOne.frame.origin.y; |
| 213 | _SecondY = _viewSecond.frame.origin.y; | 347 | _SecondY = _viewSecond.frame.origin.y; |
| 214 | _ThirdY = _viewThird.frame.origin.y; | 348 | _ThirdY = _viewThird.frame.origin.y; |
| @@ -281,16 +415,11 @@ | @@ -281,16 +415,11 @@ | ||
| 281 | { | 415 | { |
| 282 | if (_player) { | 416 | if (_player) { |
| 283 | int reason = [[[notification userInfo] valueForKey:MPMoviePlayerPlaybackDidFinishReasonUserInfoKey] intValue]; | 417 | int reason = [[[notification userInfo] valueForKey:MPMoviePlayerPlaybackDidFinishReasonUserInfoKey] intValue]; |
| 284 | - if (MPMovieFinishReasonPlaybackError == reason) { | ||
| 285 | - | ||
| 286 | - | ||
| 287 | - } else { | ||
| 288 | - | ||
| 289 | - } | ||
| 290 | 418 | ||
| 291 | switch (reason) | 419 | switch (reason) |
| 292 | { | 420 | { |
| 293 | case MPMovieFinishReasonPlaybackEnded: | 421 | case MPMovieFinishReasonPlaybackEnded: |
| 422 | + _bgView.anchorStatus = 3; // 点播播放结束 | ||
| 294 | NSLog(@"playbackStateDidChange: MPMovieFinishReasonPlaybackEnded: %d\n", reason); | 423 | NSLog(@"playbackStateDidChange: MPMovieFinishReasonPlaybackEnded: %d\n", reason); |
| 295 | break; | 424 | break; |
| 296 | 425 | ||
| @@ -315,12 +444,17 @@ | @@ -315,12 +444,17 @@ | ||
| 315 | if (_player) { | 444 | if (_player) { |
| 316 | NSLog(@"isPreparedToPlay"); | 445 | NSLog(@"isPreparedToPlay"); |
| 317 | 446 | ||
| 318 | - if (_viewSecond.subviews.count>0) { | ||
| 319 | - for (UIView *subViews in _viewSecond.subviews) { | ||
| 320 | - if ([subViews isKindOfClass:[LVCUGCPlayerLoadingView class]]) { | ||
| 321 | - [subViews removeFromSuperview]; | ||
| 322 | - } | ||
| 323 | - } | 447 | + [self removeSecondLoadingView]; |
| 448 | + } | ||
| 449 | +} | ||
| 450 | + | ||
| 451 | +- (void)removeSecondLoadingView { | ||
| 452 | + | ||
| 453 | + if (_viewSecond.subviews.count>0) { | ||
| 454 | + for (UIView *subViews in _viewSecond.subviews) { | ||
| 455 | + if ([subViews isKindOfClass:[LVCUGCPlayerLoadingView class]]) { | ||
| 456 | + [subViews removeFromSuperview]; | ||
| 457 | + } | ||
| 324 | } | 458 | } |
| 325 | } | 459 | } |
| 326 | } | 460 | } |
| @@ -383,6 +517,7 @@ | @@ -383,6 +517,7 @@ | ||
| 383 | #pragma mark - Button Action !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 517 | #pragma mark - Button Action !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 384 | - (void)backToList { | 518 | - (void)backToList { |
| 385 | 519 | ||
| 520 | + [_player stop]; | ||
| 386 | [self.navigationController popViewControllerAnimated:YES]; | 521 | [self.navigationController popViewControllerAnimated:YES]; |
| 387 | } | 522 | } |
| 388 | 523 | ||
| @@ -402,6 +537,9 @@ | @@ -402,6 +537,9 @@ | ||
| 402 | _viewOne = [[UIView alloc] initWithFrame:CGRectMake(0, -SCREEN_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT)]; | 537 | _viewOne = [[UIView alloc] initWithFrame:CGRectMake(0, -SCREEN_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT)]; |
| 403 | _viewOne.backgroundColor = [UIColor blackColor]; | 538 | _viewOne.backgroundColor = [UIColor blackColor]; |
| 404 | _firstLoadView = [[LVCUGCPlayerLoadingView alloc] initWithFrame:self.view.bounds]; | 539 | _firstLoadView = [[LVCUGCPlayerLoadingView alloc] initWithFrame:self.view.bounds]; |
| 540 | + if (_index > 0) { | ||
| 541 | + [_firstLoadView.bgImageView sd_setImageWithURL:[NSURL URLWithString:_playArray[_index-1].coverImgUrl] placeholderImage:_blurImage]; | ||
| 542 | + } | ||
| 405 | [_viewOne addSubview:_firstLoadView]; | 543 | [_viewOne addSubview:_firstLoadView]; |
| 406 | _oneY = -SCREEN_HEIGHT; | 544 | _oneY = -SCREEN_HEIGHT; |
| 407 | } | 545 | } |
| @@ -413,6 +551,7 @@ | @@ -413,6 +551,7 @@ | ||
| 413 | _viewSecond = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)]; | 551 | _viewSecond = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)]; |
| 414 | _viewSecond.backgroundColor = [UIColor blackColor]; | 552 | _viewSecond.backgroundColor = [UIColor blackColor]; |
| 415 | _secondLoadView = [[LVCUGCPlayerLoadingView alloc] initWithFrame:self.view.bounds]; | 553 | _secondLoadView = [[LVCUGCPlayerLoadingView alloc] initWithFrame:self.view.bounds]; |
| 554 | + [_secondLoadView.bgImageView sd_setImageWithURL:[NSURL URLWithString:_model.coverImgUrl] placeholderImage:_blurImage]; | ||
| 416 | [_viewSecond addSubview:_secondLoadView]; | 555 | [_viewSecond addSubview:_secondLoadView]; |
| 417 | _SecondY = 0; | 556 | _SecondY = 0; |
| 418 | } | 557 | } |
| @@ -424,12 +563,24 @@ | @@ -424,12 +563,24 @@ | ||
| 424 | _viewThird = [[UIView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT)]; | 563 | _viewThird = [[UIView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT)]; |
| 425 | _viewThird.backgroundColor = [UIColor blackColor]; | 564 | _viewThird.backgroundColor = [UIColor blackColor]; |
| 426 | _thirdLoadView = [[LVCUGCPlayerLoadingView alloc] initWithFrame:self.view.bounds]; | 565 | _thirdLoadView = [[LVCUGCPlayerLoadingView alloc] initWithFrame:self.view.bounds]; |
| 566 | + [_thirdLoadView.bgImageView sd_setImageWithURL:[NSURL URLWithString:_playArray[_index+1].coverImgUrl] placeholderImage:_blurImage]; | ||
| 427 | [_viewThird addSubview:_thirdLoadView]; | 567 | [_viewThird addSubview:_thirdLoadView]; |
| 428 | _ThirdY = SCREEN_HEIGHT; | 568 | _ThirdY = SCREEN_HEIGHT; |
| 429 | } | 569 | } |
| 430 | return _viewThird; | 570 | return _viewThird; |
| 431 | } | 571 | } |
| 432 | 572 | ||
| 573 | +- (UIButton *)vodPlayerQuitBtn { | ||
| 574 | + if (!_vodPlayerQuitBtn) { | ||
| 575 | + _vodPlayerQuitBtn = [UIButton buttonWithType:UIButtonTypeCustom]; | ||
| 576 | + _vodPlayerQuitBtn.frame = CGRectMake(SCREEN_WIDTH - 50, SCREEN_HEIGHT - 50, 40, 40); | ||
| 577 | + [_vodPlayerQuitBtn setImage:[UIImage imageNamed:@"LiveCloseNormal"] forState:UIControlStateNormal]; | ||
| 578 | + [_vodPlayerQuitBtn setImage:[UIImage imageNamed:@"LiveCloseTouch"] forState:UIControlStateHighlighted]; | ||
| 579 | + [_vodPlayerQuitBtn addTarget:self action:@selector(backToList) forControlEvents:UIControlEventTouchUpInside]; | ||
| 580 | + } | ||
| 581 | + return _vodPlayerQuitBtn; | ||
| 582 | +} | ||
| 583 | + | ||
| 433 | #pragma mark - 移除通知 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 584 | #pragma mark - 移除通知 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 434 | - (void)removeMovieNotificationObservers | 585 | - (void)removeMovieNotificationObservers |
| 435 | { | 586 | { |