YBLookVideoCell.m 56 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384
  1. //
  2. // YBLookVideoCell.m
  3. // YBVideo
  4. //
  5. // Created by YB007 on 2019/11/7.
  6. // Copyright © 2019 cat. All rights reserved.
  7. //
  8. #import "YBLookVideoCell.h"
  9. #import <ZFPlayer/UIImageView+ZFCache.h>
  10. #import "RKLampView.h"
  11. #import "CCAnimationBtn.h"
  12. #import <YYText/YYLabel.h>
  13. #import <YYText/NSAttributedString+YYText.h>
  14. #import "lookVGoodsDView.h"
  15. #import "topicDetailsVC.h"
  16. #import "PubH5.h"
  17. #import "YBCenterVC.h"
  18. #import "commentview.h"
  19. #import "YBShareView.h"
  20. #import "YBVideoReportVC.h"
  21. #import "addHotVideoVC.h"
  22. #import "YBGiftPage.h"
  23. #import "TCVideoRecordViewController.h"
  24. #import "YBTakeSameVideoVC.h"
  25. #import "YBCheckLiveObj.h"
  26. #import "YBCreatorActInfoVC.h"
  27. @interface YBLookVideoCell()
  28. {
  29. NSTimer *_adLookTimer;
  30. int _adTimerCount;
  31. lookVGoodsDView *goodsDView;
  32. commentview *_commentView;
  33. }
  34. @property (nonatomic, strong) UIImageView *coverImageView;
  35. @property (nonatomic, strong) UIImageView *bgImgView;
  36. @property (nonatomic, strong) UIView *effectView;
  37. /** 头像 点赞 评论 分享集合 */
  38. @property(nonatomic,strong)UIView *rightView;
  39. @property(nonatomic,strong)UIView *liveingV;
  40. @property(nonatomic,strong)UILabel *liveingL;
  41. @property(nonatomic,strong) UIButton *iconBtn;
  42. //@property(nonatomic,strong) UIButton *followBtn; //关注
  43. @property(nonatomic,strong)NSString *isLike; //是否点赞
  44. @property(nonatomic,strong) UIButton *likebtn; //点赞
  45. @property(nonatomic,strong) UIButton *commentBtn;
  46. @property(nonatomic,strong) UIButton *enjoyBtn;
  47. @property(nonatomic,strong)UIButton *collectionBtn;
  48. @property(nonatomic,strong)UIImageView *discIV; //唱片背景
  49. @property(nonatomic,strong)UIImageView *musicIV; //歌曲背景图
  50. @property(nonatomic,strong)UIImageView *symbolAIV; //音符A
  51. @property(nonatomic,strong)UIImageView *symbolBIV; //音符B
  52. /** 名字 标题 (音乐)集合 */
  53. @property(nonatomic,strong)UIView *botView;
  54. @property(nonatomic,strong)RKLampView *musicL; //音乐
  55. @property(nonatomic,strong)YYLabel *titleL; //视频标题
  56. @property(nonatomic,strong)UILabel *nameL;
  57. @property(nonatomic,strong)UILabel *adLabel; //广告
  58. @property(nonatomic,strong) UIButton *adButton; //广告按钮
  59. @property(nonatomic,strong) UIButton *topicBtn; //标签按钮
  60. @property(nonatomic,strong)UIButton *ttFullBtn;
  61. @end
  62. @implementation YBLookVideoCell
  63. - (instancetype)initWithFrame:(CGRect)frame {
  64. self = [super initWithFrame:frame];
  65. if (self) {
  66. _adTimerCount = 5;
  67. self.backgroundColor = Normal_Color;
  68. [self.contentView addSubview:self.bgImgView];
  69. [_bgImgView mas_makeConstraints:^(MASConstraintMaker *make) {
  70. make.width.height.centerX.centerY.equalTo(self.contentView);
  71. }];
  72. /*
  73. [self.bgImgView addSubview:self.effectView];
  74. [_effectView mas_makeConstraints:^(MASConstraintMaker *make) {
  75. make.width.height.centerX.centerY.equalTo(_bgImgView);
  76. }];
  77. */
  78. [self.contentView addSubview:self.coverImageView];
  79. [_coverImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  80. make.width.height.centerX.centerY.equalTo(self.contentView);
  81. }];
  82. /*
  83. UIImageView *mask_top = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, _window_width, 100+statusbarHeight)];
  84. [mask_top setImage:[UIImage imageNamed:@"home_mask_top"]];
  85. [self.contentView addSubview:mask_top];
  86. UIImageView* mask_buttom = [[UIImageView alloc] initWithFrame:CGRectMake(0, _window_height-49-ShowDiff, _window_width, 49+ShowDiff)];
  87. [mask_buttom setImage:[UIImage imageNamed:@"home_mask_bottom"]];
  88. mask_buttom.userInteractionEnabled = YES;
  89. [self.contentView addSubview:mask_buttom];
  90. */
  91. [self.contentView addSubview:self.rightView];
  92. [_rightView mas_makeConstraints:^(MASConstraintMaker *make) {
  93. make.width.mas_equalTo(85);
  94. make.right.equalTo(self.contentView);
  95. make.bottom.equalTo(self.contentView.mas_bottom).offset(-ShowDiff-50);
  96. make.top.equalTo(_iconBtn.mas_top).offset(-10);
  97. }];
  98. [self.contentView addSubview:self.botView];
  99. [_botView mas_makeConstraints:^(MASConstraintMaker *make) {
  100. make.left.equalTo(self.contentView).offset(10);
  101. make.right.equalTo(_rightView.mas_left).offset(-8);
  102. make.bottom.equalTo(_rightView.mas_bottom).offset(-15);
  103. // make.top.equalTo(_adLabel.mas_top).offset(-10);
  104. // make.top.equalTo(_topicBtn.mas_top).offset(-10);
  105. }];
  106. [self.contentView addSubview:self.ttFullBtn];
  107. }
  108. return self;
  109. }
  110. -(void)releaseObj:(NSDictionary *)oldDic isBackGround:(BOOL)isBack{
  111. if (_adLookTimer) {
  112. [_adLookTimer invalidate];
  113. _adLookTimer = nil;
  114. }
  115. _adTimerCount = 5;
  116. NSString *is_ad_str = minstr([oldDic valueForKey:@"is_ad"]);
  117. NSString *is_userad = minstr([_dataDic valueForKey:@"is_userad"]);//是否是用户广告视频0否1是
  118. NSLog(@"=====player:%f",_player.currentTime);
  119. if ([is_ad_str isEqual:@"1"] && !isBack) {
  120. [_adButton setBackgroundColor:[[UIColor blackColor] colorWithAlphaComponent:0.3]];
  121. [_adButton setTitleColor:RGB_COLOR(@"#969696", 1) forState:0];
  122. _adButton.userInteractionEnabled = NO;
  123. }
  124. if ([is_userad isEqual:@"1"] && !isBack) {
  125. [_adButton setBackgroundColor:[[UIColor blackColor] colorWithAlphaComponent:0.3]];
  126. [_adButton setTitleColor:RGB_COLOR(@"#969696", 1) forState:0];
  127. _adButton.userInteractionEnabled = NO;
  128. }
  129. if (goodsDView) {
  130. [goodsDView removeFromSuperview];
  131. goodsDView = nil;
  132. }
  133. [self removeCommentView];
  134. [_iconBtn.imageView.layer removeAllAnimations];
  135. [_liveingV.layer removeAllAnimations];
  136. _liveingV.hidden = _liveingL.hidden = YES;
  137. }
  138. -(void)checkLiveOrAdState:(NSDictionary *)cureentDic{
  139. NSString *is_ad_str = minstr([cureentDic valueForKey:@"is_ad"]);
  140. NSString *is_userad = minstr([_dataDic valueForKey:@"is_userad"]);//是否是用户广告视频0否1是
  141. if ([is_ad_str isEqual:@"1"] || [is_userad isEqual:@"1"]) {
  142. [self releaseObj:nil isBackGround:NO];
  143. _adLookTimer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(adLookDaojishi) userInfo:nil repeats:YES];
  144. }
  145. //直播中动画
  146. NSDictionary *liveInfo = [cureentDic valueForKey:@"liveinfo"];
  147. if ([[liveInfo valueForKey:@"islive"] isEqual:@"1"]) {
  148. _liveingV.hidden = _liveingL.hidden = NO;
  149. [_iconBtn.imageView.layer addAnimation:[PublicObj avatarScaleAnimation] forKey:@"avatar_scale"];
  150. [_liveingV.layer addAnimation:[PublicObj bottomScaleAnimation] forKey:@"bottom_scale"];
  151. }else {
  152. _liveingV.hidden = _liveingL.hidden = YES;
  153. }
  154. }
  155. -(void)startMusicAnimation:(NSDictionary *)startDic {
  156. [_musicL startLamp];
  157. _symbolAIV.hidden = NO;
  158. [_discIV.layer addAnimation:[PublicObj rotationAnimation] forKey:@"rotation"];
  159. [_symbolAIV.layer addAnimation:[PublicObj caGroup] forKey:nil];
  160. [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(startBAnimation) object:nil];
  161. [self performSelector:@selector(startBAnimation) withObject:nil afterDelay:1.5];
  162. }
  163. -(void)startBAnimation {
  164. _symbolBIV.hidden = NO;
  165. [_symbolBIV.layer addAnimation:[PublicObj caGroup] forKey:nil];
  166. }
  167. -(void)stopMusicAnimation:(NSDictionary *)stopDic {
  168. [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(startBAnimation) object:nil];
  169. [_symbolAIV.layer removeAllAnimations];
  170. [_symbolBIV.layer removeAllAnimations];
  171. [_discIV.layer removeAllAnimations];
  172. _symbolAIV.hidden = YES;
  173. _symbolBIV.hidden = YES;
  174. [_musicL stopLamp];
  175. }
  176. - (void)setDataDic:(NSDictionary *)dataDic {
  177. _dataDic = dataDic;
  178. //player-contentMode
  179. CGFloat coverRatio = 1.78;
  180. if (![PublicObj checkNull:minstr([_dataDic valueForKey:@"anyway"])]) {
  181. coverRatio = [minstr([_dataDic valueForKey:@"anyway"]) floatValue];
  182. }
  183. if (coverRatio > 1) {
  184. _coverImageView.contentMode = UIViewContentModeScaleAspectFill;
  185. self.coverImageView.clipsToBounds = YES;
  186. _ttFullBtn.hidden = YES;
  187. }else {
  188. _coverImageView.contentMode = UIViewContentModeScaleAspectFit;
  189. self.coverImageView.clipsToBounds = NO;
  190. _ttFullBtn.hidden = NO;
  191. CGFloat videoH = coverRatio * _window_width;
  192. [_ttFullBtn mas_remakeConstraints:^(MASConstraintMaker *make) {
  193. make.centerX.equalTo(self);
  194. make.height.mas_equalTo(26);
  195. make.centerY.equalTo(self.mas_centerY).offset(videoH/2+20);
  196. }];
  197. }
  198. _bgImgView.contentMode = _coverImageView.contentMode;
  199. _bgImgView.clipsToBounds = _coverImageView.clipsToBounds;
  200. /*
  201. [PublicObj getThumbSizeWithUrl:minstr([_dataDic valueForKey:@"thumb"]) complete:^(CGFloat width, CGFloat height) {
  202. if (width>=height) {
  203. _coverImageView.contentMode = UIViewContentModeScaleAspectFit;
  204. self.coverImageView.clipsToBounds = NO;
  205. }else {
  206. _coverImageView.contentMode = UIViewContentModeScaleAspectFill;
  207. self.coverImageView.clipsToBounds = YES;
  208. }
  209. _bgImgView.contentMode = _coverImageView.contentMode;
  210. _bgImgView.clipsToBounds = _coverImageView.clipsToBounds;
  211. }];
  212. */
  213. [_coverImageView sd_setImageWithURL:[NSURL URLWithString:minstr([_dataDic valueForKey:@"thumb"])] placeholderImage:[UIImage imageNamed:@"loading_bgView"]];
  214. [_bgImgView sd_setImageWithURL:[NSURL URLWithString:minstr([_dataDic valueForKey:@"thumb"])] placeholderImage:[UIImage imageNamed:@"loading_bgView"]];
  215. id userInfo = [_dataDic valueForKey:@"userinfo"];
  216. NSString *uidStr = @"";
  217. NSString *iconStr = @"";
  218. NSString *uNameStr = @"";
  219. if ([userInfo isKindOfClass:[NSDictionary class]]) {
  220. uidStr = minstr([userInfo valueForKey:@"id"]);
  221. iconStr = minstr([userInfo valueForKey:@"avatar"]);
  222. uNameStr = [NSString stringWithFormat:@"@%@",[userInfo valueForKey:@"user_nickname"]];
  223. }
  224. //音乐
  225. id musicInfo = [_dataDic valueForKey:@"musicinfo"];
  226. if ([musicInfo isKindOfClass:[NSDictionary class]]) {
  227. NSString *musicID = minstr([musicInfo valueForKey:@"id"]);
  228. NSString *musicCover = minstr([musicInfo valueForKey:@"img_url"]);
  229. if ([musicID isEqual:@"0"]) {
  230. [_musicIV sd_setImageWithURL:[NSURL URLWithString:iconStr]];
  231. }else{
  232. [_musicIV sd_setImageWithURL:[NSURL URLWithString:musicCover]];
  233. }
  234. _musicL.contentStr = minstr([musicInfo valueForKey:@"music_format"]);
  235. //[_musicL startLamp];
  236. }
  237. //右边赋值
  238. [_enjoyBtn setTitle:minstr([_dataDic valueForKey:@"shares"]) forState:0];
  239. _enjoyBtn = [PublicObj setUpImgDownText:_enjoyBtn];
  240. [_commentBtn setTitle:minstr([_dataDic valueForKey:@"comments"]) forState:0];
  241. _commentBtn = [PublicObj setUpImgDownText:_commentBtn];
  242. [_likebtn setTitle:minstr([_dataDic valueForKey:@"likes"]) forState:0];
  243. _likebtn = [PublicObj setUpImgDownText:_likebtn];
  244. NSString *isLike = minstr([_dataDic valueForKey:@"islike"]);
  245. if ([isLike isEqual:@"1"]) {
  246. [_likebtn setImage:[UIImage imageNamed:@"home_zan_sel"] forState:0];
  247. }else {
  248. [_likebtn setImage:[UIImage imageNamed:@"home_zan"] forState:0];
  249. }
  250. [_collectionBtn setTitle:minstr([_dataDic valueForKey:@"collections"]) forState:0];
  251. _collectionBtn = [PublicObj setUpImgDownText:_collectionBtn];
  252. int iscollection = [minstr([_dataDic valueForKey:@"iscollection"]) intValue];
  253. _collectionBtn.selected = iscollection;
  254. int youngSwitch = [minstr([_dataDic valueForKey:@"teenagers_switch"]) intValue];
  255. [self judgeYoungSwitch:youngSwitch];
  256. [_iconBtn sd_setImageWithURL:[NSURL URLWithString:iconStr] forState:0 placeholderImage:[PublicObj getAppIcon]];
  257. NSString *isAttent = minstr([_dataDic valueForKey:@"isattent"]);
  258. if ([[Config getOwnID] isEqual:uidStr] || [isAttent isEqual:@"1"]) {
  259. _followBtn.hidden = YES;
  260. }else{
  261. [_followBtn setImage:[UIImage imageNamed:@"home_follow"] forState:0];
  262. _followBtn.hidden = NO;
  263. [_followBtn.layer addAnimation:[PublicObj followShowTransition] forKey:nil];
  264. }
  265. //底部赋值
  266. NSString *is_ad_str = minstr([_dataDic valueForKey:@"is_ad"]);
  267. NSString *ad_url_str = minstr([_dataDic valueForKey:@"ad_url"]);
  268. NSString *is_goods_str = minstr([dataDic valueForKey:@"isgoods"]);
  269. // rk_warning
  270. // 0-站内 1-站外 2-平台自营
  271. int goods_type = [minstr([dataDic valueForKey:@"goods_type"]) intValue];
  272. if ([PublicObj isUp] && goods_type == 1) {
  273. // 上架期间站外商品不展示
  274. is_goods_str = @"0";
  275. }
  276. NSString *is_userad = minstr([_dataDic valueForKey:@"is_userad"]);//是否是用户广告视频0否1是
  277. NSString *userad_url = minstr([_dataDic valueForKey:@"userad_url"]);
  278. if ([is_ad_str isEqual:@"1"] || [is_userad isEqual:@"1"]) {
  279. _topicBtn.hidden = YES;
  280. [self topicBtnLayoutOfHeight:0];
  281. _adLabel.hidden = NO;
  282. [self adLabelLayoutOfHeight:20];
  283. _adButton.hidden = NO;
  284. [self adButtonLayoutOfHeight:30];
  285. [_adButton setBackgroundColor:[[UIColor blackColor] colorWithAlphaComponent:0.3]];
  286. [_adButton setTitleColor:RGB_COLOR(@"#969696", 1) forState:0];
  287. _adButton.userInteractionEnabled = NO;
  288. [_adButton setTitle:YZMsg(@"查看详情") forState:0];
  289. }else {
  290. _adLabel.hidden = YES;
  291. [self adLabelLayoutOfHeight:0];
  292. if ([is_goods_str isEqual:@"1"]) {
  293. _adButton.hidden = NO;
  294. [self adButtonLayoutOfHeight:30];
  295. [_adButton setBackgroundColor:RGB_COLOR(@"#EA377F", 1)];
  296. [_adButton setTitleColor:[UIColor whiteColor] forState:0];
  297. _adButton.userInteractionEnabled = YES;
  298. [_adButton setTitle:YZMsg(@"查看同款商品") forState:0];
  299. }else{
  300. _adButton.hidden = YES;
  301. [self adButtonLayoutOfHeight:0];
  302. }
  303. }
  304. if (![minstr([_dataDic valueForKey:@"labelid"]) isEqual:@"0"]) {
  305. NSString *stttt = [NSString stringWithFormat: @" %@",minstr([_dataDic valueForKey:@"label_name"])];
  306. [_topicBtn setTitle:stttt forState:0];
  307. _topicBtn.hidden = NO;
  308. [self topicBtnLayoutOfHeight:20];
  309. }else{
  310. _topicBtn.hidden = YES;
  311. [self topicBtnLayoutOfHeight:0];
  312. }
  313. //标题
  314. NSString *videoTit = minstr([_dataDic valueForKey:@"title"]);
  315. NSString *att_text = [NSString stringWithFormat:@"%@ ",videoTit];
  316. NSMutableAttributedString *title_att = [[NSMutableAttributedString alloc]initWithString:att_text];
  317. title_att.yy_font = SYS_Font(15);
  318. title_att.yy_color = [UIColor whiteColor];
  319. title_att.yy_lineBreakMode = NSLineBreakByTruncatingHead;
  320. title_att.yy_kern = [NSNumber numberWithFloat:0.2];
  321. if (![PublicObj checkNull:ad_url_str]&&[is_ad_str isEqual:@"1"]) {
  322. /*
  323. NSString *att_text = [NSString stringWithFormat:@"%@ ",videoTit];
  324. NSMutableAttributedString *title_att = [[NSMutableAttributedString alloc]initWithString:att_text];
  325. */
  326. UIImage *ad_link_img = [UIImage imageNamed:getImagename(@"广告-详情")];
  327. NSMutableAttributedString *att_img = [NSMutableAttributedString yy_attachmentStringWithContent:ad_link_img contentMode:UIViewContentModeCenter attachmentSize:CGSizeMake(35, 13) alignToFont:SYS_Font(15) alignment:YYTextVerticalAlignmentCenter];
  328. //NSLog(@"-==-:%@==:%@==img:%@",att_text,title_att,att_img);
  329. [title_att appendAttributedString:att_img];
  330. NSRange click_range = [[title_att string] rangeOfString:[att_img string]];
  331. /*
  332. title_att.yy_font = SYS_Font(15);
  333. title_att.yy_color = [UIColor whiteColor];
  334. title_att.yy_lineBreakMode = NSLineBreakByTruncatingHead;
  335. title_att.yy_kern = [NSNumber numberWithFloat:0.2];
  336. */
  337. [title_att addAttribute:NSBackgroundColorAttributeName value:[UIColor clearColor] range:click_range];
  338. [title_att yy_setTextHighlightRange:click_range color:[UIColor clearColor] backgroundColor:[UIColor clearColor] tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
  339. [self clickAdButton];
  340. }];
  341. }
  342. if (![PublicObj checkNull:userad_url]&&[is_userad isEqual:@"1"]) {
  343. UIImage *ad_link_img = [UIImage imageNamed:getImagename(@"广告-详情")];
  344. NSMutableAttributedString *att_img = [NSMutableAttributedString yy_attachmentStringWithContent:ad_link_img contentMode:UIViewContentModeCenter attachmentSize:CGSizeMake(35, 13) alignToFont:SYS_Font(15) alignment:YYTextVerticalAlignmentCenter];
  345. [title_att appendAttributedString:att_img];
  346. NSRange click_range = [[title_att string] rangeOfString:[att_img string]];
  347. [title_att addAttribute:NSBackgroundColorAttributeName value:[UIColor clearColor] range:click_range];
  348. [title_att yy_setTextHighlightRange:click_range color:[UIColor clearColor] backgroundColor:[UIColor clearColor] tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
  349. [self clickAdButton];
  350. }];
  351. }
  352. NSString *activeId = strFormat([_dataDic valueForKey:@"activeid"]);
  353. if ([activeId intValue] > 0) {
  354. NSString *activeTagStr = strFormat([_dataDic valueForKey:@"activity_subject"]);
  355. NSMutableAttributedString *activeAtt = [[NSMutableAttributedString alloc] initWithString:activeTagStr];
  356. NSRange click_range = [activeAtt yy_rangeOfAll];
  357. YBWeakSelf;
  358. [activeAtt yy_setTextHighlightRange:click_range color:Pink_Cor backgroundColor:[UIColor clearColor] tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
  359. // 点击活动
  360. [weakSelf goActiveVC:activeId];
  361. }];
  362. [activeAtt addAttribute:NSFontAttributeName value:_titleL.font range:click_range];
  363. [title_att appendAttributedString:activeAtt];
  364. }
  365. _titleL.attributedText = title_att;
  366. _nameL.text = uNameStr;
  367. }
  368. -(void)goActiveVC:(NSString *)activeId {
  369. [[YBActiveManager shareManager] goActiveInfoWithId:activeId];
  370. }
  371. -(void)judgeYoungSwitch:(int)youngSwitch {
  372. _giftBtn.hidden = youngSwitch;
  373. _collectionBtn.hidden = !youngSwitch;
  374. }
  375. - (void)adLookDaojishi{
  376. _adTimerCount -- ;
  377. if (_adTimerCount <= 0) {
  378. [_adButton setTitleColor:RGB_COLOR(@"#ffffff", 1) forState:0];
  379. _adButton.userInteractionEnabled = YES;
  380. [_adButton setBackgroundColor:RGB_COLOR(@"#EA377F", 1)];
  381. [_adLookTimer invalidate];
  382. _adLookTimer = nil;
  383. _adTimerCount = 5;
  384. }
  385. }
  386. #pragma mark === click
  387. #pragma mark - 拍同款
  388. -(void)clickMusicTap {
  389. // if ([[Config getOwnID] intValue]<=0 && [Config getTranslate]) {
  390. // return;
  391. // }
  392. NSLog(@"-----");
  393. if ([[Config getOwnID] intValue] <= 0) {
  394. [PublicObj warnLogin];
  395. return;
  396. }
  397. id musicInfo = [_dataDic valueForKey:@"musicinfo"];
  398. NSString *musicID = [NSString stringWithFormat:@"%@",[musicInfo valueForKey:@"id"]];
  399. if ([musicID isEqual:@"0"] || ![musicInfo isKindOfClass:[NSDictionary class]]) {
  400. [MBProgressHUD showPop:YZMsg(@"该视频不支持拍摄同款")];
  401. return;
  402. }
  403. if ([YBYoungManager shareInstance].youngSwitch == 1) {
  404. [MBProgressHUD showError:YZMsg(@"青少年模式下不支持该功能")];
  405. return;
  406. }
  407. YBTakeSameVideoVC *sameVC = [[YBTakeSameVideoVC alloc]init];
  408. sameVC.musicDic = musicInfo;
  409. [[YBBaseAppDelegate sharedAppDelegate]pushViewController:sameVC animated:YES];
  410. }
  411. #pragma mark - 送礼
  412. -(void)clickGiftBtn {
  413. // if ([[Config getOwnID] intValue]<=0 && [Config getTranslate]) {
  414. // return;
  415. // }
  416. NSLog(@"gift:%@",_dataDic);
  417. if ([[Config getOwnID] intValue] <= 0) {
  418. [PublicObj warnLogin];
  419. return;
  420. }
  421. //礼物打赏
  422. YBWeakSelf;
  423. YBGiftPage *gView = [YBGiftPage showGiftViewComplete:^(int eventCode,NSDictionary *giftDic) {
  424. if (eventCode == -1) {
  425. //关闭
  426. }else {
  427. //发送
  428. if (weakSelf.videoCellEvent) {
  429. weakSelf.videoCellEvent(@"视频-打赏", giftDic);
  430. }
  431. }
  432. }];
  433. gView.receiveID = minstr([_dataDic valueForKey:@"id"]);;
  434. gView.sendType = SendGiftType_Video;
  435. [gView requestGiftData];
  436. }
  437. #pragma mark - 分享
  438. -(void)clickEnjoyBtn {
  439. // if ([[Config getOwnID] intValue]<=0 && [Config getTranslate]) {
  440. // return;
  441. // }
  442. //NSLog(@"enjoy:%@",_dataDic);
  443. YBWeakSelf;
  444. [MBProgressHUD showMessage:@""];
  445. [YBNetworking postWithUrl:@"Video.checkPayVideoIsShare" Dic:@{@"videoid":minstr([_dataDic valueForKey:@"id"])} Suc:^(int code, id info, NSString *msg) {
  446. [MBProgressHUD hideHUD];
  447. if (code == 0) {
  448. if ([info isKindOfClass:[NSArray class]]) {
  449. [weakSelf shareLimit:[info firstObject]];
  450. }else {
  451. [weakSelf shareLimit:info];
  452. }
  453. }else {
  454. [MBProgressHUD showError:msg];
  455. }
  456. } Fail:^(id fail) {
  457. [MBProgressHUD hideHUD];
  458. }];
  459. }
  460. -(void)shareLimit:(NSDictionary *)infoDic {
  461. YBWeakSelf;
  462. YBShareView *shareV = [YBShareView showShareWithType:RKShareType_LookVdieo parameter:_dataDic commplete:^(int codeEvent, NSString *nums) {
  463. if (codeEvent == 0) {
  464. //分享成功
  465. [_enjoyBtn setTitle:minstr(nums) forState:0];
  466. _enjoyBtn = [PublicObj setUpImgDownText:_enjoyBtn];
  467. }else if (codeEvent == 2){
  468. //举报
  469. if ([[Config getOwnID] intValue] <= 0) {
  470. [PublicObj warnLogin];
  471. return;
  472. }
  473. YBVideoReportVC *jubao = [[YBVideoReportVC alloc]init];
  474. jubao.dongtaiId = minstr([_dataDic valueForKey:@"id"]);;
  475. jubao.fromWhere = _fromWhere ? _fromWhere:@"LookVideo";
  476. [[YBBaseAppDelegate sharedAppDelegate]pushViewController:jubao animated:YES];
  477. }else if (codeEvent == 3){
  478. //删除
  479. if (weakSelf.videoCellEvent) {
  480. weakSelf.videoCellEvent(@"视频-删除", @{});
  481. }
  482. }else if (codeEvent == 4){
  483. //合拍
  484. if ([[Config getOwnID] intValue] <= 0) {
  485. [PublicObj warnLogin];
  486. return;
  487. }
  488. if (self.player.totalTime < 5) {
  489. [MBProgressHUD showPop:YZMsg(@"该视频时长太短,无法合拍")];
  490. [[NSFileManager defaultManager] removeItemAtPath:nums error:nil];
  491. return;
  492. }
  493. if ([YBYoungManager shareInstance].youngSwitch == 1) {
  494. [MBProgressHUD showError:YZMsg(@"青少年模式下不支持该功能")];
  495. return;
  496. }
  497. TCVideoRecordViewController *recorddVC = [[TCVideoRecordViewController alloc]init];
  498. recorddVC.mp4Path = nums;
  499. recorddVC.recordType = RecordType_Chorus;
  500. [[YBBaseAppDelegate sharedAppDelegate]pushViewController:recorddVC animated:YES];
  501. }else if (codeEvent == 5){
  502. //上热门
  503. if ([[Config getOwnID] intValue] <= 0) {
  504. [PublicObj warnLogin];
  505. return;
  506. }
  507. if ([YBYoungManager shareInstance].youngSwitch == 1) {
  508. [MBProgressHUD showError:YZMsg(@"青少年模式下不支持该功能")];
  509. return;
  510. }
  511. addHotVideoVC *hot = [[addHotVideoVC alloc]init];
  512. hot.videoInfo = _dataDic;
  513. [[YBBaseAppDelegate sharedAppDelegate]pushViewController:hot animated:YES];
  514. }else if (codeEvent == 7){
  515. // 收藏
  516. if ([[Config getOwnID] intValue] <= 0) {
  517. [PublicObj warnLogin];
  518. return;
  519. }
  520. [weakSelf clickVideoCollectionAni:NO];
  521. }
  522. }];
  523. shareV.limitDic = infoDic;
  524. }
  525. #pragma mark - 收藏
  526. -(void)clickCollectionBtn {
  527. // if ([[Config getOwnID] intValue]<=0 && [Config getTranslate]) {
  528. // return;
  529. // }
  530. [self clickVideoCollectionAni:YES];
  531. }
  532. -(void)clickVideoCollectionAni:(BOOL)animation {
  533. NSString *videoID = minstr([_dataDic valueForKey:@"id"]);
  534. YBWeakSelf;
  535. [YBNetworking postWithUrl:@"video.addCollection" Dic:@{@"videoid":videoID} Suc:^(int code, id info, NSString *msg) {
  536. if (code == 0) {
  537. NSDictionary *infoDic = [info firstObject];
  538. NSString *iscollection = minstr([infoDic valueForKey:@"iscollection"]);
  539. NSString *collections = minstr([infoDic valueForKey:@"collections"]);
  540. NSDictionary *newDic = @{@"iscollection":iscollection,@"collections":collections};
  541. [weakSelf updateDataDic:newDic];
  542. if (weakSelf.videoCellEvent) {
  543. weakSelf.videoCellEvent(@"视频-收藏", newDic);
  544. }
  545. [_collectionBtn setTitle:collections forState:0];
  546. _collectionBtn = [PublicObj setUpImgDownText:_collectionBtn];
  547. _collectionBtn.selected = [iscollection intValue];
  548. if (animation) {
  549. [weakSelf colAnimationWithIsCol:iscollection];
  550. }else{
  551. [MBProgressHUD showError:msg];
  552. }
  553. }else{
  554. [MBProgressHUD showError:msg];
  555. }
  556. } Fail:^(id fail) {
  557. }];
  558. }
  559. //收藏-取消收藏动画
  560. -(void)colAnimationWithIsCol:(NSString *)isCol {
  561. NSMutableArray *m_sel_arr = [NSMutableArray array];
  562. NSString *endImgName = @"";
  563. UIControlState btnState;
  564. if ([isCol isEqual:@"1"]) {
  565. for (int i=1; i<=12; i++) {
  566. UIImage *img = [UIImage imageNamed:[NSString stringWithFormat:@"icon_video_col_%02d",i]];
  567. [m_sel_arr addObject:img];
  568. }
  569. btnState = UIControlStateSelected;
  570. endImgName = @"icon_video_col_12";
  571. }else{
  572. for (int i=1; i<=6; i++) {
  573. UIImage *img = [UIImage imageNamed:[NSString stringWithFormat:@"icon_video_col_cancel_%02d",i]];
  574. [m_sel_arr addObject:img];
  575. }
  576. btnState = UIControlStateNormal;
  577. endImgName = @"icon_video_col_01";
  578. }
  579. CGFloat showTime = 0.05*m_sel_arr.count;
  580. _collectionBtn.imageView.animationImages = m_sel_arr;
  581. _collectionBtn.imageView.animationDuration = showTime;
  582. _collectionBtn.imageView.animationRepeatCount = 1;
  583. [_collectionBtn.imageView startAnimating];
  584. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)((showTime-0.06) * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  585. [_collectionBtn.imageView stopAnimating];
  586. [_collectionBtn setImage:[UIImage imageNamed:endImgName] forState:btnState];
  587. });
  588. }
  589. #pragma mark - 评论
  590. -(void)clickCommentBtn {
  591. // if ([[Config getOwnID] intValue]<=0 && [Config getTranslate]) {
  592. // return;
  593. // }
  594. NSLog(@"comment:%@",_dataDic);
  595. [self removeCommentView];
  596. NSDictionary *userDic = [_dataDic valueForKey:@"userinfo"];
  597. NSString *videoUserID = minstr([userDic valueForKey:@"id"]);
  598. NSString *videoID = minstr([_dataDic valueForKey:@"id"]);
  599. NSString *commentStr = minstr([_dataDic valueForKey:@"comments"]);
  600. YBWeakSelf;
  601. _commentView = [[commentview alloc]initWithFrame:CGRectMake(0,_window_height, _window_width, _window_height) hide:^(NSString *type) {
  602. [UIView animateWithDuration:0.25 animations:^{
  603. _commentView.frame = CGRectMake(0,_window_height, _window_width, _window_height);
  604. } completion:^(BOOL finished) {
  605. [weakSelf removeCommentView];
  606. }];
  607. } andvideoid:videoID andhostid:videoUserID count:[commentStr intValue] talkCount:^(id type) {
  608. [weakSelf updateCommentNums:type];
  609. } detail:^(id type) {
  610. } youke:^(id type) {
  611. [weakSelf comNeedLogin];
  612. } andFrom:_fromWhere];
  613. ZFPlayerPlaybackState playState = self.player.currentPlayerManager.playState;
  614. _commentView.mutedBlock = ^(id type) {
  615. if (weakSelf.videoCellEvent) {
  616. weakSelf.videoCellEvent(@"视频-静音", @{@"mutedType":minstr(type),@"playState":@(playState)});
  617. }
  618. };
  619. _commentView.fromWhere = _fromWhere;
  620. [_commentView getNewCount:[commentStr intValue]];
  621. // _commentView.closeEvent = ^{
  622. // [_commentView.commentTool hiddenEmojiOrKeyBoard];
  623. // [_commentView.commentTool resetToolState];
  624. //
  625. // };
  626. [[UIApplication sharedApplication].delegate.window addSubview:_commentView];
  627. [UIView animateWithDuration:0.25 animations:^{
  628. _commentView.frame = CGRectMake(0,0,_window_width, _window_height);
  629. }];
  630. __weak commentview *weakComment = _commentView;
  631. _commentView.goCenterEvent = ^(BOOL isGo) {
  632. weakComment.hidden = isGo;
  633. };
  634. }
  635. -(void)removeCommentView {
  636. if (_commentView) {
  637. [_commentView removeFromSuperview];
  638. _commentView = nil;
  639. }
  640. }
  641. -(void)comNeedLogin {
  642. [self removeCommentView];
  643. [PublicObj warnLogin];
  644. }
  645. -(void)updateCommentNums:(NSString *)nums {
  646. NSDictionary *newDic = @{@"comments":nums};
  647. [self updateDataDic:newDic];
  648. if (self.videoCellEvent) {
  649. self.videoCellEvent(@"视频-评论", newDic);
  650. }
  651. [_commentBtn setTitle:minstr(nums) forState:0];
  652. _commentBtn = [PublicObj setUpImgDownText:_commentBtn];
  653. }
  654. #pragma mark - 点赞
  655. -(void)clickLikeBtn {
  656. // if ([[Config getOwnID] intValue]<=0 && [Config getTranslate]) {
  657. // return;
  658. // }
  659. NSLog(@"like:%@",_dataDic);
  660. if ([[Config getOwnID] intValue] <= 0) {
  661. [PublicObj warnLogin];
  662. return;
  663. }
  664. //[MBProgressHUD showMessage:@""];
  665. _likebtn.userInteractionEnabled = NO;
  666. YBWeakSelf;
  667. [YBNetworking postWithUrl:@"Video.addLike" Dic:@{@"videoid":minstr([_dataDic valueForKey:@"id"])} Suc:^(int code, id info, NSString *msg) {
  668. //[MBProgressHUD hideHUD];
  669. _likebtn.userInteractionEnabled = YES;
  670. if(code == 0) {
  671. NSDictionary *infoDic = [info firstObject];
  672. NSString *isLike = minstr([infoDic valueForKey:@"islike"]);
  673. NSString *likes = minstr([infoDic valueForKey:@"likes"]);
  674. NSDictionary *newDic = @{@"islike":isLike,@"likes":likes};
  675. [weakSelf updateDataDic:newDic];
  676. if (weakSelf.videoCellEvent) {
  677. weakSelf.videoCellEvent(@"视频-点赞", newDic);
  678. }
  679. [_likebtn setTitle:likes forState:0];
  680. _likebtn = [PublicObj setUpImgDownText:_likebtn];
  681. [weakSelf likeAnimationShowIsLike:isLike];
  682. }else{
  683. [MBProgressHUD showPop:msg];
  684. }
  685. } Fail:^(id fail) {
  686. //[MBProgressHUD hideHUD];
  687. _likebtn.userInteractionEnabled = YES;
  688. }];
  689. }
  690. //点赞-取消赞动画
  691. -(void)likeAnimationShowIsLike:(NSString *)isLike {
  692. NSMutableArray *m_sel_arr = [NSMutableArray array];
  693. NSString *endImgName = @"";
  694. if ([isLike isEqual:@"1"]) {
  695. for (int i=1; i<=12; i++) {
  696. UIImage *img = [UIImage imageNamed:[NSString stringWithFormat:@"icon_video_zan_%02d",i]];
  697. [m_sel_arr addObject:img];
  698. }
  699. endImgName = @"icon_video_zan_12";
  700. }else{
  701. for (int i=1; i<=6; i++) {
  702. UIImage *img = [UIImage imageNamed:[NSString stringWithFormat:@"icon_video_zan_cancel_%02d",i]];
  703. [m_sel_arr addObject:img];
  704. }
  705. endImgName = @"icon_video_zan_01";
  706. }
  707. CGFloat showTime = 0.05*m_sel_arr.count;
  708. _likebtn.imageView.animationImages = m_sel_arr;
  709. _likebtn.imageView.animationDuration = showTime;
  710. _likebtn.imageView.animationRepeatCount = 1;
  711. [_likebtn.imageView startAnimating];
  712. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)((showTime-0.06) * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  713. [_likebtn.imageView stopAnimating];
  714. [_likebtn setImage:[UIImage imageNamed:endImgName] forState:0];
  715. });
  716. }
  717. #pragma mark - 进入主页
  718. -(void)swipGesGoHome;{
  719. //侧滑无论是否直播都进个人主页【11月】
  720. [self goHomeOrRoom:NO];
  721. }
  722. -(void)clickIconBtn {
  723. NSLog(@"icon:%@",_dataDic);
  724. // if ([[Config getOwnID] intValue]<=0) {
  725. // [PublicObj warnLogin];
  726. // return;
  727. // }
  728. //点头像区分是否在直播中【11月】
  729. [self goHomeOrRoom:YES];
  730. }
  731. -(void)goHomeOrRoom:(BOOL)judgeLiving {
  732. // if ([[Config getOwnID] intValue]<=0 && [Config getTranslate]) {
  733. // return;
  734. // }
  735. NSDictionary *userDic = [_dataDic valueForKey:@"userinfo"];
  736. NSString *videoUserID = minstr([userDic valueForKey:@"id"]);
  737. NSDictionary *liveInfo = [_dataDic valueForKey:@"liveinfo"];
  738. if ([[liveInfo valueForKey:@"islive"] isEqual:@"1"] && judgeLiving) {
  739. [YBCheckLiveObj checkLiveManeger].liveUid = minstr([liveInfo valueForKey:@"uid"]);
  740. [YBCheckLiveObj checkLiveManeger].liveStream = minstr([liveInfo valueForKey:@"stream"]);
  741. [YBCheckLiveObj checkLiveManeger].currentIndex = 0;
  742. [YBCheckLiveObj checkLiveManeger].listArray = nil;
  743. [[YBCheckLiveObj checkLiveManeger] checkLiving];
  744. return;
  745. }
  746. YBWeakSelf;
  747. YBCenterVC *center = [[YBCenterVC alloc]init];
  748. center.otherUid =videoUserID;
  749. center.isPush = YES;
  750. center.followEvent = ^(NSString *isAttent) {
  751. NSDictionary *newDic = @{@"isattent":isAttent};
  752. [weakSelf updateDataDic:newDic];
  753. if ([isAttent isEqual:@"1"]) {
  754. _followBtn.hidden = YES;
  755. }else{
  756. [_followBtn setImage:[UIImage imageNamed:@"home_follow"] forState:0];
  757. _followBtn.hidden = NO;
  758. }
  759. };
  760. [[YBBaseAppDelegate sharedAppDelegate] pushViewController:center animated:YES];
  761. }
  762. #pragma mark - 关注
  763. -(void)clickFollowBtn {
  764. // if ([[Config getOwnID] intValue]<=0 && [Config getTranslate]) {
  765. // return;
  766. // }
  767. NSLog(@"follow:%@",_dataDic);
  768. if ([[Config getOwnID] intValue]<=0) {
  769. [PublicObj warnLogin];
  770. return;
  771. }
  772. [MBProgressHUD showMessage:@""];
  773. NSDictionary *userDic = [_dataDic valueForKey:@"userinfo"];
  774. NSString *videoUserID = minstr([userDic valueForKey:@"id"]);
  775. YBWeakSelf;
  776. [YBNetworking postWithUrl:@"User.setAttent" Dic:@{@"touid":videoUserID} Suc:^(int code, id info, NSString *msg) {
  777. [MBProgressHUD hideHUD];
  778. if(code == 0) {
  779. NSDictionary *newDic = @{@"isattent":@"1"};
  780. [weakSelf updateDataDic:newDic];
  781. if (weakSelf.videoCellEvent) {
  782. weakSelf.videoCellEvent(@"视频-关注", newDic);
  783. }
  784. [_followBtn setImage:[UIImage imageNamed:@"home_follow_sel"] forState:0];
  785. dispatch_async(dispatch_get_main_queue(), ^{
  786. [_followBtn.imageView.layer addAnimation:[PublicObj smallToBigToSmall] forKey:nil];
  787. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.9 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  788. _followBtn.hidden = YES;
  789. });
  790. });
  791. }else{
  792. [MBProgressHUD showError:msg];
  793. }
  794. } Fail:^(id fail) {
  795. [MBProgressHUD hideHUD];
  796. }];
  797. }
  798. #pragma mark - 广告
  799. -(void)clickAdButton {
  800. // if ([[Config getOwnID] intValue]<=0 && [Config getTranslate]) {
  801. // return;
  802. // }
  803. if ([minstr([_dataDic valueForKey:@"isgoods"]) isEqual:@"1"]) {
  804. if ([YBYoungManager shareInstance].youngSwitch == 1) {
  805. [MBProgressHUD showError:YZMsg(@"青少年模式下不支持该功能")];
  806. return;
  807. }
  808. [self showGoodsDeatile];
  809. }else{
  810. NSString *is_ad_str = minstr([_dataDic valueForKey:@"is_ad"]);
  811. NSString *ad_url_str = minstr([_dataDic valueForKey:@"ad_url"]);
  812. if ([is_ad_str isEqual:@"1"]) {
  813. if ([PublicObj checkNull:ad_url_str]) {
  814. [MBProgressHUD showError:YZMsg(@"视频即详情")];
  815. return;
  816. }
  817. [[UIApplication sharedApplication]openURL:[NSURL URLWithString:ad_url_str] options:@{} completionHandler:^(BOOL success) {
  818. }];
  819. }
  820. NSString *is_userad = minstr([_dataDic valueForKey:@"is_userad"]);//是否是用户广告视频0否1是
  821. NSString *userad_url = minstr([_dataDic valueForKey:@"userad_url"]);
  822. if ([is_userad isEqual:@"1"]) {
  823. if ([PublicObj checkNull:userad_url]) {
  824. [MBProgressHUD showError:YZMsg(@"视频即详情")];
  825. return;
  826. }
  827. [[UIApplication sharedApplication]openURL:[NSURL URLWithString:userad_url] options:@{} completionHandler:^(BOOL success) {
  828. }];
  829. }
  830. }
  831. }
  832. #pragma mark - 商品
  833. - (void)showGoodsDeatile{
  834. // if ([[Config getOwnID] intValue]<=0 && [Config getTranslate]) {
  835. // return;
  836. // }
  837. if (goodsDView) {
  838. [goodsDView removeFromSuperview];
  839. goodsDView = nil;
  840. }
  841. NSDictionary *dic = @{@"uid":[Config getOwnID],@"token":[Config getOwnToken],@"goodsid":minstr([_dataDic valueForKey:@"goodsid"])};
  842. [YBNetworking postWithUrl:@"Shop.getVideoBindGoodsInfo" Dic:dic Suc:^(int code, id info, NSString *msg) {
  843. if (code == 0) {
  844. NSDictionary *infos = info;
  845. NSDictionary *userDic = [_dataDic valueForKey:@"userinfo"];
  846. NSString *videoUserID = minstr([userDic valueForKey:@"id"]);
  847. goodsDView = [[lookVGoodsDView alloc]initWithGoodsMsg:infos];//[_dataDic valueForKey:@"goodsinfo"]];
  848. goodsDView.videoid = minstr([_dataDic valueForKey:@"id"]);
  849. goodsDView.goodsID = minstr([infos valueForKey:@"id"]);
  850. goodsDView.videoUid = videoUserID;
  851. [[UIApplication sharedApplication].delegate.window addSubview:goodsDView];
  852. }
  853. } Fail:^(id fail) {
  854. }];
  855. }
  856. #pragma mark - 标签
  857. -(void)clickTopicBtn {
  858. // if ([[Config getOwnID] intValue]<=0 && [Config getTranslate]) {
  859. // return;
  860. // }
  861. topicDetailsVC *topic = [[topicDetailsVC alloc]init];
  862. topic.labelID = minstr([_dataDic valueForKey:@"labelid"]);
  863. [[YBBaseAppDelegate sharedAppDelegate]pushViewController:topic animated:YES];
  864. }
  865. #pragma mark - 部分控件的显示隐藏
  866. //20
  867. -(void)topicBtnLayoutOfHeight:(CGFloat)height {
  868. NSString *is_ad_str = minstr([_dataDic valueForKey:@"is_ad"]);
  869. NSString *is_userad = minstr([_dataDic valueForKey:@"is_userad"]);//是否是用户广告视频0否1是
  870. if ([is_ad_str isEqual:@"1"] || [is_userad isEqual:@"1"]) {
  871. [_topicBtn mas_remakeConstraints:^(MASConstraintMaker *make) {
  872. make.left.equalTo(_botView.mas_left).offset(3);
  873. make.bottom.equalTo(_adLabel.mas_top).offset(-2);
  874. make.height.mas_equalTo(height);
  875. make.top.equalTo(_botView.mas_top);
  876. }];
  877. }else{
  878. [_topicBtn mas_remakeConstraints:^(MASConstraintMaker *make) {
  879. make.left.equalTo(_botView.mas_left).offset(3);
  880. make.bottom.equalTo(_nameL.mas_top).offset(-2);
  881. make.height.mas_equalTo(height);
  882. make.top.equalTo(_botView.mas_top);
  883. }];
  884. }
  885. BOOL isBoldText = [PublicObj isBlodText];
  886. if (isBoldText) {
  887. [_botView layoutIfNeeded];
  888. CGFloat www = _topicBtn.width;
  889. [_topicBtn mas_updateConstraints:^(MASConstraintMaker *make) {
  890. make.width.mas_equalTo(www*1.1);
  891. }];
  892. }
  893. }
  894. //20
  895. -(void)adLabelLayoutOfHeight:(CGFloat)height {
  896. [_adLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
  897. make.width.mas_equalTo(45);
  898. make.height.mas_equalTo(height);
  899. make.left.equalTo(_botView.mas_left).offset(3);
  900. // make.bottom.equalTo(_topicBtn.mas_top).offset(-2);
  901. make.bottom.equalTo(_nameL.mas_top).offset(-2);
  902. }];
  903. }
  904. //30
  905. -(void)adButtonLayoutOfHeight:(CGFloat)height {
  906. [_adButton mas_remakeConstraints:^(MASConstraintMaker *make) {
  907. make.left.equalTo(_botView.mas_left).offset(5);
  908. make.height.mas_equalTo(height);
  909. make.width.equalTo(_botView.mas_width).multipliedBy(0.7);
  910. make.bottom.equalTo(_botView.mas_bottom).offset(-0);
  911. }];
  912. }
  913. #pragma mark - set/get
  914. - (UIView *)rightView{
  915. if (!_rightView) {
  916. _rightView = [[UIView alloc]init];
  917. _rightView.backgroundColor = [UIColor clearColor];
  918. //音乐背景+歌曲(作者头像)-->整个动画背景
  919. UIView *animationBgView = [[UIView alloc]init];
  920. animationBgView.backgroundColor = [UIColor clearColor];
  921. [_rightView addSubview:animationBgView];
  922. [animationBgView mas_makeConstraints:^(MASConstraintMaker *make) {
  923. make.width.equalTo(@75);
  924. make.height.equalTo(@50);
  925. make.left.equalTo(_rightView);
  926. make.bottom.equalTo(_rightView).offset(-10);
  927. }];
  928. //唱片图片
  929. _discIV = [[UIImageView alloc]init];
  930. [_discIV setImage:[UIImage imageNamed:@"music_disc"]];
  931. [animationBgView addSubview:_discIV];
  932. [_discIV mas_makeConstraints:^(MASConstraintMaker *make) {
  933. make.left.equalTo(@25);
  934. make.top.equalTo(animationBgView);
  935. make.width.height.equalTo(@50);
  936. }];
  937. //音乐图片(或者作者头像)
  938. _musicIV = [[UIImageView alloc]init];
  939. CGFloat l_s = (50-20*50/33)/2;
  940. _musicIV.layer.masksToBounds = YES;
  941. _musicIV.layer.cornerRadius = 20*50/33/2;
  942. [_discIV addSubview:_musicIV];
  943. [_musicIV mas_makeConstraints:^(MASConstraintMaker *make) {
  944. make.left.equalTo(@(l_s));
  945. make.top.equalTo(@(l_s));
  946. make.width.height.equalTo(@(20*50/33));
  947. }];
  948. //音符A+B
  949. _symbolAIV = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"music_symbolA"]];
  950. _symbolAIV.frame = CGRectMake(0, _discIV.top, 12, 12);
  951. [animationBgView addSubview:_symbolAIV];
  952. _symbolAIV.hidden = YES;
  953. _symbolBIV = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"music_symbolB"]];
  954. _symbolBIV.frame = CGRectMake(0, _discIV.top, 12, 12);
  955. _symbolBIV.hidden = YES;
  956. [animationBgView addSubview:_symbolBIV];
  957. _discIV.userInteractionEnabled = YES;
  958. _musicIV.userInteractionEnabled = YES;
  959. UITapGestureRecognizer *discTap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(clickMusicTap)];
  960. [_discIV addGestureRecognizer:discTap];
  961. UITapGestureRecognizer *musicTap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(clickMusicTap)];
  962. [_musicIV addGestureRecognizer:musicTap];
  963. //送礼
  964. _giftBtn = [UIButton buttonWithType:0];
  965. _giftBtn.backgroundColor = [UIColor clearColor];
  966. [_giftBtn setImage:[UIImage imageNamed:@"首页-礼物"] forState:0];
  967. [_giftBtn addTarget:self action:@selector(clickGiftBtn) forControlEvents:UIControlEventTouchUpInside];
  968. _giftBtn.titleLabel.font = [UIFont systemFontOfSize:13];
  969. _giftBtn = [PublicObj setUpImgDownText:_giftBtn];
  970. [_rightView addSubview:_giftBtn];
  971. [_giftBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  972. make.centerX.equalTo(_discIV);
  973. make.bottom.equalTo(animationBgView.mas_top).offset(-15);
  974. make.width.equalTo(@80);
  975. make.height.equalTo(@60);
  976. }];
  977. // 收藏
  978. _collectionBtn = [UIButton buttonWithType:0];
  979. _collectionBtn.backgroundColor = [UIColor clearColor];
  980. [_collectionBtn setImage:[UIImage imageNamed:@"home_col"] forState:0];
  981. [_collectionBtn setImage:[UIImage imageNamed:@"home_col_sel"] forState:UIControlStateSelected];
  982. [_collectionBtn addTarget:self action:@selector(clickCollectionBtn) forControlEvents:UIControlEventTouchUpInside];
  983. _collectionBtn.titleLabel.font = [UIFont systemFontOfSize:13];
  984. _collectionBtn = [PublicObj setUpImgDownText:_collectionBtn];
  985. [_rightView addSubview:_collectionBtn];
  986. [_collectionBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  987. make.centerX.centerY.width.height.equalTo(_giftBtn);
  988. }];
  989. //分享
  990. _enjoyBtn = [UIButton buttonWithType:0];
  991. _enjoyBtn.backgroundColor = [UIColor clearColor];
  992. [_enjoyBtn setImage:[UIImage imageNamed:@"home_share"] forState:0];
  993. [_enjoyBtn addTarget:self action:@selector(clickEnjoyBtn) forControlEvents:UIControlEventTouchUpInside];
  994. _enjoyBtn.titleLabel.font = [UIFont systemFontOfSize:13];
  995. _enjoyBtn = [PublicObj setUpImgDownText:_enjoyBtn];
  996. [_rightView addSubview:_enjoyBtn];
  997. [_enjoyBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  998. make.centerX.equalTo(_discIV);
  999. make.bottom.equalTo(_giftBtn.mas_top).offset(-3);
  1000. make.width.equalTo(@80);
  1001. make.height.equalTo(@60);
  1002. }];
  1003. //评论列表
  1004. _commentBtn = [UIButton buttonWithType:0];
  1005. _commentBtn.backgroundColor = _enjoyBtn.backgroundColor;
  1006. [_commentBtn setImage:[UIImage imageNamed:@"home_comment"] forState:0];
  1007. [_commentBtn addTarget:self action:@selector(clickCommentBtn) forControlEvents:UIControlEventTouchUpInside];
  1008. _commentBtn.titleLabel.font = [UIFont systemFontOfSize:13];
  1009. _commentBtn = [PublicObj setUpImgDownText:_commentBtn];
  1010. [_rightView addSubview:_commentBtn];
  1011. [_commentBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  1012. make.centerX.equalTo(_enjoyBtn);
  1013. make.width.height.equalTo(_enjoyBtn);
  1014. make.bottom.equalTo(_enjoyBtn.mas_top).offset(-8);
  1015. }];
  1016. //点赞
  1017. _likebtn = [UIButton buttonWithType:0];
  1018. _likebtn.backgroundColor = _enjoyBtn.backgroundColor;
  1019. [_likebtn addTarget:self action:@selector(clickLikeBtn) forControlEvents:UIControlEventTouchUpInside];
  1020. [_likebtn setImage:[UIImage imageNamed:@"home_zan"] forState:0];
  1021. _likebtn.titleLabel.font = [UIFont systemFontOfSize:13];
  1022. _likebtn = [PublicObj setUpImgDownText:_likebtn];
  1023. [_rightView addSubview:_likebtn];
  1024. [_likebtn mas_makeConstraints:^(MASConstraintMaker *make) {
  1025. make.centerX.equalTo(_enjoyBtn);
  1026. make.width.height.equalTo(_enjoyBtn);
  1027. make.bottom.equalTo(_commentBtn.mas_top).offset(-8);
  1028. }];
  1029. //直播中动画外边缘
  1030. _liveingV = [[UIView alloc]init];
  1031. _liveingV.layer.borderColor = RGB_COLOR(@"#EA377F", 0.5).CGColor;
  1032. _liveingV.layer.borderWidth = 0.8;
  1033. _liveingV.cornerRadius = 25;
  1034. [_rightView addSubview:_liveingV];
  1035. //主播头像
  1036. _iconBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  1037. _iconBtn.layer.masksToBounds = YES;
  1038. _iconBtn.layer.cornerRadius = 25;
  1039. _iconBtn.layer.borderWidth = 1.5;
  1040. _iconBtn.layer.borderColor = Pink_Cor.CGColor;
  1041. _iconBtn.imageView.contentMode = UIViewContentModeScaleAspectFill;
  1042. _iconBtn.imageView.clipsToBounds = YES;
  1043. _iconBtn.imageView.layer.masksToBounds = YES;
  1044. _iconBtn.imageView.layer.cornerRadius = 25;
  1045. [_iconBtn addTarget:self action:@selector(clickIconBtn) forControlEvents:UIControlEventTouchUpInside];
  1046. [_iconBtn sd_setImageWithURL:[NSURL URLWithString:@""] forState:0 placeholderImage:[PublicObj getAppIcon]];
  1047. [_rightView addSubview:_iconBtn];
  1048. [_iconBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  1049. make.centerX.equalTo(_enjoyBtn);
  1050. make.width.height.equalTo(@50);
  1051. make.bottom.equalTo(_likebtn.mas_top).offset(-20);
  1052. }];
  1053. _liveingV.userInteractionEnabled = NO;
  1054. [_liveingV mas_makeConstraints:^(MASConstraintMaker *make) {
  1055. make.width.height.centerX.centerY.equalTo(_iconBtn);
  1056. }];
  1057. _liveingL = [[UILabel alloc]init];
  1058. _liveingL.text = YZMsg(@"直播");
  1059. _liveingL.textAlignment = NSTextAlignmentCenter;
  1060. _liveingL.textColor = UIColor.whiteColor;
  1061. _liveingL.backgroundColor = Pink_Cor;
  1062. _liveingL.font = SYS_Font(10);
  1063. _liveingL.layer.cornerRadius = 16;
  1064. _liveingL.layer.masksToBounds = YES;
  1065. _liveingL.userInteractionEnabled = YES;
  1066. [_iconBtn.imageView addSubview:_liveingL];
  1067. [_liveingL mas_makeConstraints:^(MASConstraintMaker *make) {
  1068. make.centerX.top.equalTo(_iconBtn.imageView);
  1069. make.width.equalTo(_iconBtn.imageView.mas_width).multipliedBy(0.85);
  1070. make.height.mas_equalTo(16);
  1071. }];
  1072. _liveingL.hidden = _liveingV.hidden = YES;;
  1073. //关注按钮
  1074. _followBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  1075. [_followBtn setImage:[UIImage imageNamed:@"home_follow"] forState:0];
  1076. [_followBtn addTarget:self action:@selector(clickFollowBtn) forControlEvents:UIControlEventTouchUpInside];
  1077. [_rightView addSubview:_followBtn];
  1078. [_followBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  1079. make.centerX.equalTo(_iconBtn);
  1080. make.width.height.equalTo(@26);
  1081. make.centerY.equalTo(_iconBtn.mas_bottom).offset(0);
  1082. }];
  1083. }
  1084. return _rightView;
  1085. }
  1086. - (UIView *)botView {
  1087. if (!_botView) {
  1088. _botView = [[UIView alloc]init];
  1089. _botView.backgroundColor = [UIColor clearColor];
  1090. //布局顺序从下向上(视频标题最多三行,可没有)
  1091. _adButton = [UIButton buttonWithType:0];
  1092. _adButton.titleLabel.font = [UIFont systemFontOfSize:10];
  1093. _adButton.layer.cornerRadius = 3;
  1094. _adButton.layer.masksToBounds = YES;
  1095. [_adButton addTarget:self action:@selector(clickAdButton) forControlEvents:UIControlEventTouchUpInside];
  1096. [_botView addSubview:_adButton];
  1097. _adButton.hidden = YES;
  1098. [_adButton mas_makeConstraints:^(MASConstraintMaker *make) {
  1099. make.left.equalTo(_botView.mas_left).offset(5);
  1100. make.height.mas_equalTo(30);
  1101. make.width.equalTo(_botView.mas_width).multipliedBy(0.7);
  1102. make.bottom.equalTo(_botView.mas_bottom).offset(-0);//-10
  1103. }];
  1104. //音乐
  1105. UIImageView *symIV = [[UIImageView alloc]init];
  1106. symIV.image = [UIImage imageNamed:@"music_symbolB"];
  1107. [_botView addSubview:symIV];
  1108. // _symIV = symIV;
  1109. [symIV mas_makeConstraints:^(MASConstraintMaker *make) {
  1110. make.width.height.mas_equalTo(20);
  1111. make.left.equalTo(_botView);
  1112. make.bottom.equalTo(_adButton.mas_top).offset(-5);
  1113. }];
  1114. _musicL = [[RKLampView alloc]init];
  1115. _musicL.contentStr = @"这是一首好听的音乐";
  1116. [_botView addSubview:_musicL];
  1117. [_musicL mas_makeConstraints:^(MASConstraintMaker *make) {
  1118. make.width.equalTo(_botView.mas_width).multipliedBy(0.5);
  1119. make.left.equalTo(symIV.mas_right).offset(2);
  1120. make.centerY.height.equalTo(symIV);
  1121. }];
  1122. //视频标题
  1123. _titleL = [[YYLabel alloc]init];
  1124. _titleL.textAlignment = NSTextAlignmentLeft;
  1125. _titleL.textColor = [UIColor whiteColor];
  1126. _titleL.backgroundColor = [UIColor clearColor];
  1127. _titleL.shadowOffset = CGSizeMake(1,1);//设置阴影
  1128. _titleL.numberOfLines = 0; // 3
  1129. _titleL.font = SYS_Font(15);
  1130. _titleL.preferredMaxLayoutWidth = _window_width-85-20;
  1131. //_titleL.userInteractionEnabled = YES;
  1132. [_botView addSubview:_titleL];
  1133. [_titleL mas_makeConstraints:^(MASConstraintMaker *make) {
  1134. make.left.equalTo(_botView.mas_left);
  1135. make.bottom.equalTo(_musicL.mas_top).offset(-2);
  1136. make.height.mas_greaterThanOrEqualTo(20);
  1137. make.right.mas_lessThanOrEqualTo(_botView.mas_right).offset(0);
  1138. }];
  1139. //视频作者名称
  1140. _nameL = [[UILabel alloc]init];
  1141. _nameL.textAlignment = NSTextAlignmentLeft;
  1142. _nameL.textColor = [UIColor whiteColor];
  1143. _nameL.shadowOffset = CGSizeMake(1,1);//设置阴影
  1144. _nameL.font = SYS_Font(20);
  1145. _nameL.userInteractionEnabled = YES;
  1146. [_botView addSubview:_nameL];
  1147. [_nameL mas_makeConstraints:^(MASConstraintMaker *make) {
  1148. make.left.equalTo(_botView);
  1149. make.bottom.equalTo(_titleL.mas_top).offset(-2);
  1150. make.right.lessThanOrEqualTo(_botView.mas_right).offset(-5);
  1151. }];
  1152. UITapGestureRecognizer *nametap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(clickIconBtn)];
  1153. //nametap.numberOfTouchesRequired = 1;
  1154. [_nameL addGestureRecognizer:nametap];
  1155. //广告
  1156. _adLabel = [[UILabel alloc]init];
  1157. _adLabel.text = YZMsg(@"广告");
  1158. _adLabel.textAlignment = NSTextAlignmentCenter;
  1159. _adLabel.textColor = [UIColor whiteColor];
  1160. _adLabel.backgroundColor = RGB_COLOR(@"#000000", 0.3);
  1161. _adLabel.font = SYS_Font(15);
  1162. _adLabel.layer.cornerRadius = 2;
  1163. _adLabel.layer.masksToBounds = YES;
  1164. [_botView addSubview:_adLabel];
  1165. _adLabel.hidden = YES;
  1166. [_adLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  1167. make.width.mas_equalTo(45);
  1168. make.height.mas_equalTo(0);
  1169. make.left.equalTo(_botView.mas_left).offset(3);
  1170. // make.top.equalTo(_topicBtn.mas_bottom).offset(3);
  1171. make.bottom.equalTo(_nameL.mas_top).offset(-2);
  1172. }];
  1173. //标签
  1174. _topicBtn = [UIButton buttonWithType:0];
  1175. [_topicBtn addTarget:self action:@selector(clickTopicBtn) forControlEvents:UIControlEventTouchUpInside];
  1176. _topicBtn.titleLabel.font = [UIFont systemFontOfSize:12];
  1177. _topicBtn.layer.cornerRadius = 3;
  1178. _topicBtn.layer.masksToBounds = YES;
  1179. _topicBtn.backgroundColor = RGB_COLOR(@"#000000", 0.3);
  1180. [_topicBtn setImage:[UIImage imageNamed:@"video_topic"] forState:0];;
  1181. [_botView addSubview:_topicBtn];
  1182. _topicBtn.hidden = YES;
  1183. [_topicBtn setContentEdgeInsets:UIEdgeInsetsMake(5, 6, 5, 6)];
  1184. [_topicBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  1185. make.left.equalTo(_botView.mas_left).offset(3);
  1186. // make.bottom.equalTo(_nameL.mas_top).offset(-2);
  1187. make.bottom.equalTo(_adLabel.mas_top).offset(-2);
  1188. make.height.mas_equalTo(20);
  1189. make.top.equalTo(_botView.mas_top);
  1190. }];
  1191. }
  1192. return _botView;
  1193. }
  1194. - (UIImageView *)coverImageView {
  1195. if (!_coverImageView) {
  1196. _coverImageView = [[UIImageView alloc] init];
  1197. _coverImageView.userInteractionEnabled = YES;
  1198. _coverImageView.tag = 191107;
  1199. }
  1200. return _coverImageView;
  1201. }
  1202. - (UIImageView *)bgImgView {
  1203. if (!_bgImgView) {
  1204. _bgImgView = [[UIImageView alloc] init];
  1205. _bgImgView.userInteractionEnabled = YES;
  1206. }
  1207. return _bgImgView;
  1208. }
  1209. - (UIView *)effectView {
  1210. if (!_effectView) {
  1211. if (@available(iOS 8.0, *)) {
  1212. UIBlurEffect *effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
  1213. _effectView = [[UIVisualEffectView alloc] initWithEffect:effect];
  1214. } else {
  1215. UIToolbar *effectView = [[UIToolbar alloc] init];
  1216. effectView.barStyle = UIBarStyleBlackTranslucent;
  1217. _effectView = effectView;
  1218. }
  1219. }
  1220. return _effectView;
  1221. }
  1222. ///点赞、评论、关注后这里也更新一下
  1223. -(void)updateDataDic:(NSDictionary *)dic {
  1224. NSMutableDictionary *m_dic = [NSMutableDictionary dictionaryWithDictionary:_dataDic];
  1225. [m_dic addEntriesFromDictionary:dic];
  1226. _dataDic = [NSDictionary dictionaryWithDictionary:m_dic];
  1227. if (![PublicObj checkNull:_fromWhere]) {
  1228. [[NSUserDefaults standardUserDefaults]setObject:_dataDic forKey:@"yb_update_video_on_other"];
  1229. }
  1230. }
  1231. -(void)noticeUpdateUI:(NSDictionary *)updateDic; {
  1232. self.dataDic = updateDic;
  1233. [[NSUserDefaults standardUserDefaults]removeObjectForKey:@"yb_update_video_on_other"];
  1234. }
  1235. #pragma mark - 全屏按钮
  1236. - (UIButton *)ttFullBtn {
  1237. if (!_ttFullBtn) {
  1238. _ttFullBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  1239. [_ttFullBtn setTitle:YZMsg(@"全屏观看") forState:0];
  1240. [_ttFullBtn setImage:[UIImage imageNamed:@"tt_全屏"] forState:0];
  1241. [_ttFullBtn addTarget:self action:@selector(clickTtFullBtn) forControlEvents:UIControlEventTouchUpInside];
  1242. _ttFullBtn.contentEdgeInsets = UIEdgeInsetsMake(0, 15, 0, 10);
  1243. _ttFullBtn.imageEdgeInsets = UIEdgeInsetsMake(0, -5, 0, 5);
  1244. _ttFullBtn.layer.cornerRadius = 13;
  1245. _ttFullBtn.layer.masksToBounds = YES;
  1246. _ttFullBtn.backgroundColor = RGB_COLOR(@"#2a2a2a", 1);
  1247. _ttFullBtn.layer.borderColor = RGB_COLOR(@"#4c4c4c", 1).CGColor;
  1248. _ttFullBtn.layer.borderWidth = 1;
  1249. _ttFullBtn.titleLabel.font = SYS_Font(13);
  1250. }
  1251. return _ttFullBtn;
  1252. }
  1253. -(void)clickTtFullBtn {
  1254. [self endEditing:YES];
  1255. BOOL cuurentIsFull = [self.player isFullScreen];
  1256. [self.player enterFullScreen:!cuurentIsFull animated:YES];
  1257. }
  1258. @end