Skip to content

Commit

Permalink
1、Update Demo
Browse files Browse the repository at this point in the history
  • Loading branch information
ianyanzhang committed Apr 10, 2023
1 parent 82bdf51 commit 357ca4d
Show file tree
Hide file tree
Showing 12 changed files with 373 additions and 46 deletions.
2 changes: 1 addition & 1 deletion Demo/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def common_pods_all
pod 'AFNetworking'
pod 'BlocksKit', '~> 2.2.5'
pod 'CWStatusBarNotification', '~> 2.3.5'
pod 'TXLiteAVSDK_Player', '~> 11.0.14028'
pod 'TXLiteAVSDK_Player', '~> 11.1.14125'
end

def common_pods_smart
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,17 +270,6 @@ - (SuperPlayerModel *)getSuperPlayModel {
playModel.videoId = videoId;
}

// 获取overlayKey和overlayIv
NSString *overlayStr = [[TXVodDownloadManager shareInstance] getOverlayKeyIv:self.mediaInfo.dataSource.appId
userName:self.mediaInfo.dataSource.userName
fileId:self.mediaInfo.dataSource.fileId
qualityId:(int)self.mediaInfo.dataSource.quality];
if (overlayStr.length > 0) {
NSArray *overlayArray = [overlayStr componentsSeparatedByString:@"_"];
playModel.overlayKey = overlayArray.firstObject;
playModel.overlayIv = overlayArray.lastObject;
}

playModel.customCoverImageUrl = _model.coverImageStr;
playModel.action = 0;
playModel.name = _model.videoName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -440,28 +440,38 @@ - (void)_refreshVODList {

videoArray = [NSMutableArray array];
p = [[TXPlayerAuthParams alloc] init];
p.appId = 1500005830;
p.fileId = @"243791578431393746";
p.appId = 1252463788;
p.fileId = @"5285890781763144364";
[videoArray addObject:p];
[_authParamArray addObject:videoArray];

videoArray = [NSMutableArray array];
TXMoviePlayInfoResponse *trackInfoResponse = [[TXMoviePlayInfoResponse alloc] init];
trackInfoResponse.name = playerLocalize(@"SuperPlayerDemo.MoviePlayer.multitrackvideo");
trackInfoResponse.videoUrl = MULTI_TRACK_VIDEO;
trackInfoResponse.isCache = NO;
trackInfoResponse.coverUrl = TRACK_COVERURL;
[videoArray addObject:trackInfoResponse];
p = [[TXPlayerAuthParams alloc] init];
p.appId = 1500005830;
p.fileId = @"243791578431393746";
[videoArray addObject:p];
[_authParamArray addObject:videoArray];

videoArray = [NSMutableArray array];
TXMoviePlayInfoResponse *subtitleInfoResponse = [[TXMoviePlayInfoResponse alloc] init];
subtitleInfoResponse.name = playerLocalize(@"SuperPlayerDemo.MoviePlayer.multisubtitledvideo");
subtitleInfoResponse.videoUrl = MULTI_SUBTITLES_VIDEO;
subtitleInfoResponse.isCache = NO;
subtitleInfoResponse.coverUrl = SUBTITLES_COVERURL;
[videoArray addObject:subtitleInfoResponse];
[_authParamArray addObject:videoArray];
NSDictionary *userDic = [[NSUserDefaults standardUserDefaults] objectForKey:@"vodConfig"];
if (userDic != nil && userDic.count > 0 && [[userDic objectForKey:@"resources"] intValue] == 1) {
videoArray = [NSMutableArray array];
TXMoviePlayInfoResponse *trackInfoResponse = [[TXMoviePlayInfoResponse alloc] init];
trackInfoResponse.name = playerLocalize(@"SuperPlayerDemo.MoviePlayer.multitrackvideo");
trackInfoResponse.videoUrl = MULTI_TRACK_VIDEO;
trackInfoResponse.isCache = NO;
trackInfoResponse.coverUrl = TRACK_COVERURL;
[videoArray addObject:trackInfoResponse];
[_authParamArray addObject:videoArray];

videoArray = [NSMutableArray array];
TXMoviePlayInfoResponse *subtitleInfoResponse = [[TXMoviePlayInfoResponse alloc] init];
subtitleInfoResponse.name = playerLocalize(@"SuperPlayerDemo.MoviePlayer.multisubtitledvideo");
subtitleInfoResponse.videoUrl = MULTI_SUBTITLES_VIDEO;
subtitleInfoResponse.isCache = NO;
subtitleInfoResponse.coverUrl = SUBTITLES_COVERURL;
[videoArray addObject:subtitleInfoResponse];
[_authParamArray addObject:videoArray];
}

// 增加轮播视频源
[self loadVideoListData];
Expand Down Expand Up @@ -1284,6 +1294,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
if (cell) {
if ([[cell getSource].title containsString:playerLocalize(@"SuperPlayerDemo.MoviePlayer.videopreview")]) {
[self.playerView showVipTipView];
defaultControlView.disablePipBtn = YES;
}

if ([[cell getSource].title containsString:playerLocalize(@"SuperPlayerDemo.MoviePlayer.videoplaylist")]) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#define MODEL_TAG_BEGIN 20
#define BOTTOM_IMAGE_VIEW_HEIGHT 50
#define FADEOUTTIME 5

@interface SPDefaultControlView () <UIGestureRecognizerDelegate, PlayerSliderDelegate,
SuperPlayerTrackViewDelegate, SuperPlayerSubtitlesViewDelegate>
Expand Down Expand Up @@ -71,6 +72,10 @@ - (instancetype)initWithFrame:(CGRect)frame {
self.trackView.hidden = YES;
self.subtitlesView.hidden = YES;
self.nextBtn.hidden = YES;

UILongPressGestureRecognizer *longPress=[[UILongPressGestureRecognizer alloc]initWithTarget:self action:@selector(longPressAction:)];
longPress.numberOfTouchesRequired = 1;
[self addGestureRecognizer:longPress];
// 初始化时重置controlView
[self playerResetControlView];
}
Expand All @@ -81,6 +86,14 @@ - (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
}

-(void)longPressAction:(UILongPressGestureRecognizer *)longPress{
if (!self.isFullScreen) {
return;
}
if ([self.delegate respondsToSelector:@selector(onLongPressAction:)]) {
[self.delegate onLongPressAction:longPress];
}
}
- (void)makeSubViewsConstraints {
[self.topImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.trailing.equalTo(self);
Expand Down Expand Up @@ -369,9 +382,19 @@ - (void)progressSliderValueChanged:(UISlider *)sender {
}

- (void)progressSliderTouchEnded:(UISlider *)sender {
[self.delegate controlViewSeek:self where:sender.value];
[self seekTo:sender.value];
}

- (void)onClickProgress:(UITapGestureRecognizer *)gesture{
CGPoint point = [gesture locationInView:self.videoSlider];
CGFloat progress = point.x / CGRectGetWidth(self.videoSlider.frame);
[self seekTo:progress];
}

- (void)seekTo:(CGFloat)pos{
[self.delegate controlViewSeek:self where:pos];
self.isDragging = NO;
[self fadeOut:5];
[self fadeOut:FADEOUTTIME];
}

- (void)backLiveClick:(UIButton *)sender {
Expand Down Expand Up @@ -668,6 +691,9 @@ - (PlayerSlider *)videoSlider {
[_videoSlider addTarget:self action:@selector(progressSliderValueChanged:) forControlEvents:UIControlEventValueChanged];
// slider结束滑动事件
[_videoSlider addTarget:self action:@selector(progressSliderTouchEnded:) forControlEvents:UIControlEventTouchUpInside | UIControlEventTouchUpOutside];
// slider点击seek事件
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onClickProgress:)];
[_videoSlider addGestureRecognizer:tapGesture];
_videoSlider.delegate = self;
}
return _videoSlider;
Expand Down Expand Up @@ -873,6 +899,12 @@ - (void)chooseSubtitlesInfo:(TXTrackInfo *)info preSubtitlesInfo:(TXTrackInfo *)
}
}

- (void)onSettingViewDoneClickWithDic:(NSMutableDictionary *)dic{
if (self.delegate && [self.delegate respondsToSelector:@selector(onSettingViewDoneClickWithDic:)]) {
[self.delegate onSettingViewDoneClickWithDic:dic];
}
}

#pragma mark - Public method

- (void)setHidden:(BOOL)hidden {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
- (void)controlViewSwitch:(UIView *)controlView withTrackInfo:(TXTrackInfo *)info preTrackInfo:(TXTrackInfo *)preInfo;
/** 切换字幕按钮事件 */
- (void)controlViewSwitch:(UIView *)controlView withSubtitlesInfo:(TXTrackInfo *)info preSubtitlesInfo:(TXTrackInfo *)preInfo;
/** 设置字幕样式按钮事件 */
- (void)onSettingViewDoneClickWithDic:(NSMutableDictionary *)dic;
/** 修改配置 */
- (void)controlViewConfigUpdate:(SuperPlayerControlView *)controlView withReload:(BOOL)reload;
/** 重新播放 */
Expand All @@ -48,6 +50,8 @@
- (void)onRepeatClick;
/** 显示VipView */
- (void)showVipView;
/** 快进/快退按钮*/
- (void)onLongPressAction:(UILongPressGestureRecognizer *)gesture;

@end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,5 @@
"SuperPlayer.chooseoutlinecolor" = "Choose Outline Color";
"SuperPlayer.subtitlessetting" = "Subtitles Setting";
"SuperPlayer.track" = "Track";
"SuperPlayer.fastForward" = "fast forward";
"SuperPlayer.rewind" = "rewind";
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,5 @@
"SuperPlayer.chooseoutlinecolor" = "选择描边颜色";
"SuperPlayer.subtitlessetting" = "字幕设置";
"SuperPlayer.track" = "音轨";
"SuperPlayer.fastForward" = "快进";
"SuperPlayer.rewind" = "快退";
Loading

0 comments on commit 357ca4d

Please sign in to comment.