Commit 5a8369c0a5cb580b69603b594b2246fc41c05cef
1 parent
a01ebdf5
0.0.5 修改上拉下拉视频从新播放问题
Showing
3 changed files
with
18 additions
and
15 deletions
CNLiveWitnessVideoModule.podspec
CNLiveWitnessVideoModule/Classes/Controller/CNBWitnessListController.m
| ... | ... | @@ -73,10 +73,10 @@ NSString * const kIdentifier = @"CNBWitnessListCell"; |
| 73 | 73 | [_dataSource addObject:witnessModel]; |
| 74 | 74 | } |
| 75 | 75 | }else { |
| 76 | - NSDictionary *dic = list[currentIndex]; | |
| 76 | + _currentPlayIndex = 0; | |
| 77 | + NSDictionary *dic = list[_currentPlayIndex]; | |
| 77 | 78 | CNBWitnessListModel *witnessModel = [CNBWitnessListModel mj_objectWithKeyValues:dic]; |
| 78 | 79 | [_dataSource addObject:witnessModel]; |
| 79 | - _currentPlayIndex = 0; | |
| 80 | 80 | } |
| 81 | 81 | _pageIndex = pageNum + 1; |
| 82 | 82 | _isHaveNext = @"1"; |
| ... | ... | @@ -403,7 +403,7 @@ NSString * const kIdentifier = @"CNBWitnessListCell"; |
| 403 | 403 | #pragma mark - scrollViewDelegate |
| 404 | 404 | - (void)scrollViewDidScroll:(UIScrollView *)scrollView { |
| 405 | 405 | NSInteger currentIndex = round(scrollView.contentOffset.y / KScreenHeight); |
| 406 | - if (currentIndex != self.currentPlayIndex && !self.isRefreshMore) { | |
| 406 | + if (currentIndex != self.currentPlayIndex && !self.isRefreshMore && [self.type isEqualToString:@"0"]) { | |
| 407 | 407 | [self.videoPlayerManager resetPlayer]; |
| 408 | 408 | self.currentPlayIndex = currentIndex; |
| 409 | 409 | if (!self.isRefreshMore && [self.isHaveNext isEqualToString:@"1"]) { |
| ... | ... | @@ -415,26 +415,29 @@ NSString * const kIdentifier = @"CNBWitnessListCell"; |
| 415 | 415 | } |
| 416 | 416 | - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView { |
| 417 | 417 | NSLog(@"播放下一个"); |
| 418 | - if (self.currentPlayIndex >= 0 && self.dataSource.count > self.currentPlayIndex) { | |
| 419 | - if ([CNLiveNetworking isNetworking]) { | |
| 420 | - if ([CNLiveNetworking isWiFiNetwork]) { | |
| 421 | - [self playIndex:self.currentPlayIndex isAutoPlay:YES]; | |
| 422 | - }else if ([CNLiveNetworking isWWANNetwork]) { | |
| 423 | - BOOL isAgress4G = [[NSUserDefaults standardUserDefaults] objectForKey:@"isAgress4G"]; | |
| 424 | - if (isAgress4G) { | |
| 418 | + if ([self.type isEqualToString:@"0"]) { | |
| 419 | + if (self.currentPlayIndex >= 0 && self.dataSource.count > self.currentPlayIndex) { | |
| 420 | + if ([CNLiveNetworking isNetworking]) { | |
| 421 | + if ([CNLiveNetworking isWiFiNetwork]) { | |
| 425 | 422 | [self playIndex:self.currentPlayIndex isAutoPlay:YES]; |
| 423 | + }else if ([CNLiveNetworking isWWANNetwork]) { | |
| 424 | + BOOL isAgress4G = [[NSUserDefaults standardUserDefaults] objectForKey:@"isAgress4G"]; | |
| 425 | + if (isAgress4G) { | |
| 426 | + [self playIndex:self.currentPlayIndex isAutoPlay:YES]; | |
| 427 | + }else { | |
| 428 | + [self playIndex:self.currentPlayIndex isAutoPlay:NO]; | |
| 429 | + } | |
| 426 | 430 | }else { |
| 427 | 431 | [self playIndex:self.currentPlayIndex isAutoPlay:NO]; |
| 428 | 432 | } |
| 429 | - }else { | |
| 430 | - [self playIndex:self.currentPlayIndex isAutoPlay:NO]; | |
| 431 | 433 | } |
| 432 | 434 | } |
| 433 | 435 | } |
| 436 | + | |
| 434 | 437 | } |
| 435 | 438 | - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate { |
| 436 | 439 | CGFloat currentIndex = scrollView.contentOffset.y / KScreenHeight; |
| 437 | - if(fabs(currentIndex - self.currentPlayIndex)>1) { | |
| 440 | + if((fabs(currentIndex - self.currentPlayIndex)>1) && [self.type isEqualToString:@"0"]) { | |
| 438 | 441 | [self.videoPlayerManager resetPlayer]; |
| 439 | 442 | } |
| 440 | 443 | } | ... | ... |
Example/CNLiveWitnessVideoModule/CNLIVEViewController.m
| ... | ... | @@ -35,7 +35,7 @@ |
| 35 | 35 | } |
| 36 | 36 | - (void)setUPCollectionView { |
| 37 | 37 | UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc]init]; |
| 38 | - CGFloat itemWidth = (KScreenWidth - 40) / 3; | |
| 38 | + CGFloat itemWidth = (KScreenWidth - 60) / 3; | |
| 39 | 39 | |
| 40 | 40 | //设置单元格大小 |
| 41 | 41 | layout.itemSize = CGSizeMake(itemWidth, itemWidth); | ... | ... |