Skip to content

Commit c65ffce

Browse files
author
ianyanzhang
committed
1、Upgrade SDK version to enhance user experience
1 parent 58d1ead commit c65ffce

File tree

19 files changed

+130
-315
lines changed

19 files changed

+130
-315
lines changed

Demo/Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def common_pods_all
2727
pod 'AFNetworking'
2828
pod 'BlocksKit', '~> 2.2.5'
2929
pod 'CWStatusBarNotification', '~> 2.3.5'
30-
pod 'TXLiteAVSDK_Player', '~> 11.2.14217'
30+
pod 'TXLiteAVSDK_Player', '~> 11.3.14327'
3131
end
3232

3333
def common_pods_smart

Demo/TXLiteAVDemo/SuperPlayFeedDemo/Controller/FeedPlayViewController.m

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,15 @@ - (void)setPlayerView:(SuperPlayerView *)playerView {
419419
}
420420

421421
///SuperPlayerDelegate
422+
-(void)superPlayerFullScreenChanged:(SuperPlayerView *)player {
423+
if (player.isFullScreen) {
424+
player.disableGesture = YES;
425+
[player showOrHideBackBtn:YES];
426+
} else {
427+
player.disableGesture = NO;
428+
[player showOrHideBackBtn:NO];
429+
}
430+
}
422431
-(void)backHookAction{
423432

424433
[self.navigationController popViewControllerAnimated:NO];

Demo/TXLiteAVDemo/SuperPlayFeedDemo/Utils/FeedRequestUtil.m

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ + (void)getPlayInfo:(int)appId
2424
code:-1
2525
userInfo:@{NSLocalizedDescriptionKey : [NSString stringWithFormat:@"parameter error"]}];
2626
completion(nil, error);
27+
return;
2728
}
2829
}
2930

@@ -50,6 +51,7 @@ + (void)getPlayInfo:(int)appId
5051
if (error) {
5152
if (completion) {
5253
completion(nil, error);
54+
return;
5355
}
5456
}
5557

@@ -59,6 +61,7 @@ + (void)getPlayInfo:(int)appId
5961
code:-1
6062
userInfo:@{NSLocalizedDescriptionKey : @"request error", NSLocalizedFailureReasonErrorKey : @"content is nil"}];
6163
completion(nil, error);
64+
return;
6265
}
6366
}
6467

@@ -71,6 +74,7 @@ + (void)getPlayInfo:(int)appId
7174
code:-2
7275
userInfo:@{NSLocalizedDescriptionKey : @"invalid format"}];
7376
completion(nil, error);
77+
return;
7478
}
7579
}
7680

@@ -81,6 +85,7 @@ + (void)getPlayInfo:(int)appId
8185
code:code
8286
userInfo:@{NSLocalizedDescriptionKey : dict[@"message"]}];
8387
completion(nil, error);
88+
return;
8489
}
8590
}
8691

@@ -103,6 +108,7 @@ + (void)getPlayInfo:(int)appId
103108

104109
if (completion) {
105110
completion(dic, nil);
111+
return;
106112
}
107113

108114
} @catch (NSException *exception) {
@@ -111,6 +117,7 @@ + (void)getPlayInfo:(int)appId
111117
code:-2
112118
userInfo:@{NSLocalizedDescriptionKey : @"invalid format"}];
113119
completion(nil, error);
120+
return;
114121
}
115122
}
116123
}];

Demo/TXLiteAVDemo/SuperPlayFeedDemo/Views/Cell/FeedTableViewCell.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ typedef NS_ENUM(NSUInteger, FeedCellStyle) {
3434
/**
3535
全屏
3636
*/
37-
- (void)showFullScreenViewWithPlayView:(SuperPlayerView *)superPlayerView cell:(FeedTableViewCell *)cell;
37+
- (void)showFullScreenViewWithPlayView:(SuperPlayerView *)superPlayerView indexPath:(NSIndexPath *)indexPath;
3838
///屏幕旋转
3939
- (void)screenRotation:(BOOL)fullScreen;
4040
@end

Demo/TXLiteAVDemo/SuperPlayFeedDemo/Views/Cell/FeedTableViewCell.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ - (void)superPlayerDidStart {
7575
}
7676
}
7777
-(void)showFullScreenViewWithPlayView:(SuperPlayerView *)superPlayerView {
78-
if (self.delegate && [self.delegate respondsToSelector:@selector(showFullScreenViewWithPlayView:cell:)]){
79-
[self.delegate showFullScreenViewWithPlayView:superPlayerView cell:self];
78+
if (self.delegate && [self.delegate respondsToSelector:@selector(showFullScreenViewWithPlayView:indexPath:)]){
79+
[self.delegate showFullScreenViewWithPlayView:superPlayerView indexPath:self.indexPath];
8080
}
8181
}
8282
- (void)screenRotation:(BOOL)fullScreen {

Demo/TXLiteAVDemo/SuperPlayFeedDemo/Views/FeedBaseView/FeedBaseView.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ NS_ASSUME_NONNULL_BEGIN
3838

3939
@property (nonatomic, weak) id<FeedBaseViewDelegate> delegate;
4040

41-
@property (nonatomic, strong) SuperPlayerView *superPlayView;
41+
@property (nonatomic, strong, nullable) SuperPlayerView *superPlayView;
4242

4343
@property (nonatomic, strong) FeedHeadView *headView;
4444

Demo/TXLiteAVDemo/SuperPlayFeedDemo/Views/FeedBaseView/FeedBaseView.m

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ - (instancetype)init {
3131
if (self = [super init]) {
3232
self.backgroundColor = [UIColor colorWithRed:14.0/255.0 green:24.0/255.0 blue:47.0/255.0 alpha:1.0];
3333
[self addSubview:self.fatherView];
34-
[self.fatherView addSubview:self.superPlayView];
34+
self.superPlayView = [self createSuperPlayView];
35+
self.superPlayView.fatherView = self.fatherView;
3536
[self addSubview:self.headView];
3637
[self addSubview:self.marginView];
3738

@@ -78,6 +79,14 @@ - (void)setModel:(FeedVideoModel *)model {
7879
headModel.videoSubTitleStr = model.videoIntroduce;
7980

8081
[self.headView setHeadModel:headModel];
82+
83+
if (self.superPlayView == nil ) { ///如果为nil 说明这个视频窗口被移动到了横屏VC或者详情VC
84+
///tableview发生了reload导致不再是原来的cell
85+
self.superPlayView = [self createSuperPlayView]; ///
86+
self.superPlayView.fatherView = self.fatherView;
87+
}
88+
89+
8190
[self.superPlayView.controlView setTitle:model.title];
8291
[self playVideoWithModel:model];
8392
}
@@ -98,7 +107,11 @@ - (void)playVideoWithModel:(FeedVideoModel *)model {
98107
playerModel.multiVideoURLs = model.multiVideoURLs;
99108
self.playerModel = playerModel;
100109
[self.superPlayView.coverImageView sd_setImageWithURL:[NSURL URLWithString:model.coverUrl] placeholderImage:SuperPlayerImage(@"defaultCoverImage")];
101-
self.superPlayView.centerPlayBtn.hidden = NO;
110+
if (self.superPlayView.state == StatePlaying) {
111+
self.superPlayView.centerPlayBtn.hidden = YES;
112+
} else {
113+
self.superPlayView.centerPlayBtn.hidden = NO;
114+
}
102115
self.superPlayView.controlView.hidden = YES;
103116
[self.superPlayView showOrHideBackBtn:NO];
104117
SPDefaultControlView *defaultControlView = (SPDefaultControlView *)self.superPlayView.controlView;
@@ -131,9 +144,10 @@ - (void)resetPlayer {
131144
}
132145

133146
- (void)addSuperPlayView:(UIView *)view {
147+
[self.superPlayView pause];
148+
[self.superPlayView removeFromSuperview];
134149
self.superPlayView = (SuperPlayerView *)view;
135150
self.superPlayView.delegate = self;
136-
[self addSubview:self.superPlayView];
137151
self.superPlayView.fatherView = self.fatherView;
138152
[self.superPlayView mas_makeConstraints:^(MASConstraintMaker *make) {
139153
make.top.equalTo(self).offset(8);
@@ -142,6 +156,12 @@ - (void)addSuperPlayView:(UIView *)view {
142156
make.height.mas_equalTo(cellHeight);
143157
}];
144158

159+
if (self.superPlayView.state == StatePlaying) {
160+
self.superPlayView.centerPlayBtn.hidden = YES;
161+
} else {
162+
self.superPlayView.centerPlayBtn.hidden = NO;
163+
}
164+
145165

146166
}
147167

@@ -179,6 +199,7 @@ - (void)screenRotation:(BOOL)fullScreen {
179199
-(void)fullScreenHookAction {
180200
if (self.delegate && [self.delegate respondsToSelector:@selector(showFullScreenViewWithPlayView:)]){
181201
[self.delegate showFullScreenViewWithPlayView:self.superPlayView];
202+
self.superPlayView = nil;
182203
}
183204
}
184205
#pragma mark - 懒加载
@@ -197,16 +218,15 @@ - (UIView *)marginView {
197218
return _marginView;
198219
}
199220

200-
- (SuperPlayerView *)superPlayView {
201-
if (!_superPlayView) {
202-
_superPlayView = [SuperPlayerView new];
203-
_superPlayView.fatherView = self.fatherView;
204-
_superPlayView.backgroundColor = [UIColor clearColor];
205-
_superPlayView.disableGesture = NO;
206-
_superPlayView.delegate = self;
207-
_superPlayView.disableVolumControl = YES;
208-
}
209-
return _superPlayView;
221+
222+
- (SuperPlayerView *)createSuperPlayView {
223+
SuperPlayerView *superPlayView = [SuperPlayerView new];
224+
superPlayView.fatherView = self.fatherView;
225+
superPlayView.backgroundColor = [UIColor clearColor];
226+
superPlayView.disableGesture = NO;
227+
superPlayView.delegate = self;
228+
superPlayView.disableVolumControl = YES;
229+
return superPlayView;
210230
}
211231

212232
- (FeedHeadView *)headView {

Demo/TXLiteAVDemo/SuperPlayFeedDemo/Views/SuperFeedPlayView.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ NS_ASSUME_NONNULL_BEGIN
2929
/**
3030
显示详情页的处理
3131
*/
32-
- (void)showFeedDetailViewWithHeadModel:(FeedHeadModel *)model videoModel:(FeedVideoModel *)videoModel playView:(SuperPlayerView *)superPlayView;
32+
- (void)showFeedDetailViewWithHeadModel:(FeedHeadModel *)model
33+
videoModel:(FeedVideoModel *)videoModel
34+
playView:(SuperPlayerView *)superPlayView;
3335
/**
3436
全屏
3537
*/

Demo/TXLiteAVDemo/SuperPlayFeedDemo/Views/SuperFeedPlayView.m

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ @interface SuperFeedPlayView()<UITableViewDelegate, UITableViewDataSource, UIScr
2727
@property (nonatomic, assign) NSInteger currentPlayIndex;
2828

2929
@property (nonatomic, assign) BOOL isRefresh;
30+
31+
@property (nonatomic, strong) NSIndexPath *indexPath; ///横屏的cell
3032
@end
3133

3234
@implementation SuperFeedPlayView
@@ -81,11 +83,12 @@ - (void)finishLoadMore {
8183
}
8284

8385
- (void)addSuperPlayView:(UIView *)view {
86+
FeedTableViewCell *cell = [self.tableView cellForRowAtIndexPath:self.indexPath];
8487
if ([NSThread isMainThread]) {
85-
[self.tapTableViewCell addSuperPlayView:view];
88+
[cell addSuperPlayView:view];
8689
} else {
8790
dispatch_async(dispatch_get_main_queue(), ^{
88-
[self.tapTableViewCell addSuperPlayView:view];
91+
[cell addSuperPlayView:view];
8992
});
9093
}
9194
}
@@ -147,7 +150,9 @@ - (void)playVideoFromCell:(FeedTableViewCell *)cell {
147150
for (UITableViewCell *cell in cells) {
148151
if (cell != self.currentTableViewCell) {
149152
FeedTableViewCell *cel = (FeedTableViewCell *)cell;
150-
[cel pause];
153+
if (cel.baseView.superPlayView.state == StatePlaying) {
154+
[cel pause];
155+
}
151156
}
152157
}
153158
}
@@ -269,9 +274,11 @@ - (void)headViewClickWithCell:(FeedTableViewCell *)cell {
269274
[self.currentTableViewCell pause];
270275
}
271276
self.tapTableViewCell = cell;
272-
[cell.baseView.superPlayView removeFromSuperview];
273-
274-
[self.delegate showFeedDetailViewWithHeadModel:headModel videoModel:cell.model playView:cell.baseView.superPlayView];
277+
self.indexPath = cell.indexPath;
278+
[self.delegate showFeedDetailViewWithHeadModel:headModel
279+
videoModel:cell.model
280+
playView:cell.baseView.superPlayView];
281+
cell.baseView.superPlayView = nil;
275282
}
276283
}
277284

@@ -287,18 +294,21 @@ - (void)superPlayerDidStartWithCell:(FeedTableViewCell *)cell {
287294
for (UITableViewCell *cell in cells) {
288295
if (cell != self.currentTableViewCell) {
289296
FeedTableViewCell *cel = (FeedTableViewCell *)cell;
290-
[cel pause];
297+
if (cel.baseView.superPlayView.state == StatePlaying) {
298+
[cel pause];
299+
}
291300
}
292301
}
293302
}
294303

295-
-(void)showFullScreenViewWithPlayView:(SuperPlayerView *)superPlayerView cell:(nonnull FeedTableViewCell *)cell{
304+
-(void)showFullScreenViewWithPlayView:(SuperPlayerView *)superPlayerView
305+
indexPath:(NSIndexPath *)indexPath{
306+
self.indexPath = indexPath;
307+
FeedTableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];
296308
if (self.delegate && [self.delegate respondsToSelector:@selector(showFullScreenViewWithPlayView:)]){
297309
if (cell != self.currentTableViewCell) {
298310
[self.currentTableViewCell pause];
299311
}
300-
self.tapTableViewCell = cell;
301-
[cell.baseView.superPlayView removeFromSuperview];
302312
[self.delegate showFullScreenViewWithPlayView:superPlayerView];
303313
}
304314
}
@@ -339,6 +349,7 @@ - (void)tableView:(UITableView *)tableView didEndDisplayingCell:(UITableViewCell
339349
if (self.currentTableViewCell == cell) {
340350
self.currentTableViewCell = nil;
341351
}
352+
[(FeedTableViewCell *)cell pause];
342353
}
343354

344355
// 松手时已经静止,只会调用scrollViewDidEndDragging

Demo/TXLiteAVDemo/SuperPlayerDemo/SuperPlayer/CacheView/VideoCacheListView/VideoCacheListModel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// Copyright © 2022年 Tencent. All rights reserved.
77

88
#import <Foundation/Foundation.h>
9-
#import "TXVodDownloadManager.h"
9+
@class TXVodDownloadMediaInfo;
1010

1111
NS_ASSUME_NONNULL_BEGIN
1212

0 commit comments

Comments
 (0)