Commit 41cba7d9 authored by guow's avatar guow
Browse files

4.15.6

parent be781ad2
No preview for this file type
......@@ -35,6 +35,8 @@ typedef enum : NSUInteger {
@property(nonatomic,assign)BOOL isLock;
@property (nonatomic, strong) DWPlayInfo * playInfo;
@end
@implementation DWVodPlayViewController
......@@ -57,6 +59,7 @@ typedef enum : NSUInteger {
}
DWConfigurationManager * manager = [DWConfigurationManager sharedInstance];
manager.isOpenAd = YES;
if (manager.isOpenAd) {
//广告模式
[self startRequestAdInfo:1];
......@@ -67,29 +70,30 @@ typedef enum : NSUInteger {
}
//初始化
-(void)startRequestVideo:(NSString *)videoId
{
__weak typeof(self) weakSelf = self;
DWPlayInfo * playInfo = [[DWPlayInfo alloc]initWithUserId:[DWConfigurationManager sharedInstance].DWAccount_userId andVideoId:videoId key:[DWConfigurationManager sharedInstance].DWAccount_apikey hlsSupport:@"1"];
playInfo.timeoutSeconds = 30;
_playInfo = playInfo;
_playInfo.timeoutSeconds = 30;
//音频 + 视频数据,这里仅做示范,可根据自己项目业务逻辑来调整
playInfo.mediatype = @"0";
playInfo.isAllow = NO;//默认是NO YES:拖拽的时候不显示答题器
//开启授权验证功能传入
playInfo.verificationCode = [DWConfigurationManager sharedInstance].verification;
_playInfo.verificationCode = [DWConfigurationManager sharedInstance].verification;
//客户端用户id,选填
// playInfo.roleId = @"";
playInfo.finishBlock = ^(DWVodVideoModel *vodVideo) {
_playInfo.isAllow = NO;//yes:拖拽不显示答题器
_playInfo.finishBlock = ^(DWVodVideoModel *vodVideo) {
NSLog(@"%@",vodVideo);
//下载时,保存图片,名字等数据
weakSelf.playerView.vodModel = weakSelf.vodModel;
[weakSelf.playerView setVodVideo:vodVideo];
};
playInfo.errorBlock = ^(NSError *error) {
_playInfo.errorBlock = ^(NSError *error) {
[error.localizedDescription showAlert];
};
[playInfo start];
[_playInfo start];
}
//1片头广告,2暂停广告,3片尾广告
......@@ -634,6 +638,8 @@ typedef enum : NSUInteger {
}else{
NSDictionary *dict = @{@"title":@"知识点",
@"pauseStatus":@(1),
@"timeAxisStatus":@(1),//时间轴是否展示
@"name":@"知识点",
@"category":@[
@{@"cateId":@"1", @"name":@"获得发展史", @"info":@[@{@"id":@"1", @"startTime":@"17",@"endTime":@"35", @"desc":@"发展史"}]}, @{@"cateId":@"2", @"name":@"品牌升级", @"info":@[@{@"id":@"1", @"startTime":@"35", @"endTime":@"50", @"desc":@"品牌升级"}]},
@{@"cateId":@"3", @"name":@"产品介绍", @"info":@[@{@"id":@"1", @"startTime":@"50", @"endTime":@"63", @"desc":@"产品介绍"}, @{@"id":@"2", @"startTime":@"64", @"endTime":@"68",@"desc":@"数说获得"},@{@"id":@"3", @"startTime":@"68", @"endTime":@"83",@"desc":@"应用场景"}]},
......@@ -642,9 +648,6 @@ typedef enum : NSUInteger {
@{@"cateId":@"6", @"name":@"员工风采", @"info":@[@{@"id":@"1", @"startTime":@"148", @"endTime":@"208", @"desc":@"员工风采锦集"}]}
]
};
// NSError *error;
// NSString *path = [[NSBundle mainBundle]pathForResource:@"knowledge" ofType:@"json"];
// NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:[NSData dataWithContentsOfFile:path] options:NSJSONReadingMutableLeaves error:&error];
if(self.index == 0){//传入知识点功能的数据
self.playerView = [[DWVodPlayerView alloc]initWithKnowledgeData:dict];
}else{
......
......@@ -13,7 +13,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface DWKnowledgeModel : NSObject
@property (nonatomic, copy) NSString *cateId;
@property (nonatomic, copy) NSString *name;
@property (nonatomic, copy) NSMutableArray <info *>*info;
@property (nonatomic, strong) NSMutableArray <info *>*info;
@property (nonatomic, assign) BOOL isSelect;//默认为NO
@end
......
......@@ -74,7 +74,7 @@
}
- (void)configViewWithModel:(info *)model{
_circleLabel.text = model.id;
_circleLabel.text = [NSString stringWithFormat:@"%d", [model.id intValue] + 1];
if(model.desc.length == 0){
_decLabel.hidden = YES;
[_titleLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
......@@ -91,7 +91,7 @@
make.height.equalTo(@15);
}];
}
if(model.endTime.length == 0){
if(model.endTime.length == 0 || [model.endTime isEqualToString:@"0"]){
_titleLabel.text = [self getMMSSFromSS:model.startTime];
}else{
_titleLabel.text = [NSString stringWithFormat:@"%@~%@", [self getMMSSFromSS:model.startTime], [self getMMSSFromSS:model.endTime]];
......@@ -103,7 +103,6 @@
-(NSString *)getMMSSFromSS:(NSString *)totalTime{
NSInteger seconds = [totalTime integerValue];
//format of minute
NSString *str_minute = [NSString stringWithFormat:@"%ld",seconds/60];
//format of second
......@@ -116,11 +115,8 @@
str_second = [NSString stringWithFormat:@"0%@", str_second];
}
NSString *format_time = [NSString stringWithFormat:@"%@:%@",str_minute,str_second];
NSLog(@"format_time : %@",format_time);
return format_time;
}
- (void)awakeFromNib {
......
......@@ -34,7 +34,7 @@
tap.delegate = self;
[self addGestureRecognizer:tap];
[[UIApplication sharedApplication].keyWindow addSubview:self];
_titleString = knowledgeData[@"title"];
_titleString = knowledgeData[@"name"];
_pauseStatus = [knowledgeData[@"pauseStatus"] boolValue];
[self setupUI];
NSArray *arr = knowledgeData[@"category"];
......@@ -117,7 +117,7 @@
}else{
iv.image = [UIImage imageNamed:@"knowledge_down"];
}
if(self.datasource.count == 1 || model.info.count == 1){
if(model.info.count == 1){
iv.hidden = YES;
}else{
[headerView addGestureRecognizer:tap];
......@@ -145,9 +145,9 @@
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
DWKnowledgeModel *model = self.datasource[section];
if(self.datasource.count == 1){//当只有一个的时候要展开
return model.info.count;
}
// if(self.datasource.count == 1){//当只有一个的时候要展开
// return model.info.count;
// }
if(model.isSelect == 0){
return 0;
}else{
......
......@@ -238,6 +238,7 @@
@property (nonatomic, strong) UILabel *markLabel;//显示打点描述
//知识点功能
@property (nonatomic, copy)NSDictionary *knowledheDict;
@property (nonatomic, copy) NSDictionary *knowledgeLocalDict;//本地知识点
@property (nonatomic, strong) UIButton *knowledgeBtn;//知识点
@property (nonatomic, copy) NSString *endTime;//时间段结束时间
@property (nonatomic, copy) NSString *statrTime;//开始时间
......@@ -260,14 +261,14 @@ static CGFloat barrageBgHeight = 40;
- (instancetype)initWithKnowledgeData:(NSDictionary *)knowledgeDict{
if(self = [super init]){
[self setupinitData];
_knowledheDict = knowledgeDict;
_knowledgeLocalDict = knowledgeDict;
}
return self;
}
-(instancetype)init
{
if (self == [super init]) {
if (self = [super init]) {
[self setupinitData];
}
return self;
......@@ -417,7 +418,8 @@ static CGFloat barrageBgHeight = 40;
// _hud = [MBProgressHUD showHUDAddedTo:self.maskView animated:YES];
// _hud.label.text = @"努力加载中,请稍后";
self.downloadModel = nil;
self.indexPath = nil;
[self.sliderView removeFromSuperview];
[self clearVideoMark];
[self showHudWithMessage:@"努力加载中,请稍后"];
......@@ -465,12 +467,13 @@ static CGFloat barrageBgHeight = 40;
_answerView = nil;
}
[self.answerArr removeAllObjects];
//当数组中包含video_clicker的时候才会请求答题器接口
if([self.videoModel.reskeys containsObject:@"video_clicker"]){
//当数组中包含video_clicker的时候才会请求答题器和知识点接口
if([self.videoModel.reskeys containsObject:@"video_clicker"] || [self.videoModel.reskeys containsObject:@"video_knowledge"]){
NSString *reskey = [self.videoModel.reskeys componentsJoinedByString:@","];
//获取答题器数据
[DWAnswerRequest sendGetAnswerDataWithVideoId:self.videoModel.videoId userId:[DWConfigurationManager sharedInstance].DWAccount_userId callBlock:^(NSDictionary * _Nonnull dic) {
[DWAnswerRequest sendGetAnswerDataWithVideoId:self.videoModel.videoId userId:[DWConfigurationManager sharedInstance].DWAccount_userId reskeys:reskey callBlock:^(NSDictionary * _Nonnull dic) {
if([dic[@"code"] intValue] == 0){
for (NSDictionary *dict in dic[@"data"]) {
for (NSDictionary *dict in dic[@"data"][@"video_clicker"]) {
DWAnswerModel *model = [DWAnswerModel mj_objectWithKeyValues:dict];
[self.answerArr addObject:model];
}
......@@ -492,6 +495,23 @@ static CGFloat barrageBgHeight = 40;
[self.answerArr removeAllObjects];
[self.answerArr addObjectsFromArray:sortArray];
//知识点赋值
if(self.knowledgeLocalDict.count == 0 && !self.knowledgeLocalDict){
id temp = dic[@"data"][@"video_knowledge"];
if([temp isKindOfClass:[NSDictionary class]]){
self.knowledheDict = dic[@"data"][@"video_knowledge"];
[self.knowledgeBtn setTitle:dic[@"data"][@"video_knowledge"][@"name"] forState:0];
if(self.isFull){
self.knowledgeBtn.hidden = NO;
}
}else{
self.knowledheDict = nil;
self.knowledgeBtn.hidden = YES;
}
}else{
self.knowledgeBtn.hidden = NO;
[self.knowledgeBtn setTitle:self.knowledgeLocalDict[@"name"] forState:0];
}
}
}];
}
......@@ -566,29 +586,33 @@ static CGFloat barrageBgHeight = 40;
[self.playerView pause];
}
- (DWPlayerKnowledgeView *)knowledgeView{
if(!_knowledgeView){
CGFloat totalTime = CMTimeGetSeconds(self.playerView.player.currentItem.duration);
_knowledgeView = [[DWPlayerKnowledgeView alloc] initWithData:self.knowledheDict totalTime:totalTime index:self.indexPath];
}
return _knowledgeView;
}
#pragma mark - 知识点按钮点击事件
- (void)handleKnowledgeBtn{
// CGFloat totalTime = CMTimeGetSeconds(self.playerView.player.currentItem.duration);
// DWPlayerKnowledgeView *knowledgeView = [[DWPlayerKnowledgeView alloc] initWithData:self.knowledheDict totalTime:totalTime index:self.indexPath];
CGFloat totalTime = CMTimeGetSeconds(self.playerView.player.currentItem.duration);
NSDictionary *dict;
if(!self.knowledgeLocalDict){
dict = self.knowledheDict;
}else{
dict = self.knowledgeLocalDict;
}
_knowledgeView = [[DWPlayerKnowledgeView alloc] initWithData:dict totalTime:totalTime index:self.indexPath];
WeakSelf(self);
self.knowledgeView.knowledgeBlock = ^(info * _Nonnull model, BOOL pauseStatus, NSIndexPath * _Nonnull indexPath) {
StrongSelf(self);
self.indexPath = indexPath;
[self createFuncTimer];
if(model.endTime.length == 0){
self.pauseStatus = NO;
// if(model.endTime.length == 0){
if([self.knowledheDict[@"timeAxisStatus"] boolValue] == NO || model.endTime.length == 0){
self.sliderView.hidden = YES;
self.pauseStatus = pauseStatus;
self.endTime = model.endTime;
self.statrTime = model.startTime;
[self.playerView scrub:[model.startTime floatValue]];
[self play];
[self.sliderView removeFromSuperview];
}else{
self.sliderView.hidden = NO;
self.knowledgeIsSelect = YES;
self.endTime = model.endTime;
self.statrTime = model.startTime;
......@@ -598,20 +622,24 @@ static CGFloat barrageBgHeight = 40;
[self.sliderView removeFromSuperview];
self.sliderView = [UIView new];
self.sliderView.backgroundColor = ColorFrom16A(0xff920a, 0.6);
[self.slider addSubview:self.sliderView];
CGFloat durationInSeconds = CMTimeGetSeconds(self.playerView.player.currentItem.duration);
CGFloat startX = model.startTime.floatValue/durationInSeconds * (ScreenWidth - 90);
CGFloat endX = model.endTime.floatValue/durationInSeconds * (ScreenWidth - 90);
CGFloat width = endX - startX;
if(width < 1){
width = 1.0;
if(self.endTime.length != 0 && ![self.endTime isEqualToString:@"0"]){
[self.slider addSubview:self.sliderView];
CGFloat durationInSeconds = CMTimeGetSeconds(self.playerView.player.currentItem.duration);
CGFloat startX = model.startTime.floatValue/durationInSeconds * (ScreenWidth - 135);
CGFloat endX = model.endTime.floatValue/durationInSeconds * (ScreenWidth - 135);
CGFloat width = endX - startX;
if(width < 1){
width = 1.0;
}
[self.sliderView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(self.slider.mas_centerY).offset(16);
make.left.equalTo(self.slider).offset(startX);
make.width.equalTo(@(width));
make.height.equalTo(@3);
}];
}
[self.sliderView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(self.slider.mas_centerY).offset(16);
make.left.equalTo(self.slider).offset(startX);
make.width.equalTo(@(width));
make.height.equalTo(@3);
}];
}
};
[self.knowledgeView show];
......@@ -762,12 +790,16 @@ static CGFloat barrageBgHeight = 40;
self.otherFuncButton.hidden = NO;
self.speedButton.hidden = NO;
self.qualityButton.hidden = !self.isVideo;
if(self.knowledheDict){
if(self.knowledheDict || self.knowledgeLocalDict){
self.knowledgeBtn.hidden = NO;
}else{
self.knowledgeBtn.hidden = YES;
}
self.sliderView.hidden = NO;
if([self.knowledheDict[@"timeAxisStatus"] boolValue] == NO){
self.sliderView.hidden = YES;
}else{
self.sliderView.hidden = NO;
}
if (self.downloadModel) {
self.chooseButton.hidden = YES;
......@@ -1251,6 +1283,7 @@ static CGFloat barrageBgHeight = 40;
return;
}
self.readyToPlay = NO;
self.playRepeat = NO;
......@@ -2258,7 +2291,6 @@ static CGFloat barrageBgHeight = 40;
//播放/暂停
-(void)playOrPauseButtonAction
{
self.pauseStatus = 0;
if (!self.readyToPlay) {
return;
}
......@@ -4038,15 +4070,18 @@ static CGFloat barrageBgHeight = 40;
if(self.pauseStatus && self.endTime.length != 0){
if(cuTime == self.endTime.intValue){
[self pause];
[self.sliderView removeFromSuperview];
self.endTime = nil;
self.indexPath = nil;
}
}
if(self.endTime.length > 0){
if(cuTime > self.endTime.intValue){
if(cuTime == self.endTime.intValue+1){
_knowledgeIsSelect = NO;
if(_sliderView && !_knowledgeIsSelect){
self.indexPath = nil;
[self.sliderView removeFromSuperview];
}
_knowledgeIsSelect = NO;
}
}
}
......@@ -4372,7 +4407,7 @@ static CGFloat barrageBgHeight = 40;
self.playerView.autoPlay = self.autoPlay;
//是否开启防录屏
// self.playerView.videoProtect = YES;
self.playerView.videoProtect = YES;
[self insertSubview:self.playerView atIndex:0];
[_playerView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.and.top.equalTo(@0);
......@@ -4937,7 +4972,7 @@ static CGFloat barrageBgHeight = 40;
{
if (!_speedArray) {
_speedArray = [[NSMutableArray alloc]init];
NSArray * titles = @[@"0.5X",@"1.0X",@"1.5X",@"2.0X"];
NSArray * titles = @[@"0.5X",@"1.0X",@"1.5X",@"2.0X",@"2.5X"];
[titles enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
DWTableChooseModel * chooseModel = [[DWTableChooseModel alloc]init];
chooseModel.title = (NSString *)obj;
......
//版本号
#define SDK_VERSION @"4.15.5"
#define SDK_VERSION @"4.15.6"
#import <CCVodSDK/DWGIFManager.h>
#import <CCVodSDK/DWAdInfo.h>
......
......@@ -15,8 +15,9 @@ NS_ASSUME_NONNULL_BEGIN
*获取答题器问题
*videoid:加密视频id,必填
*userid:加密用户id,必填
*reskeys:权限key:如:video_clicker,video_knowledge知识点和答题器
*/
+ (void)sendGetAnswerDataWithVideoId:(NSString *)videoId userId:(NSString *)userId callBlock:(void(^)(NSDictionary *dic))callBackBlock;
+ (void)sendGetAnswerDataWithVideoId:(NSString *)videoId userId:(NSString *)userId reskeys:(NSString *)reskey callBlock:(void(^)(NSDictionary *dic))callBackBlock;
/**
*提交答案
......
......@@ -48,6 +48,7 @@ NS_ASSUME_NONNULL_BEGIN
* @brief 默认清晰度
*/
@property(nonatomic, strong, readonly)NSString * defaultquality;
@property (nonatomic, strong) NSString *currentQuality;
/**
* @brief 分享URL
......
//版本号
#define SDK_VERSION @"4.15.5"
#define SDK_VERSION @"4.15.6"
#import <CCVodSDK/DWGIFManager.h>
#import <CCVodSDK/DWAdInfo.h>
......
......@@ -15,8 +15,9 @@ NS_ASSUME_NONNULL_BEGIN
*获取答题器问题
*videoid:加密视频id,必填
*userid:加密用户id,必填
*reskeys:权限key:如:video_clicker,video_knowledge知识点和答题器
*/
+ (void)sendGetAnswerDataWithVideoId:(NSString *)videoId userId:(NSString *)userId callBlock:(void(^)(NSDictionary *dic))callBackBlock;
+ (void)sendGetAnswerDataWithVideoId:(NSString *)videoId userId:(NSString *)userId reskeys:(NSString *)reskey callBlock:(void(^)(NSDictionary *dic))callBackBlock;
/**
*提交答案
......
......@@ -48,6 +48,7 @@ NS_ASSUME_NONNULL_BEGIN
* @brief 默认清晰度
*/
@property(nonatomic, strong, readonly)NSString * defaultquality;
@property (nonatomic, strong) NSString *currentQuality;
/**
* @brief 分享URL
......
//版本号
#define SDK_VERSION @"4.15.5"
#define SDK_VERSION @"4.15.6"
#import <CCVodSDK/DWGIFManager.h>
#import <CCVodSDK/DWAdInfo.h>
......
......@@ -15,8 +15,9 @@ NS_ASSUME_NONNULL_BEGIN
*获取答题器问题
*videoid:加密视频id,必填
*userid:加密用户id,必填
*reskeys:权限key:如:video_clicker,video_knowledge知识点和答题器
*/
+ (void)sendGetAnswerDataWithVideoId:(NSString *)videoId userId:(NSString *)userId callBlock:(void(^)(NSDictionary *dic))callBackBlock;
+ (void)sendGetAnswerDataWithVideoId:(NSString *)videoId userId:(NSString *)userId reskeys:(NSString *)reskey callBlock:(void(^)(NSDictionary *dic))callBackBlock;
/**
*提交答案
......
......@@ -48,6 +48,7 @@ NS_ASSUME_NONNULL_BEGIN
* @brief 默认清晰度
*/
@property(nonatomic, strong, readonly)NSString * defaultquality;
@property (nonatomic, strong) NSString *currentQuality;
/**
* @brief 分享URL
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment