|
@@ -18,7 +18,9 @@
|
|
|
#import "JXCollectionViewController.h"
|
|
#import "JXCollectionViewController.h"
|
|
|
#import "JXCommentViewController.h"
|
|
#import "JXCommentViewController.h"
|
|
|
#import <TXLiteAVSDK_Player/TXLiteAVSDK.h>
|
|
#import <TXLiteAVSDK_Player/TXLiteAVSDK.h>
|
|
|
-@interface JXDetailViewController () <JXSuperPlayerDelegate, UICollectionViewDelegate, UICollectionViewDataSource,JXCollectionViewControllerDelegate,TXVodPlayListener>
|
|
|
|
|
|
|
+@interface JXDetailViewController () <JXSuperPlayerDelegate, UICollectionViewDelegate, UICollectionViewDataSource,JXCollectionViewControllerDelegate,TXVodPlayListener>{
|
|
|
|
|
+ JXSuperPlayer *_currentPlayer;
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
// 播放器
|
|
// 播放器
|
|
|
@property (nonatomic, strong) UIView *playerContainer;
|
|
@property (nonatomic, strong) UIView *playerContainer;
|
|
@@ -43,6 +45,7 @@
|
|
|
@property (nonatomic, assign) NSInteger currentEpisodeIndex;
|
|
@property (nonatomic, assign) NSInteger currentEpisodeIndex;
|
|
|
@property (strong, nonatomic) UISlider *videoSlider;
|
|
@property (strong, nonatomic) UISlider *videoSlider;
|
|
|
@property (nonatomic,assign) BOOL isHuadong;
|
|
@property (nonatomic,assign) BOOL isHuadong;
|
|
|
|
|
+@property (strong, nonatomic) NSMutableArray *playerList;
|
|
|
@end
|
|
@end
|
|
|
|
|
|
|
|
@implementation JXDetailViewController
|
|
@implementation JXDetailViewController
|
|
@@ -184,6 +187,12 @@
|
|
|
[cell.contentView sendSubviewToBack:playerContainer];
|
|
[cell.contentView sendSubviewToBack:playerContainer];
|
|
|
// 创建播放器
|
|
// 创建播放器
|
|
|
JXSuperPlayer *player = [[JXSuperPlayer alloc] initWithContainerView:playerContainer];
|
|
JXSuperPlayer *player = [[JXSuperPlayer alloc] initWithContainerView:playerContainer];
|
|
|
|
|
+// if (self.playerList.count > indexPath.item) {
|
|
|
|
|
+// JXSuperPlayer *sp = self.playerList[indexPath.item];
|
|
|
|
|
+// [sp releasePlayer];
|
|
|
|
|
+// [self.playerList removeObject:sp];
|
|
|
|
|
+// }
|
|
|
|
|
+// [self.playerList insertObject:player atIndex:indexPath.item];
|
|
|
player.delegate = self;
|
|
player.delegate = self;
|
|
|
// 右侧互动按钮
|
|
// 右侧互动按钮
|
|
|
[self setupInteractionButtonsForCell:cell];
|
|
[self setupInteractionButtonsForCell:cell];
|
|
@@ -360,8 +369,13 @@
|
|
|
|
|
|
|
|
- (void)collectionView:(UICollectionView *)collectionView didEndDisplayingCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath {
|
|
- (void)collectionView:(UICollectionView *)collectionView didEndDisplayingCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath {
|
|
|
// 停止不可见的播放器
|
|
// 停止不可见的播放器
|
|
|
|
|
+ NSLog(@"消失的cell----%d",indexPath.item);
|
|
|
|
|
+// JXSuperPlayer *player = [self.playerList objectAtIndex:indexPath.item];
|
|
|
|
|
+// [player pause];
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+//- (void)collectionView:(UICollectionView *)collectionView willDisplayCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath{
|
|
|
|
|
+// NSLog(@"出现的cell----%d",indexPath.item);
|
|
|
|
|
+//}
|
|
|
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
|
|
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
|
|
|
// 获取当前可见的cell索引
|
|
// 获取当前可见的cell索引
|
|
|
CGFloat pageWidth = scrollView.frame.size.width;
|
|
CGFloat pageWidth = scrollView.frame.size.width;
|
|
@@ -384,6 +398,10 @@
|
|
|
// JXEpisode *episode = self.episodes[currentPage];
|
|
// JXEpisode *episode = self.episodes[currentPage];
|
|
|
// JXSuperPlayer *player = [[JXSuperPlayer alloc] initWithContainerView:playerContainer];
|
|
// JXSuperPlayer *player = [[JXSuperPlayer alloc] initWithContainerView:playerContainer];
|
|
|
// player.delegate = self;
|
|
// player.delegate = self;
|
|
|
|
|
+// if (_currentPlayer) {
|
|
|
|
|
+// [_currentPlayer releasePlayer];
|
|
|
|
|
+// }
|
|
|
|
|
+// _currentPlayer = player;
|
|
|
// // 播放视频
|
|
// // 播放视频
|
|
|
// [player playWithAppId:episode.appId fileId:episode.fileId psign:episode.psign];
|
|
// [player playWithAppId:episode.appId fileId:episode.fileId psign:episode.psign];
|
|
|
|
|
|
|
@@ -454,5 +472,10 @@
|
|
|
- (void)dealloc {
|
|
- (void)dealloc {
|
|
|
// 停止所有播放器
|
|
// 停止所有播放器
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+- (NSMutableArray *)playerList{
|
|
|
|
|
+ if (!_playerList) {
|
|
|
|
|
+ _playerList = [NSMutableArray array];
|
|
|
|
|
+ }
|
|
|
|
|
+ return _playerList;
|
|
|
|
|
+}
|
|
|
@end
|
|
@end
|