Commit 2dd92f70 authored by Hanruisong's avatar Hanruisong
Browse files

feat: 更新到4.11.0

1.支持离线视频显示字幕。
2.demo竖屏模式下,支持手势拖拽。
3.demo播放页面进度条支持点击调整进度。
4.修复了demo中的bug。
parent cf6e1fb0
......@@ -403,27 +403,27 @@
B88562A41DED1AC8008D1763 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B88562A31DED1AC8008D1763 /* SystemConfiguration.framework */; };
DD25727D24F79DED00D9BB55 /* icon_exercises_close@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = DD25727B24F79DED00D9BB55 /* icon_exercises_close@3x.png */; };
DD25727E24F79DED00D9BB55 /* icon_exercises_close@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DD25727C24F79DED00D9BB55 /* icon_exercises_close@2x.png */; };
DD27A31C2554FF29002BABA8 /* DWResource.bundle in Resources */ = {isa = PBXBuildFile; fileRef = DD27A31A2554FF29002BABA8 /* DWResource.bundle */; };
DD27A31D2554FF29002BABA8 /* vrlibraw.bundle in Resources */ = {isa = PBXBuildFile; fileRef = DD27A31B2554FF29002BABA8 /* vrlibraw.bundle */; };
DD27A31E2554FF31002BABA8 /* CCVodSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DD27A3162554FF07002BABA8 /* CCVodSDK.framework */; };
DD27A31F2554FF31002BABA8 /* CCVodSDK.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = DD27A3162554FF07002BABA8 /* CCVodSDK.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
DD27A3202554FF34002BABA8 /* HDBaseUtils.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DD27A3172554FF07002BABA8 /* HDBaseUtils.framework */; };
DD27A3212554FF34002BABA8 /* HDBaseUtils.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = DD27A3172554FF07002BABA8 /* HDBaseUtils.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
DD54280A250B55AB0097614C /* icon_ad_mute_select@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DD542806250B55AA0097614C /* icon_ad_mute_select@2x.png */; };
DD54280B250B55AB0097614C /* icon_ad_mute@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = DD542807250B55AB0097614C /* icon_ad_mute@3x.png */; };
DD54280C250B55AB0097614C /* icon_ad_mute@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DD542808250B55AB0097614C /* icon_ad_mute@2x.png */; };
DD54280D250B55AB0097614C /* icon_ad_mute_select@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = DD542809250B55AB0097614C /* icon_ad_mute_select@3x.png */; };
DD9292C02566590400A917C5 /* DWResource.bundle in Resources */ = {isa = PBXBuildFile; fileRef = DD9292BE2566590300A917C5 /* DWResource.bundle */; };
DD9292C12566590400A917C5 /* vrlibraw.bundle in Resources */ = {isa = PBXBuildFile; fileRef = DD9292BF2566590400A917C5 /* vrlibraw.bundle */; };
DD9292C22566591200A917C5 /* CCVodSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DD9292BA256658F800A917C5 /* CCVodSDK.framework */; };
DD9292C32566591200A917C5 /* CCVodSDK.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = DD9292BA256658F800A917C5 /* CCVodSDK.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
DD9292C52566591600A917C5 /* HDBaseUtils.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DD9292BB256658F800A917C5 /* HDBaseUtils.framework */; };
DD9292C62566591600A917C5 /* HDBaseUtils.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = DD9292BB256658F800A917C5 /* HDBaseUtils.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
046FF38A2468F48100AB4A98 /* Embed Frameworks */ = {
DD9292C42566591200A917C5 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
DD27A31F2554FF31002BABA8 /* CCVodSDK.framework in Embed Frameworks */,
DD27A3212554FF34002BABA8 /* HDBaseUtils.framework in Embed Frameworks */,
DD9292C32566591200A917C5 /* CCVodSDK.framework in Embed Frameworks */,
DD9292C62566591600A917C5 /* HDBaseUtils.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
......@@ -989,14 +989,15 @@
B88562A31DED1AC8008D1763 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; };
DD25727B24F79DED00D9BB55 /* icon_exercises_close@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon_exercises_close@3x.png"; sourceTree = "<group>"; };
DD25727C24F79DED00D9BB55 /* icon_exercises_close@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon_exercises_close@2x.png"; sourceTree = "<group>"; };
DD27A3162554FF07002BABA8 /* CCVodSDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = CCVodSDK.framework; sourceTree = "<group>"; };
DD27A3172554FF07002BABA8 /* HDBaseUtils.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = HDBaseUtils.framework; sourceTree = "<group>"; };
DD27A31A2554FF29002BABA8 /* DWResource.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = DWResource.bundle; path = CCVodSDK.framework/DWResource.bundle; sourceTree = "<group>"; };
DD27A31B2554FF29002BABA8 /* vrlibraw.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = vrlibraw.bundle; path = CCVodSDK.framework/vrlibraw.bundle; sourceTree = "<group>"; };
DD542806250B55AA0097614C /* icon_ad_mute_select@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon_ad_mute_select@2x.png"; sourceTree = "<group>"; };
DD542807250B55AB0097614C /* icon_ad_mute@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon_ad_mute@3x.png"; sourceTree = "<group>"; };
DD542808250B55AB0097614C /* icon_ad_mute@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon_ad_mute@2x.png"; sourceTree = "<group>"; };
DD542809250B55AB0097614C /* icon_ad_mute_select@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon_ad_mute_select@3x.png"; sourceTree = "<group>"; };
DD9292BA256658F800A917C5 /* CCVodSDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = CCVodSDK.framework; sourceTree = "<group>"; };
DD9292BB256658F800A917C5 /* HDBaseUtils.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = HDBaseUtils.framework; sourceTree = "<group>"; };
DD9292BE2566590300A917C5 /* DWResource.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = DWResource.bundle; path = CCVodSDK.framework/DWResource.bundle; sourceTree = "<group>"; };
DD9292BF2566590400A917C5 /* vrlibraw.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = vrlibraw.bundle; path = CCVodSDK.framework/vrlibraw.bundle; sourceTree = "<group>"; };
DDF1A579255E8A52007EE8B9 /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
......@@ -1004,14 +1005,14 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
DD27A3202554FF34002BABA8 /* HDBaseUtils.framework in Frameworks */,
DD9292C52566591600A917C5 /* HDBaseUtils.framework in Frameworks */,
048AD12822CDCE83008C8911 /* libxml2.tbd in Frameworks */,
043441FF225EF2BB003F7EC1 /* CoreServices.framework in Frameworks */,
352CBDD91FD6980C00D24715 /* AudioToolbox.framework in Frameworks */,
352CBDD71FD697E800D24715 /* MediaPlayer.framework in Frameworks */,
B88562A41DED1AC8008D1763 /* SystemConfiguration.framework in Frameworks */,
B57CC7C018E2E581001A1696 /* AVFoundation.framework in Frameworks */,
DD27A31E2554FF31002BABA8 /* CCVodSDK.framework in Frameworks */,
DD9292C22566591200A917C5 /* CCVodSDK.framework in Frameworks */,
B57CC7BE18E2E575001A1696 /* CoreLocation.framework in Frameworks */,
B57CC7BC18E2E569001A1696 /* CoreMedia.framework in Frameworks */,
B547EC4C18E033FB00BC980C /* CoreGraphics.framework in Frameworks */,
......@@ -1826,6 +1827,7 @@
B547EC4818E033FB00BC980C /* Frameworks */ = {
isa = PBXGroup;
children = (
DDF1A579255E8A52007EE8B9 /* MobileCoreServices.framework */,
048AD12722CDCE83008C8911 /* libxml2.tbd */,
043441FE225EF2BB003F7EC1 /* CoreServices.framework */,
352CBDD81FD697FA00D24715 /* AudioToolbox.framework */,
......@@ -1845,7 +1847,7 @@
isa = PBXGroup;
children = (
044C66A122D46DAE0032396F /* Demo.entitlements */,
DD27A3152554FF07002BABA8 /* SDK */,
DD9292B9256658F800A917C5 /* SDK */,
0434420D225F0EDD003F7EC1 /* Classes */,
B547EC5818E033FB00BC980C /* DWAppDelegate.h */,
B547EC5918E033FB00BC980C /* DWAppDelegate.m */,
......@@ -1872,13 +1874,13 @@
name = "Supporting Files";
sourceTree = "<group>";
};
DD27A3152554FF07002BABA8 /* SDK */ = {
DD9292B9256658F800A917C5 /* SDK */ = {
isa = PBXGroup;
children = (
DD27A31A2554FF29002BABA8 /* DWResource.bundle */,
DD27A31B2554FF29002BABA8 /* vrlibraw.bundle */,
DD27A3162554FF07002BABA8 /* CCVodSDK.framework */,
DD27A3172554FF07002BABA8 /* HDBaseUtils.framework */,
DD9292BE2566590300A917C5 /* DWResource.bundle */,
DD9292BF2566590400A917C5 /* vrlibraw.bundle */,
DD9292BA256658F800A917C5 /* CCVodSDK.framework */,
DD9292BB256658F800A917C5 /* HDBaseUtils.framework */,
);
path = SDK;
sourceTree = "<group>";
......@@ -1893,8 +1895,8 @@
B547EC4218E033FB00BC980C /* Sources */,
B547EC4318E033FB00BC980C /* Frameworks */,
B547EC4418E033FB00BC980C /* Resources */,
046FF38A2468F48100AB4A98 /* Embed Frameworks */,
DD27A3222555174F002BABA8 /* ShellScript */,
DD9292C42566591200A917C5 /* Embed Frameworks */,
DD9292C725665A0500A917C5 /* ShellScript */,
);
buildRules = (
);
......@@ -2054,7 +2056,7 @@
04AB4A3722B1F22A00BB9BF9 /* icon_exercises_error@2x.png in Resources */,
04D60ED822719B9C0009C572 /* icon_play_vr_inselect_select@2x.png in Resources */,
043D4E6B22D5C91D00FCDCBE /* icon_sound_add@2x.png in Resources */,
DD27A31C2554FF29002BABA8 /* DWResource.bundle in Resources */,
DD9292C02566590400A917C5 /* DWResource.bundle in Resources */,
04346AC8249720C6005A3396 /* icon_screenshot@2x.png in Resources */,
04B7A661226B0E5E00951983 /* icon_question_multi_select@3x.png in Resources */,
04AB4A3F22B1F22A00BB9BF9 /* icon_exercises_answer_d_select@2x.png in Resources */,
......@@ -2152,7 +2154,7 @@
04346AC0249720C6005A3396 /* brightness.png in Resources */,
04B7A65F226B0E5E00951983 /* icon_question_single_select@2x.png in Resources */,
0491DD1F24B5604300DF40C7 /* icon_barrage_color_select@3x.png in Resources */,
DD27A31D2554FF29002BABA8 /* vrlibraw.bundle in Resources */,
DD9292C12566590400A917C5 /* vrlibraw.bundle in Resources */,
04BAA93D22D4787B000495B4 /* icon_screen_list@2x.png in Resources */,
04AB4A2622B1F22A00BB9BF9 /* icon_exercises_answer_g_normal@2x.png in Resources */,
04B7A65C226B0E5E00951983 /* icon_question_multi_select@2x.png in Resources */,
......@@ -2202,7 +2204,7 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
DD27A3222555174F002BABA8 /* ShellScript */ = {
DD9292C725665A0500A917C5 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildLocationStyle</key>
<string>UseAppPreferences</string>
<key>CustomBuildLocationType</key>
<string>RelativeToDerivedData</string>
<key>DerivedDataLocationStyle</key>
<string>Default</string>
<key>IssueFilterStyle</key>
<string>ShowActiveSchemeOnly</string>
<key>LiveSourceIssuesEnabled</key>
<true/>
<key>ShowSharedSchemesAutomaticallyEnabled</key>
<true/>
</dict>
</plist>
......@@ -25,6 +25,7 @@
if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
self.backgroundColor = [UIColor whiteColor];
self.iconImageView = [[UIImageView alloc]init];
[self.contentView addSubview:self.iconImageView];
......@@ -97,34 +98,60 @@
self.iconImageView.image = [UIImage imageNamed:[downloadModel.othersInfo objectForKey:@"imageUrl"]];
}
self.titleLabel.text = [downloadModel.othersInfo objectForKey:@"title"];
CGFloat titleLabelWidth = (ScreenWidth - 10 - 128 - 10 - 10);
CGSize size = [DWTools widthWithHeight:titleLabelWidth andFont:self.titleLabel.font andLabelText:self.titleLabel.text];
if (ceil(size.height) < (self.titleLabel.font.lineHeight * 2)) {
[_titleLabel mas_updateConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.iconImageView).offset(5);
make.height.equalTo(@14);
}];
}else{
[_titleLabel mas_updateConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.iconImageView);
make.height.equalTo(@40);
}];
}
if (downloadModel.state == DWDownloadStateCompleted) {
//完成
//判断字幕是否下载完成
BOOL subtitleDownload = YES;
if (downloadModel.defaultSubtitle == -1) {
}else if (downloadModel.defaultSubtitle == 0){
subtitleDownload = downloadModel.subtitle.isDownload;
}else if (downloadModel.defaultSubtitle == 1){
subtitleDownload = downloadModel.subtitle2.isDownload;
}else{
subtitleDownload = (downloadModel.subtitle.isDownload && downloadModel.subtitle2.isDownload);
}
self.titleLabel.text = subtitleDownload ? [downloadModel.othersInfo objectForKey:@"title"] : [NSString stringWithFormat:@"%@ (字幕下载失败)",[downloadModel.othersInfo objectForKey:@"title"]];
CGFloat titleLabelWidth = (ScreenWidth - 10 - 128 - 10 - 10);
CGSize size = [DWTools widthWithHeight:titleLabelWidth andFont:self.titleLabel.font andLabelText:self.titleLabel.text];
if (ceil(size.height) < (self.titleLabel.font.lineHeight * 2)) {
[_titleLabel mas_updateConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.iconImageView).offset(5);
make.height.equalTo(@14);
}];
}else{
[_titleLabel mas_updateConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.iconImageView);
make.height.equalTo(@40);
}];
}
self.progressView.hidden = YES;
self.scheduleLabel.hidden = YES;
self.stateLabel.text = [NSString stringWithFormat:@"%.2fM",[DWTools fileSizeAtPath:downloadModel.filePath]];
}else{
//未完成
self.titleLabel.text = [downloadModel.othersInfo objectForKey:@"title"];
CGFloat titleLabelWidth = (ScreenWidth - 10 - 128 - 10 - 10);
CGSize size = [DWTools widthWithHeight:titleLabelWidth andFont:self.titleLabel.font andLabelText:self.titleLabel.text];
if (ceil(size.height) < (self.titleLabel.font.lineHeight * 2)) {
[_titleLabel mas_updateConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.iconImageView).offset(5);
make.height.equalTo(@14);
}];
}else{
[_titleLabel mas_updateConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.iconImageView);
make.height.equalTo(@40);
}];
}
self.progressView.hidden = NO;
self.scheduleLabel.hidden = NO;
self.progressView.progress = downloadModel.progress.progress;
// CGFloat floatSize =fileSize/1024.0/1024.0;
self.scheduleLabel.text = [NSString stringWithFormat:@"%.2f%@/%.2f%@",[DWDownloadUtility calculateFileSizeInUnit:downloadModel.progress.totalBytesWritten],[DWDownloadUtility calculateUnit:downloadModel.progress.totalBytesWritten],[DWDownloadUtility calculateFileSizeInUnit:downloadModel.progress.totalBytesExpectedToWrite],[DWDownloadUtility calculateUnit:downloadModel.progress.totalBytesExpectedToWrite]];
switch (downloadModel.state) {
......
......@@ -64,11 +64,11 @@
}
//只在横屏状态下,相应手势
UIDeviceOrientation orientation = [UIDevice currentDevice].orientation;
UIInterfaceOrientation interfaceOrientation = (UIInterfaceOrientation)orientation;
if (!(interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight)) {
return;
}
// UIDeviceOrientation orientation = [UIDevice currentDevice].orientation;
// UIInterfaceOrientation interfaceOrientation = (UIInterfaceOrientation)orientation;
// if (!(interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight)) {
// return;
// }
switch (self.state) {
case UIGestureRecognizerStateBegan:
......
......@@ -381,6 +381,9 @@ static CGFloat barrageBgHeight = 40;
[self initVRView];
//处理字幕数据
[self dealSubtitleArray];
if ([downloadModel.mediaType isEqualToString:@"1"]) {
[self changePlayerMediaType:YES];
}else{
......@@ -406,7 +409,10 @@ static CGFloat barrageBgHeight = 40;
[self.marqueeView startMarquee];
}
[self.subtitleView screenRotate:isFull];
[self.barrageBgView screenRotate:self.isFull];
}
-(void)play
......@@ -787,11 +793,6 @@ static CGFloat barrageBgHeight = 40;
[self gifCancelAction];
}
//隐藏字幕
if (self.subtitleView) {
[self.subtitleView switchSubtitleStyle:3];
}
if (self.funcTimer) {
[_topFuncBgView mas_updateConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(@0);
......@@ -1231,6 +1232,57 @@ static CGFloat barrageBgHeight = 40;
[[NSString stringWithFormat:@"开始下载:%@",vodVideo.title] showAlert];
}
-(void)sliderScrubWithValue:(CGFloat)value
{
//未加载完成,不触发拖拽事件
if (!self.readyToPlay) {
self.isSlidering = NO;
return;
}
CGFloat durationInSeconds = CMTimeGetSeconds(self.playerView.player.currentItem.duration);
CGFloat time = durationInSeconds * value;
//授权验证功能
if (!self.enable) {
NSInteger freetime = self.videoModel.authorize.freetime;
if (time > freetime) {
time = freetime;
}
}
self.exercisesLastScrubTime = time;
//拖拽时,视频问答逻辑
for (DWVideoQuestionModel *questionModel in self.questionArray) {
if (questionModel.isShow && !questionModel.jump && time > questionModel.showTime) {
time = questionModel.showTime;
break;
}
}
//解决弱网下,拖拽可能会引起音画不同步的问题
[self pause];
__weak typeof(self) weakSelf = self;
[self.playerView scrubPrecise:time CompletionHandler:^(BOOL finished) {
weakSelf.isSlidering = NO;
if (![weakSelf haveUnansweredExercises:weakSelf.exercisesFrontScrubTime AndLastTime:weakSelf.exercisesLastScrubTime]) {
weakSelf.exercisesFrontScrubTime = -1;
weakSelf.exercisesLastScrubTime = -1;
}
if (_questionView || weakSelf.visitorCollectView || weakSelf.exercisesAlertView || weakSelf.exercisesView) {
return;
}
[self play];
}];
}
#pragma mark - func Timer
-(void)initFuncGesture
{
......@@ -1680,10 +1732,17 @@ static CGFloat barrageBgHeight = 40;
//顶部
-(void)backButtonAction
{
if (!self.isFull) {
//离线视频,直接保存
if (self.downloadModel) {
[self saveNsUserDefaults];
[self.barrageManager cancelRequest];
}else{
if (!self.isFull) {
[self saveNsUserDefaults];
[self.barrageManager cancelRequest];
}
}
if ([_delegate respondsToSelector:@selector(vodPlayerView:ReturnBackAction:)]) {
......@@ -1889,55 +1948,29 @@ static CGFloat barrageBgHeight = 40;
-(void)sliderEndedAction
{
//未加载完成,不触发拖拽事件
if (!self.readyToPlay) {
self.isSlidering = NO;
return;
}
CGFloat durationInSeconds = CMTimeGetSeconds(self.playerView.player.currentItem.duration);
CGFloat time = durationInSeconds * self.slider.value;
//授权验证功能
if (!self.enable) {
NSInteger freetime = self.videoModel.authorize.freetime;
if (time > freetime) {
time = freetime;
}
}
[self sliderScrubWithValue:self.slider.value];
}
//视频打点以及slider点击事件
- (void)sliderTapAction:(UITapGestureRecognizer *)tap
{
CGPoint point = [tap locationInView:self.slider];
CGFloat tapValue = point.x / self.sliderWidth;
self.exercisesLastScrubTime = time;
[self sliderScrubWithValue:tapValue];
//拖拽时,视频问答逻辑
for (DWVideoQuestionModel *questionModel in self.questionArray) {
if (questionModel.isShow && !questionModel.jump && time > questionModel.showTime) {
time = questionModel.showTime;
break;
}
if (!self.isFull) {
return;
}
//解决弱网下,拖拽可能会引起音画不同步的问题
[self pause];
__weak typeof(self) weakSelf = self;
[self.playerView scrubPrecise:time CompletionHandler:^(BOOL finished) {
weakSelf.isSlidering = NO;
if (![weakSelf haveUnansweredExercises:weakSelf.exercisesFrontScrubTime AndLastTime:weakSelf.exercisesLastScrubTime]) {
weakSelf.exercisesFrontScrubTime = -1;
weakSelf.exercisesLastScrubTime = -1;
}
if (_questionView || weakSelf.visitorCollectView || weakSelf.exercisesAlertView || weakSelf.exercisesView) {
return;
}
[self play];
}];
self.isShowMarkView = YES;
//视频总时长
CGFloat duration = CMTimeGetSeconds([self.playerView.player.currentItem duration]);
[self showVideoMarkCurrentValue:tapValue videoDuration:duration];
}
//速率选择
-(void)speedButtonAction
{
......@@ -2218,22 +2251,6 @@ static CGFloat barrageBgHeight = 40;
self.isSlidering =NO;
}
//视频打点
- (void)tapOfVideoMarkAction:(UITapGestureRecognizer *)tap
{
if (!self.isFull) {
return;
}
self.isShowMarkView = YES;
CGPoint point = [tap locationInView:self.slider];
CGFloat tapValue = point.x / self.sliderWidth;
//视频总时长
CGFloat duration = CMTimeGetSeconds([self.playerView.player.currentItem duration]);
[self showVideoMarkCurrentValue:tapValue videoDuration:duration];
}
//清理打点数据
-(void)clearVideoMark
{
......@@ -2337,63 +2354,111 @@ static CGFloat barrageBgHeight = 40;
{
[self.subTitleArray removeAllObjects];
if (!self.videoModel.subtitle && !self.videoModel.subtitle2) {
//无字幕
DWTableChooseModel * chooseModel = [[DWTableChooseModel alloc]init];
chooseModel.title = @"无字幕";
chooseModel.isSelect = YES;
[self.subTitleArray addObject:chooseModel];
}else if (self.videoModel.subtitle && self.videoModel.subtitle2) {
//双语字幕
NSArray * titles = @[@"双语",self.videoModel.subtitle.subtitleName,self.videoModel.subtitle2.subtitleName,@"关闭字幕"];
[titles enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if (self.videoModel) {
//在线视频
if (!self.videoModel.subtitle && !self.videoModel.subtitle2) {
//无字幕
DWTableChooseModel * chooseModel = [[DWTableChooseModel alloc]init];
chooseModel.title = obj;
if (idx == 0) {
chooseModel.isSelect = self.videoModel.defaultSubtitle == 2 ? YES : NO;
}else if (idx == 1){
chooseModel.isSelect = self.videoModel.defaultSubtitle == 0 ? YES : NO;
}else if (idx == 2){
chooseModel.isSelect = self.videoModel.defaultSubtitle == 1 ? YES : NO;
}else{
chooseModel.isSelect = NO;
}
chooseModel.title = @"无字幕";
chooseModel.isSelect = YES;
[self.subTitleArray addObject:chooseModel];
}];
}else if (self.videoModel.subtitle && self.videoModel.subtitle2) {
//双语字幕
NSArray * titles = @[@"双语",self.videoModel.subtitle.subtitleName,self.videoModel.subtitle2.subtitleName,@"关闭字幕"];
[titles enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
DWTableChooseModel * chooseModel = [[DWTableChooseModel alloc]init];
chooseModel.title = obj;
if (idx == 0) {
chooseModel.isSelect = self.videoModel.defaultSubtitle == 2 ? YES : NO;
}else if (idx == 1){
chooseModel.isSelect = self.videoModel.defaultSubtitle == 0 ? YES : NO;
}else if (idx == 2){
chooseModel.isSelect = self.videoModel.defaultSubtitle == 1 ? YES : NO;
}else{
chooseModel.isSelect = NO;
}
[self.subTitleArray addObject:chooseModel];
}];
}else{
//单语字幕 单字幕时 subtitle 有值
NSArray * titles = @[self.videoModel.subtitle.subtitleName,@"关闭字幕"];
[titles enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
DWTableChooseModel * chooseModel = [[DWTableChooseModel alloc]init];
chooseModel.title = obj;
if (idx == 0) {
chooseModel.isSelect = YES;
}else{
chooseModel.isSelect = NO;
}
[self.subTitleArray addObject:chooseModel];
}];
}
//初始化字幕
if (self.subtitleView) {
[self.subtitleView removeFromSuperview];
self.subtitleView = nil;
}
self.subtitleView = [[DWSubtitleView alloc]initWithSubtitle:self.videoModel.subtitle Subtitle2:self.videoModel.subtitle2 DefauleSubtitle:self.videoModel.defaultSubtitle AndLocalFile:NO];
[self.playerView addSubview:self.subtitleView];
[self switchSubtitleStyle];
}else{
//单语字幕 单字幕时 subtitle 有值
NSArray * titles = @[self.videoModel.subtitle.subtitleName,@"关闭字幕"];
[titles enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
//离线视频
if (!self.downloadModel.subtitle && !self.downloadModel.subtitle2) {
//无字幕
DWTableChooseModel * chooseModel = [[DWTableChooseModel alloc]init];
chooseModel.title = obj;
if (idx == 0) {
chooseModel.isSelect = YES;
}else{