Commit a793c64c authored by Han Ruisong's avatar Han Ruisong
Browse files

升级到 4.4.1

1.跑马灯功能优化。
parent 7d7f493c
No preview for this file type
This diff is collapsed.
......@@ -3,22 +3,4 @@
uuid = "D493E4A5-FF32-4C5D-B61B-0D88D4BD1AD4"
type = "1"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "AFBDA185-F80C-4FB7-9C05-D31B5996C717"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Demo/Plugins/HDMarqueeView.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "118"
endingLineNumber = "118"
landmarkName = "-stopMarquee"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
......@@ -164,7 +164,9 @@
//@property(nonatomic,strong)NSTimer * testTimer;
//**************************** marquee ****************************
#if __has_include(<HDMarqueeTool/HDMarqueeTool.h>)
@property(nonatomic,strong)HDMarqueeView * marqueeView;
#endif
@end
......@@ -201,8 +203,6 @@ static const CGFloat gifSeconds = 0.25;
[self initRadioView];
[self initFuncGesture];
[self initAirPlayView];
//开启跑马灯功能
// [self initMarqueeView];
//初始化时,默认竖屏设置
[self hideAndClearNotNecessaryView];
......@@ -284,6 +284,11 @@ static const CGFloat gifSeconds = 0.25;
//处理视频清晰度数据
[self dealQualityArray];
#if __has_include(<HDMarqueeTool/HDMarqueeTool.h>)
//开启跑马灯功能
[self initMarqueeView];
#endif
}
-(void)playLocalVideo:(DWDownloadModel *)downloadModel
......@@ -306,6 +311,11 @@ static const CGFloat gifSeconds = 0.25;
[self.playerView playLocalVideo:downloadModel];
[self play];
#if __has_include(<HDMarqueeTool/HDMarqueeTool.h>)
//开启跑马灯功能
[self initMarqueeView];
#endif
}
-(void)reLayoutWithScreenState:(BOOL)isFull
......@@ -316,9 +326,11 @@ static const CGFloat gifSeconds = 0.25;
[self updateConstraintsAndHidden];
#if __has_include(<HDMarqueeTool/HDMarqueeTool.h>)
if (self.marqueeView) {
[self.marqueeView startMarquee];
}
#endif
}
-(void)play
......@@ -2959,56 +2971,30 @@ static const CGFloat gifSeconds = 0.25;
}];
}
#if __has_include(<HDMarqueeTool/HDMarqueeTool.h>)
-(void)initMarqueeView
{
NSData * jsonData = [[NSData alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"marquee" ofType:@"json"]];
NSDictionary * marqueeSetDict = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableLeaves error:nil];
if (!marqueeSetDict) {
if (self.marqueeView) {
[self.marqueeView removeFromSuperview];
self.marqueeView = nil;
}
NSData * jsonData = nil;
//判断是否是离线视频
if (self.downloadModel) {
//离线视频
jsonData = [self.downloadModel.marqueeStr dataUsingEncoding:NSUTF8StringEncoding];
}else{
//在线视频
jsonData = [self.videoModel.authorize.marqueeStr dataUsingEncoding:NSUTF8StringEncoding];
}
if (!jsonData) {
return;
}
//解析数据格式如下
/*
{
"loop": 0,
"type": "text",
"text": {
"content": "<<<我是跑马灯>>>",
"font_size": 20,
"color": "0x008800"
},
"image": {
"image_url": "abc.jpg",
"width": 300,
"height": 22
},
"action": [{
"duration": 3,
"start": {
"xpos": 0.012,
"ypos": 0,
"alpha": 0.8
},
"end": {
"xpos": 0.912,
"ypos": 0.823,
"alpha": 0.8
}
}, {
"duration": 5,
"start": {
"xpos": 0.312,
"ypos": 0.823,
"alpha": 0.8
},
"end": {
"xpos": 0.912,
"ypos": 0.123,
"alpha": 0.2
}
}]
}
*/
NSDictionary * marqueeSetDict = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableLeaves error:nil];
CGFloat width = 0.0;
CGFloat height = 0.0;
......@@ -3022,7 +3008,7 @@ static const CGFloat gifSeconds = 0.25;
NSDictionary * textDict = [marqueeSetDict objectForKey:@"text"];
NSString * text = [textDict objectForKey:@"content"];
UIColor * textColor = [DWTools colorWithHexString:[textDict objectForKey:@"color"]];
UIFont * textFont = [UIFont systemFontOfSize:[[textDict objectForKey:@"font_size"] floatValue]];
UIFont * textFont = [UIFont systemFontOfSize:[[textDict objectForKey:@"font_size"] floatValue] / [UIScreen mainScreen].scale];
self.marqueeView.text = text;
self.marqueeView.textAttributed = @{NSFontAttributeName:textFont,NSForegroundColorAttributeName:textColor};
......@@ -3036,8 +3022,8 @@ static const CGFloat gifSeconds = 0.25;
NSURL * imageURL = [NSURL URLWithString:[imageDict objectForKey:@"image_url"]];
self.marqueeView.imageURL = imageURL;
width = [[imageDict objectForKey:@"width"] floatValue];
height = [[imageDict objectForKey:@"height"] floatValue];
width = [[imageDict objectForKey:@"width"] floatValue] / [UIScreen mainScreen].scale;
height = [[imageDict objectForKey:@"height"] floatValue] / [UIScreen mainScreen].scale;
}
self.marqueeView.frame = CGRectMake(0, 0, width, height);
......@@ -3052,7 +3038,7 @@ static const CGFloat gifSeconds = 0.25;
NSDictionary * endDict = [actionDict objectForKey:@"end"];
HDMarqueeAction * marqueeAction = [[HDMarqueeAction alloc]init];
marqueeAction.duration = duration;
marqueeAction.duration = duration / 1000.0;
marqueeAction.startPostion.alpha = [[startDict objectForKey:@"alpha"] floatValue];
marqueeAction.startPostion.pos = CGPointMake([[startDict objectForKey:@"xpos"] floatValue], [[startDict objectForKey:@"ypos"] floatValue]);
marqueeAction.endPostion.alpha = [[endDict objectForKey:@"alpha"] floatValue];
......@@ -3064,14 +3050,16 @@ static const CGFloat gifSeconds = 0.25;
// NSLog(@"marqueeView actions : %@",actions);
self.marqueeView.actions = actions;
[self.playerView insertSubview:self.marqueeView atIndex:0];
// [self.playerView insertSubview:self.marqueeView atIndex:0];
[self.playerView addSubview:self.marqueeView];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self.marqueeView startMarquee];
});
// [self.marqueeView startMarquee];
}
#endif
#pragma mark - lazyLoad
//顶部
......
......@@ -24,10 +24,11 @@
-(instancetype)init
{
if (self == [super init]) {
//配置默认值 这里
self.DWAccount_userId = @"391E6E3340A00767";
self.DWAccount_apikey = @"T8WdOUuvFEiOsou1xjDr4U73v12M7iNa";
self.isOpenAd = NO;
}
return self;
......
......@@ -54,4 +54,6 @@
#import "DWConfigurationManager.h"
#import "UIImageView+WebCache.h"
#if __has_include(<HDMarqueeTool/HDMarqueeTool.h>)
#import <HDMarqueeTool/HDMarqueeTool.h>
#endif
//
// HDMarqueeTool.h
// HDMarqueeTool
//
// Created by zwl on 2020/3/9.
// Copyright © 2020 zwl. All rights reserved.
//
#import <Foundation/Foundation.h>
//! Project version number for HDMarqueeTool.
FOUNDATION_EXPORT double HDMarqueeToolVersionNumber;
//! Project version string for HDMarqueeTool.
FOUNDATION_EXPORT const unsigned char HDMarqueeToolVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <HDMarqueeTool/PublicHeader.h>
#import "HDMarqueeAction.h"
#import "HDMarqueeView.h"
......@@ -15,7 +15,6 @@ FOUNDATION_EXPORT double HDMarqueeToolVersionNumber;
FOUNDATION_EXPORT const unsigned char HDMarqueeToolVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <HDMarqueeTool/PublicHeader.h>
#import "HDMarqueeView.h"
#import "HDMarqueeAction.h"
#import "HDMarqueeAction.h"
#import "HDMarqueeView.h"
......@@ -48,6 +48,9 @@ typedef NS_ENUM(NSUInteger, HDMarqueeViewStyle) {
///跑马灯图片
@property(nonatomic,strong)NSURL * imageURL;
///跑马灯图片显示模式,默认kCAGravityResize
@property(nonatomic,copy)NSString * imageGravity;
///跑马灯效果,必填
@property(nonatomic,strong)NSArray <HDMarqueeAction *> * actions;
......
......@@ -69,6 +69,9 @@ typedef void (^DWDownloadStateBlock)(DWDownloadModel *downloadModel, NSError *er
//videoId
@property (nonatomic, strong, readonly) NSString * videoId;
///跑马灯数据
@property (nonatomic, strong, readonly)NSString * marqueeStr;
/// 自定义字段 根据自己需求适当添加,比如添加媒体图片,标题等
@property (nonatomic, strong) NSDictionary * othersInfo;
......
......@@ -26,5 +26,5 @@
#import "DWVodAdInfoModel.h"
//版本号
#define SDK_VERSION @"4.4.0"
#define SDK_VERSION @"4.4.1"
......@@ -222,6 +222,9 @@
///提示内容
@property (nonatomic, strong, readonly)NSString * message;
///跑马灯数据
@property (nonatomic, strong, readonly)NSString * marqueeStr;
@end
//访客信息收集器
......
No preview for this file type
{
"loop": -1,
"type": "text",
"text": {
"content": "<<<我是跑马灯>>>",
"font_size": 20,
"color": "0x008800"
},
"image": {
"image_url": "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1583841662861&di=d6d270ab4786cee02b222b3cf1c4f43e&imgtype=0&src=http%3A%2F%2Fi0.hdslb.com%2Fbfs%2Farticle%2F3d0737c5cc6379f36308d7d1da390bf8654861ab.jpg",
"width": 120,
"height": 77
},
"action": [{
"duration": 3,
"start": {
"xpos": 0.012,
"ypos": 0,
"alpha": 0.8
},
"end": {
"xpos": 0.912,
"ypos": 0.823,
"alpha": 0.8
}
}, {
"duration": 5,
"start": {
"xpos": 0.312,
"ypos": 0.823,
"alpha": 0.8
},
"end": {
"xpos": 0.912,
"ypos": 0.123,
"alpha": 0.2
}
}]
}
......@@ -69,6 +69,9 @@ typedef void (^DWDownloadStateBlock)(DWDownloadModel *downloadModel, NSError *er
//videoId
@property (nonatomic, strong, readonly) NSString * videoId;
///跑马灯数据
@property (nonatomic, strong, readonly)NSString * marqueeStr;
/// 自定义字段 根据自己需求适当添加,比如添加媒体图片,标题等
@property (nonatomic, strong) NSDictionary * othersInfo;
......
......@@ -26,5 +26,5 @@
#import "DWVodAdInfoModel.h"
//版本号
#define SDK_VERSION @"4.4.0"
#define SDK_VERSION @"4.4.1"
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