Skip to content

Commit

Permalink
点播2.20.0发布
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhan committed Sep 1, 2023
1 parent 1fd5325 commit d93bf4b
Show file tree
Hide file tree
Showing 17 changed files with 145 additions and 47 deletions.
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,32 @@
<!-- Added Changed Removed Fixed -->

## [2.20.0] - 2023-09-01

### Changed

- 【SDK、Demo】旧版跑马灯移除
- 【SDK、Demo】优化问答提交统计
- 【Demo】优化跑马灯显示样式
- 【SDK】支持溯源水印
- 【SDK】支持跨端续播

### Fixed

- 【Demo】修复下载视频出现线路切换问题
- 【SDK】修复播放第三方URL视频seek失效的问题
- 【SDK】修复偶发性崩溃问题
- 【SDK】移除先前版本中未使用的imei字段

### 迁移说明

**由 2.18.x 及以下版本升级到 2.19.0 及以上版本时,需要注意视频下载的迁移**

**自 2.19.0 版本开始,本地播放视频鉴权方式进行了调整,为了在覆盖升级时兼容已下载的旧版本视频,初始换sdk时会自动迁移,必须严格测试本地缓存视频是否迁移成功。**

1. 旧版本升级至 2.20.0 版本的点播 SDK,需要同步更新 2.20.0 版本的 Demo 层代码,以获得本次新增的功能。
2. 若不便直接更新源码,可根据 [diff 变动内容](https://github.com/polyv/polyv-ios-vod-sdk/compare/2.19.1...2.20.0) 查看 Demo 层的变动,手动更新Demo层源码

## [2.19.1] - 2023-07-21

### Changed
Expand Down Expand Up @@ -1078,3 +1104,4 @@ typedef NS_ENUM(NSInteger, PLVVodFullScreenOrientation) {
- 修复音量与播放器值不同步问题;
- 修复时间显示格式;
- 修复 `-requestDownloadInfosWithCompletion:` 死循环崩溃问题;

2 changes: 1 addition & 1 deletion PolyvVodSDKDemo/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ target 'PolyvVodSDKDemo' do
pod 'TZImagePickerController', '~> 3.2.0'

# PLVVodSDK
pod 'PolyvVodSDK', '~> 2.19.1'
pod 'PolyvVodSDK', '~> 2.20.0'

# 使用投屏功能的客户需要集成
#pod 'LBLelinkKit', '~> 30503'
Expand Down
4 changes: 2 additions & 2 deletions PolyvVodSDKDemo/PolyvVodSDKDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1680,7 +1680,7 @@
INFOPLIST_FILE = "$(SRCROOT)/PolyvVodSDKDemo/Supporting Files/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 9;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 2.19.1;
MARKETING_VERSION = 2.20.0;
PRODUCT_BUNDLE_IDENTIFIER = cn.plv.vod.sdk.demo;
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = "1,2";
Expand Down Expand Up @@ -1710,7 +1710,7 @@
INFOPLIST_FILE = "$(SRCROOT)/PolyvVodSDKDemo/Supporting Files/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 9;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 2.19.1;
MARKETING_VERSION = 2.20.0;
PRODUCT_BUNDLE_IDENTIFIER = cn.plv.vod.sdk.demo;
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = "1,2";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,15 +252,17 @@ - (void)plvCastManager_connectServicesResult:(BOOL)isConnected serviceModel:(non
[weakSelf.castManager startPlayWithVideo:video quality:quality startPosition:self.player.currentPlaybackTime];

// 设置清晰度数量 初始所选清晰度
weakSelf.castControllView.qualityOptionCount = video.hlsVideos.count;
NSArray<NSString *> *hlsVideos = video.isHls302 ? video.hlsVideos2 : video.hlsVideos;
weakSelf.castControllView.qualityOptionCount = hlsVideos.count;
weakSelf.castControllView.currentQualityIndex = quality;
}];
}else{ // 无需读取video模型缓存
// 开始投屏
[self.castManager startPlayWithVideo:video quality:quality startPosition:self.player.currentPlaybackTime];

// 设置清晰度数量 初始所选清晰度
self.castControllView.qualityOptionCount = self.player.video.hlsVideos.count;
NSArray<NSString *> *hlsVideos = video.isHls302 ? self.player.video.hlsVideos2 : self.player.video.hlsVideos;
self.castControllView.qualityOptionCount = hlsVideos.count;
self.castControllView.currentQualityIndex = quality;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,6 @@ - (void)viewDidLoad {
#else
weakSelf.player.video = video;
#endif

dispatch_async(dispatch_get_main_queue(), ^{
/// 设置默认跑马灯,移除旧版本跑马灯
PLVMarqueeModel *marqueeModel = [[PLVMarqueeModel alloc]init];
[weakSelf.player.marqueeView setPLVMarqueeModel:marqueeModel];
weakSelf.player.marquee = nil;
});

};

// 若需投屏功能,则需以下代码来启用投屏
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,21 @@ - (void)setupPlayer {
self.player.autoplay = YES;
self.player.enableLocalViewLog = YES;

__weak typeof(self) weakSelf = self;
self.player.playbackStateHandler = ^(PLVVodPlayerViewController *player) {
//新版跑马灯的启动暂停控制
if (player.playbackState == PLVVodPlaybackStatePlaying) {
[weakSelf.player.marqueeView start];
}else if (player.playbackState == PLVVodPlaybackStatePaused) {
[weakSelf.player.marqueeView pause];
}else if (player.playbackState == PLVVodPlaybackStateStopped) {
[weakSelf.player.marqueeView stop];
}
};

NSString *vid = self.vid;
if (self.isOffline){

// 离线视频播放
__weak typeof(self) weakSelf = self;

// 根据资源类型设置默认播放模式。本地音频文件设定音频播放模式,本地视频文件设定视频播放模式
// 只针对开通视频转音频服务的用户
self.player.playbackMode = self.playMode;
Expand All @@ -118,7 +127,6 @@ - (void)setupPlayer {
}
else{
// 在线视频播放,默认会优先播放本地视频
__weak typeof(self) weakSelf = self;
[PLVVodVideo requestVideoWithVid:vid completion:^(PLVVodVideo *video, NSError *error) {
if (error){
// 用于播放重试
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
@property (nonatomic, assign) NSTimeInterval currentTime;

@property (nonatomic, copy) void (^examWillShowHandler)(PLVVodExam *exam);
@property (nonatomic, copy) void (^examDidCompleteHandler)(PLVVodExam *exam, NSTimeInterval backTime);
@property (nonatomic, copy) void (^examDidCompleteHandler)(PLVVodExam *exam, NSTimeInterval backTime, NSArray<NSNumber *> *answerIndexs);

@property (nonatomic, assign, readonly) BOOL showing;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ @interface PLVVodExamViewController ()

@property (nonatomic, assign) BOOL showing;

@property (nonatomic, strong) NSArray<NSNumber *> *answerIndexs;

@end

@implementation PLVVodExamViewController
Expand All @@ -47,19 +49,22 @@ - (void)viewDidLoad {
[PLVToast showMessage:@"您还未选择任何答案"];
return;
}
// 保存选项
weakSelf.answerIndexs = [NSArray arrayWithArray:indexForSelectedItems];

// 判断正误
PLVVodExam *exam = weakSelf.currentExam;
NSSet *referenceAnswer = [NSSet setWithArray:exam.correctIndex];
NSSet *userAnswer = [NSSet setWithArray:indexForSelectedItems];
BOOL correct = [referenceAnswer isEqualToSet:userAnswer];

[weakSelf showExplanationIfCorrect:correct];
};

// 选择题的跳过回调
self.questionView.skipActionHandler = ^{
PLVVodExam *exam = [weakSelf hideExam];
if (weakSelf.examDidCompleteHandler) weakSelf.examDidCompleteHandler(exam, -1);
if (weakSelf.examDidCompleteHandler) weakSelf.examDidCompleteHandler(exam, -1, nil);
};

// 填空题的提交回调
Expand All @@ -85,13 +90,13 @@ - (void)viewDidLoad {
//填空题的跳过回调
self.fillBlankQuestionView.skipActionHandler = ^{
PLVVodExam *exam = [weakSelf hideExam];
if (weakSelf.examDidCompleteHandler) weakSelf.examDidCompleteHandler(exam, -1);
if (weakSelf.examDidCompleteHandler) weakSelf.examDidCompleteHandler(exam, -1, nil);
};

self.explanationView.confirmActionHandler = ^(BOOL correct) {
PLVVodExam *exam = [weakSelf hideExam];
NSTimeInterval backTime = correct ? -1 : exam.backTime;
if (weakSelf.examDidCompleteHandler) weakSelf.examDidCompleteHandler(exam, backTime);
if (weakSelf.examDidCompleteHandler) weakSelf.examDidCompleteHandler(exam, backTime, weakSelf.answerIndexs);
};

self.view.alpha = 0;
Expand Down Expand Up @@ -219,6 +224,7 @@ - (void)synchronouslyShowExam {
[self.questionView scrollToTop];
}
self.currentExam = exam;
self.answerIndexs = nil;
}];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,14 +333,15 @@ -(UIView *)lineH
return _lineH;
}



/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
#pragma mark - Override

- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
UIView *touchView = [super hitTest:point withEvent:event];
if (touchView == self) {
return nil;
} else {
return touchView;
}
}
*/

@end
Original file line number Diff line number Diff line change
Expand Up @@ -292,5 +292,16 @@ - (NSString *)optionOrderWithIndex:(NSInteger )index{
return dict[keyStr];
}

#pragma mark - Override

- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
UIView *touchView = [super hitTest:point withEvent:event];
if (touchView == self) {
return nil;
} else {
return touchView;
}
}


@end
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@ - (void)updateCoverView {
PLVVodLocalVideo * localVideoModel = (PLVVodLocalVideo *)video;
fileUrl = localVideoModel.path;
} else { // 非本地文件
fileUrl = (video.keepSource == NO) ? video.hlsIndex : video.play_source_url;
NSString *hlsIndex = video.isHls302 ? video.hlsIndex2 : video.hlsIndex;
fileUrl = (video.keepSource == NO) ? hlsIndex : video.play_source_url;
}

if (fileUrl && [fileUrl isKindOfClass:[NSString class]] && fileUrl.length != 0) { // 判断链接是否存在
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,17 @@ - (void)viewDidLoad {
[weakSelf dealPictureInPictureErrorHandler:error];
}];

// 跑马灯控制
self.player.playbackStateHandler = ^(PLVVodPlayerViewController *player) {
//新版跑马灯的启动暂停控制
if (player.playbackState == PLVVodPlaybackStatePlaying) {
[weakSelf.player.marqueeView start];
}else if (player.playbackState == PLVVodPlaybackStatePaused) {
[weakSelf.player.marqueeView pause];
}else if (player.playbackState == PLVVodPlaybackStateStopped) {
[weakSelf.player.marqueeView stop];
}
};
}

/// 画中画状态回调
Expand Down Expand Up @@ -333,10 +344,12 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
// 当主播放器移出设备界面时,在小播放器上继续播放
if (self.playerPlaceholder.frame.origin.y + self.playerPlaceholder.frame.size.height <= NavHight && !self.playInFloatingView) {
self.playInFloatingView = YES;
self.player.marqueeView.hidden = YES;

[[PLVVFloatingWindow sharedInstance].contentVctrl addPlayer:self.player partnerViewController:self];
} else if (self.playerPlaceholder.frame.origin.y + self.playerPlaceholder.frame.size.height > NavHight && self.playInFloatingView) {
self.playInFloatingView = NO;
self.player.marqueeView.hidden = NO;

[self.player addPlayerOnPlaceholderView:self.playerPlaceholder rootViewController:self];
[[PLVVFloatingWindow sharedInstance].contentVctrl removePlayer];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ +(void)addFlashAnimation:(CALayer *)layer
CGFloat displayHeight = CGRectGetHeight(bounds);
CGFloat displayMaxX = displayWidth - layer.frame.size.width;
CGFloat displayMaxY = displayHeight - layer.frame.size.height;
CGFloat randomX = [PLVMarqueeAnimationManager randomDoubleFrom:0.0 to:displayMaxX accuracy:2];
CGFloat randomY = [PLVMarqueeAnimationManager randomDoubleFrom:20.0 to:displayMaxY accuracy:2];
CGFloat randomX = displayMaxX < 0.0 ? 0.0 : [PLVMarqueeAnimationManager randomDoubleFrom:0.0 to:displayMaxX accuracy:2];
CGFloat randomY = displayMaxY < 0.0 ? 0.0 : [PLVMarqueeAnimationManager randomDoubleFrom:20.0 to:displayMaxY accuracy:2];

//给layer设置随机位置
[CATransaction begin];
Expand Down Expand Up @@ -176,6 +176,9 @@ +(void)addRollAnimation:(CALayer *)layer
CGFloat displayMinY = 20.0;
CGFloat displayMaxY = displayHeight - layer.frame.size.height * 0.5;
CGFloat randomY = [PLVMarqueeAnimationManager randomDoubleFrom:displayMinY to:displayMaxY accuracy:2];
if (displayHeight < layer.frame.size.height) {
randomY = 0.0;
}
CGFloat rollFromPsitionX = displayWidth + layer.frame.size.width * 0.5;
CGFloat rollToPsitionX = -layer.frame.size.width * 0.5;
if (model.isAlwaysShowWhenRun) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,19 @@ - (void)viewDidLoad {
[self.view addSubview:self.player.view];
self.skinView = (PLVVodPlayerSkin *)self.player.playerControl;
self.skinView.pptVideoDelegate = self;

__weak typeof (self) weakSelf = self;
// 跑马灯控制
self.player.playbackStateHandler = ^(PLVVodPlayerViewController *player) {
//新版跑马灯的启动暂停控制
if (player.playbackState == PLVVodPlaybackStatePlaying) {
[weakSelf.player.marqueeView start];
}else if (player.playbackState == PLVVodPlaybackStatePaused) {
[weakSelf.player.marqueeView pause];
}else if (player.playbackState == PLVVodPlaybackStateStopped) {
[weakSelf.player.marqueeView stop];
}
};
}

- (void)viewWillLayoutSubviews {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ - (void)updateCoverView:(PLVVodVideo *)video{
// 非本地文件
if (video.keepSource == NO) {
// 非源文件
fileUrl = video.hlsIndex;
fileUrl = video.isHls302 ? video.hlsIndex2 : video.hlsIndex;
}else{
// 源文件
fileUrl = video.play_source_url;
Expand Down
Loading

0 comments on commit d93bf4b

Please sign in to comment.