YOUPAILCDynamicContentView.m 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  1. //
  2. // YOUPAILCDynamicContentView.m
  3. // LiveChat
  4. //
  5. // Created by 张灿 on 2018/9/7.
  6. // Copyright © 2018年 caicai. All rights reserved.
  7. //
  8. #import "YOUPAILCDynamicContentView.h"
  9. #import "YOUPAILCDynamicCell.h"
  10. #import "YBIBVideoData.h"
  11. #import <AVKit/AVKit.h>
  12. #define MarginPadding (15.0f)
  13. #define IsiPhoneXr ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(828, 1792), [[UIScreen mainScreen] currentMode].size) : NO)
  14. @interface YOUPAILCDynamicContentView()
  15. @property(nonatomic,strong)UITextView* youpaipcontTextV;
  16. @property(nonatomic,assign)CGFloat youpaiptxtH;
  17. @end
  18. @implementation YOUPAILCDynamicContentView
  19. - (instancetype)initWithModel:(YOUPAILCDynamicModel*)model{
  20. if (self = [super init]) {
  21. self.userInteractionEnabled = YES;
  22. self.youpaipdyModel = model;
  23. [self youpaifsetupView];
  24. }
  25. return self;
  26. }
  27. - (instancetype)initWithFrame:(CGRect)frame model:(YOUPAILCDynamicModel*)model{
  28. if (self = [super initWithFrame:frame]) {
  29. self.youpaipdyModel = model;
  30. [self youpaifsetupView];
  31. }
  32. return self;
  33. }
  34. - (void)youpaifsetupView{
  35. UITextView* contTextView = [[UITextView alloc]initWithFrame:CGRectMake(MarginPadding, 0, KScreenWidth- MarginPadding - 14.0f,120)];
  36. //适配暗黑模式 v1.5.6
  37. [contTextView setBackgroundColor:[UIColor clearColor]];
  38. contTextView.scrollEnabled = NO;
  39. NSInteger textFont;
  40. if (IsiPhoneXr) {
  41. textFont = 15;
  42. }else{
  43. textFont = 14;
  44. }
  45. // contTextView.backgroundColor = [UIColor redColor];
  46. // contTextView.userInteractionEnabled = YES;
  47. // contTextView.numberOfLines = 0;
  48. // contTextView.lineBreakMode = NSLineBreakByWordWrapping;
  49. contTextView.textColor = LZ273145Color;
  50. contTextView.font = [UIFont systemFontOfSize:14];
  51. contTextView.text = nil;
  52. contTextView.text = self.youpaipdyModel.youpaipcontent;
  53. contTextView.editable = NO;
  54. // contTextView.layer.masksToBounds = YES;
  55. self.youpaipcontTextV = contTextView;
  56. [self addSubview:contTextView];
  57. CGSize constraint = CGSizeMake(contTextView.contentSize.width, CGFLOAT_MAX);
  58. // CGSize size = [self.dyModel.content sizeWithFont:[UIFont systemFontOfSize:17] constrainedToSize:constraint lineBreakMode:NSLineBreakByWordWrapping];
  59. CGRect rect = [self.youpaipdyModel.youpaipcontent boundingRectWithSize:constraint
  60. options:(NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading)
  61. attributes:@{NSFontAttributeName: [UIFont systemFontOfSize:textFont],
  62. NSForegroundColorAttributeName : LCTextBlack
  63. }
  64. context:nil];
  65. CGFloat textH = rect.size.height + 18.0;
  66. self.youpaiptxtH = textH;
  67. if (textH<=120) {
  68. contTextView.frame = CGRectMake(MarginPadding, 0, KScreenWidth- MarginPadding- 14.0f, textH);
  69. self.youpaipcontHeight = textH;
  70. }else{
  71. contTextView.frame = CGRectMake(MarginPadding, 0, KScreenWidth- MarginPadding - 14.0f, 120);
  72. self.youpaipcontHeight = 115;
  73. self.youpaipcontBtn = [[UIButton alloc]initWithFrame:CGRectMake(MarginPadding, self.youpaipcontHeight, 70, 30)];
  74. self.youpaipcontBtn.titleLabel.font = LCBoldFont(15);
  75. [self.youpaipcontBtn setTitle:@"全文" forState:(UIControlStateNormal)];
  76. [self.youpaipcontBtn setTitleColor:LCYellowColor forState:(UIControlStateNormal)];
  77. self.youpaipcontBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 25);
  78. self.youpaipcontBtn.titleLabel.textAlignment = NSTextAlignmentLeft;
  79. [self.youpaipcontBtn setEnlargeEdge:5];
  80. [self addSubview:self.youpaipcontBtn];
  81. self.youpaipcontHeight+=40;
  82. }
  83. if (self.youpaipdyModel.youpaiptype == 1) {
  84. [self youpaifsetupVideo];
  85. }else{
  86. if (self.youpaipdyModel.youpaipimages.count>0) {
  87. self.youpaipimgViewArray = [NSMutableArray array];
  88. [self youpaifsetupImages];
  89. }
  90. }
  91. }
  92. -(void)youpaifsetupVideo{
  93. UIImageView* imgView = [[UIImageView alloc]initWithFrame:CGRectMake(MarginPadding, self.youpaipcontHeight, ScaleSize(213.0f), ScaleSize(284.0f))];
  94. imgView.contentMode = UIViewContentModeScaleAspectFill;
  95. imgView.layer.cornerRadius = 10.0;
  96. imgView.layer.masksToBounds = YES;
  97. imgView.tag = 0;
  98. // [imgView sd_setImageWithURL:[NSURL URLWithString:self.youpaipdyModel.youpaipcover_url] placeholderImage:nil];
  99. YOUPAILCImageModel* imgModel = self.youpaipdyModel.youpaipimages.firstObject;
  100. NSURL *url = [LCTools getImageUrlWithAddress:imgModel.youpaipurl];
  101. if(url){
  102. [self videoImageWithvideoURL:url completion:^(UIImage *image) {
  103. // 主线程执行:
  104. dispatch_async(dispatch_get_main_queue(), ^{
  105. [imgView setImage:image];
  106. });
  107. }];
  108. }
  109. [self addSubview:imgView];
  110. UITapGestureRecognizer* imgTap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(youpaifdidClickPlayVideo:)];
  111. imgView.userInteractionEnabled = YES;
  112. imgView.multipleTouchEnabled = YES;
  113. [imgView addGestureRecognizer:imgTap];
  114. //播放按钮
  115. UIImageView *playImageView = [UIImageView new];
  116. [imgView addSubview:playImageView];
  117. [playImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  118. make.center.mas_equalTo(0);
  119. make.size.mas_equalTo(CGSizeMake(52, 52));
  120. }];
  121. // playImageView.userInteractionEnabled = YES;
  122. playImageView.image = [UIImage imageNamed:@"vqu_images_D_dynamic_play"];
  123. playImageView.layer.shadowColor = LCBkgColor.CGColor;//阴影颜色
  124. playImageView.layer.shadowOffset = CGSizeMake(0, 0);//偏移距离
  125. playImageView.layer.shadowOpacity = 0.5;//不透明度
  126. playImageView.layer.shadowRadius = 10.0;//半径
  127. self.youpaipcontHeight += imgView.frame.size.height;//+10;
  128. }
  129. - (void)youpaifsetupImages{
  130. NSArray* imgArray = self.youpaipdyModel.youpaipimages;
  131. if (imgArray.count==1) {
  132. YOUPAILCImageModel* imgModel = self.youpaipdyModel.youpaipimages[0];
  133. CGFloat imgWidth = ScaleSize(213.0f), imgHeight = ScaleSize(284.0f);
  134. UIImageView* imgView = [[UIImageView alloc]initWithFrame:CGRectMake(MarginPadding, self.youpaipcontHeight, imgWidth, imgHeight)];
  135. imgView.contentMode = UIViewContentModeScaleAspectFill;
  136. imgView.layer.cornerRadius = 10.0;
  137. imgView.layer.masksToBounds = YES;
  138. imgView.tag = 0;
  139. [imgView sd_setImageWithURL:[LCTools getImageUrlWithAddress:imgModel.youpaipurl] placeholderImage:nil];
  140. [self addSubview:imgView];
  141. UITapGestureRecognizer* imgTap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(youpaifimgTapHandel:)];
  142. imgView.userInteractionEnabled = YES;
  143. imgView.multipleTouchEnabled = YES;
  144. [imgView addGestureRecognizer:imgTap];
  145. UILongPressGestureRecognizer *longPressGR = [[UILongPressGestureRecognizer alloc]initWithTarget:self action:@selector(youpaiflpGR:)];
  146. //设定最小的长按时间 按不够这个时间不响应手势
  147. longPressGR.minimumPressDuration=0.7;
  148. [imgView addGestureRecognizer:longPressGR];
  149. self.youpaipcontHeight += imgView.frame.size.height;//+10;
  150. [self.youpaipimgViewArray addObject:imgView];
  151. }else if(imgArray.count==4 || imgArray.count==2){
  152. CGFloat maxWidth = KScreenWidth - MarginPadding - 14.0f;
  153. CGFloat width = maxWidth / 2;
  154. CGFloat wh = width - 3.0f;
  155. for (int i =0 ; i<imgArray.count; i++) {
  156. NSInteger row = i / 2;
  157. NSInteger col = i % 2;
  158. UIImageView* imgView = [[UIImageView alloc]initWithFrame:CGRectMake(MarginPadding + col * (wh + 3.0f), self.youpaipcontHeight + row * (wh + 3.0f), wh, wh)];
  159. imgView.contentMode = UIViewContentModeScaleAspectFill;
  160. imgView.layer.cornerRadius = 8.0;
  161. imgView.layer.masksToBounds = YES;
  162. imgView.tag = i;
  163. YOUPAILCImageModel* imgModel = self.youpaipdyModel.youpaipimages[i];
  164. [imgView sd_setImageWithURL:[LCTools getImageUrlWithAddress:imgModel.youpaipurl]];
  165. [self addSubview:imgView];
  166. UITapGestureRecognizer* imgTap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(youpaifimgTapHandel:)];
  167. imgView.userInteractionEnabled = YES;
  168. [imgView addGestureRecognizer:imgTap];
  169. UILongPressGestureRecognizer *longPressGR = [[UILongPressGestureRecognizer alloc]initWithTarget:self action:@selector(youpaiflpGR:)];
  170. //设定最小的长按时间 按不够这个时间不响应手势
  171. longPressGR.minimumPressDuration = 0.7;
  172. [imgView addGestureRecognizer:longPressGR];
  173. [self.youpaipimgViewArray addObject:imgView];
  174. }
  175. NSInteger totalRow = (imgArray.count + 1) / 2;
  176. self.youpaipcontHeight += totalRow * (width + 8.0f);
  177. }
  178. else {
  179. CGFloat maxWidth = KScreenWidth - MarginPadding - 14.0f;
  180. CGFloat width = maxWidth / 3;
  181. NSInteger row = (imgArray.count + 2) / 3;
  182. CGFloat wh = width - 3.0f;
  183. for (int i =0 ; i<imgArray.count; i++) {
  184. NSInteger col = i % 3;
  185. NSInteger row = i / 3;
  186. UIImageView* imgView = [[UIImageView alloc]initWithFrame:CGRectMake(MarginPadding + col * (wh + 3.0f), self.youpaipcontHeight + row * (wh + 3.0f), wh, wh)];
  187. imgView.contentMode = UIViewContentModeScaleAspectFill;
  188. imgView.layer.cornerRadius = 6.0;
  189. imgView.layer.masksToBounds = YES;
  190. imgView.tag = i;
  191. YOUPAILCImageModel* imgModel = self.youpaipdyModel.youpaipimages[i];
  192. [imgView sd_setImageWithURL:[[LCTools getImageUrlWithAddress:imgModel.youpaipurl] urlWithImageScale:50]];
  193. [self addSubview:imgView];
  194. UITapGestureRecognizer* imgTap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(youpaifimgTapHandel:)];
  195. imgView.userInteractionEnabled = YES;
  196. [imgView addGestureRecognizer:imgTap];
  197. UILongPressGestureRecognizer *longPressGR = [[UILongPressGestureRecognizer alloc]initWithTarget:self action:@selector(youpaiflpGR:)];
  198. //设定最小的长按时间 按不够这个时间不响应手势
  199. longPressGR.minimumPressDuration = 0.7;
  200. [imgView addGestureRecognizer:longPressGR];
  201. [self.youpaipimgViewArray addObject:imgView];
  202. }
  203. CGFloat totalH = width * [@(row) floatValue];
  204. self.youpaipcontHeight += totalH;// + 10.0f;//((KScreenWidth-40)/3.0+5)*(int)ceilf((imgArray.count)/(float)2)+10;
  205. }
  206. // else{
  207. // for (int i =0 ; i<imgArray.count; i++) {
  208. // UIImageView* imgView = [[UIImageView alloc]initWithFrame:CGRectMake(MarginPadding+((KScreenWidth-MarginPadding-20-20)/3+10)*(i%3), self.contHeight+((KScreenWidth-MarginPadding-20-20)/3+10)*(i/3), ((KScreenWidth-MarginPadding-20-20)/3), ((KScreenWidth-MarginPadding-20-20)/3))];
  209. // imgView.contentMode = UIViewContentModeScaleAspectFill;
  210. // imgView.layer.cornerRadius = 3.0;
  211. // imgView.layer.masksToBounds = YES;
  212. // imgView.tag = i;
  213. // YOUPAILCImageModel* imgModel = self.dyModel.images[i];
  214. // [imgView sd_setImageWithURL:[LCTools getImageUrlWithAddress:imgModel.url]];
  215. // [self addSubview:imgView];
  216. // UITapGestureRecognizer* imgTap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(youpaifimgTapHandel:)];
  217. // imgView.userInteractionEnabled = YES;
  218. // [imgView addGestureRecognizer:imgTap];
  219. //
  220. //  UILongPressGestureRecognizer *longPressGR = [[UILongPressGestureRecognizer alloc]initWithTarget:self action:@selector(youpaiflpGR:)];
  221. // //设定最小的长按时间 按不够这个时间不响应手势
  222. //  longPressGR.minimumPressDuration=0.7;
  223. // [imgView addGestureRecognizer:longPressGR];
  224. //
  225. // [self.imgViewArray addObject:imgView];
  226. // }
  227. // self.contHeight += ((KScreenWidth-40)/3.0+5)*(int)ceilf((imgArray.count)/(float)3)+10;
  228. // }
  229. }
  230. - (void)vqf_youpaifupdateTextHeight{
  231. CGFloat padValue = self.youpaiptxtH-120;
  232. if ([self.youpaipcontBtn.titleLabel.text isEqualToString:@"全文"]) {//展开内容
  233. [UIView animateWithDuration:0.25 animations:^{
  234. self.youpaipcontTextV.frame = CGRectMake(MarginPadding, 0, KScreenWidth-MarginPadding - 14.0f, 120);
  235. self.youpaipcontBtn.frame = CGRectMake(MarginPadding, 115, 70, 30);
  236. for (UIImageView* imgV in self.youpaipimgViewArray) {
  237. imgV.frame = CGRectMake(imgV.frame.origin.x, imgV.frame.origin.y-padValue, imgV.frame.size.width, imgV.frame.size.height);
  238. }
  239. }];
  240. UIImageView* lastImgV = [self.youpaipimgViewArray lastObject];
  241. if (lastImgV) {
  242. self.youpaipcontHeight = CGRectGetMaxY(lastImgV.frame);//+10;
  243. }else{
  244. self.youpaipcontHeight = 155;
  245. }
  246. }else{
  247. [UIView animateWithDuration:0.25 animations:^{
  248. // self.contTextV.frame = CGRectMake(15, 0, KScreenWidth-30, self.txtH);
  249. //self.contBtn.frame = CGRectMake(15, self.txtH-5, 70, 30);
  250. self.youpaipcontTextV.frame = CGRectMake(MarginPadding, 0, KScreenWidth-MarginPadding - 14.0f, self.youpaiptxtH);
  251. self.youpaipcontBtn.frame = CGRectMake(MarginPadding, self.youpaiptxtH-5, 70, 30);
  252. for (UIImageView* imgV in self.youpaipimgViewArray) {
  253. imgV.frame = CGRectMake(imgV.frame.origin.x, imgV.frame.origin.y+padValue, imgV.frame.size.width, imgV.frame.size.height);
  254. }
  255. }];
  256. UIImageView* lastImgV = [self.youpaipimgViewArray lastObject];
  257. if (lastImgV) {
  258. self.youpaipcontHeight = CGRectGetMaxY(lastImgV.frame);//+10;
  259. }else{
  260. self.youpaipcontHeight = self.youpaiptxtH+35;
  261. }
  262. }
  263. }
  264. -(void)youpaifdidClickPlayVideo:(UITapGestureRecognizer *)sender{
  265. UIImageView *imageView = (UIImageView *)sender.view;
  266. // 视频
  267. YOUPAILCImageModel* imgModel = self.youpaipdyModel.youpaipimages.firstObject;
  268. NSURL *url = [LCTools getImageUrlWithAddress:imgModel.youpaipurl];
  269. YBIBVideoData *model = [YBIBVideoData new];
  270. model.videoURL = url;
  271. model.thumbImage = imageView.image;
  272. // model.projectiveView = imageView;
  273. model.allowSaveToPhotoAlbum = NO; //是否允许保存到相册
  274. model.autoPlayCount = NSUIntegerMax;
  275. YBImageBrowser *browser = [[YBImageBrowser alloc] init];
  276. browser.dataSourceArray = @[model];
  277. browser.shouldHideStatusBar = false;
  278. browser.currentPage = 0;
  279. [browser show];
  280. }
  281. - (void)youpaifimgTapHandel:(UITapGestureRecognizer*)tap{
  282. if (tap.state == UIGestureRecognizerStateEnded) {
  283. UIImageView* imgView = (UIImageView*)tap.view;
  284. NSArray* imgArray = self.youpaipdyModel.youpaipimages;
  285. if (imgArray.count>0) {
  286. NSMutableArray *tempArr = [NSMutableArray array];
  287. for (int i=0; i<imgArray.count; i++) {
  288. YOUPAILCImageModel* imgModel = imgArray[i];
  289. YBIBImageData *model = [YBIBImageData new];
  290. model.imageURL = [LCTools getImageUrlWithAddress:imgModel.youpaipurl];
  291. model.projectiveView = self.youpaipimgViewArray[i];
  292. [tempArr addObject:model];
  293. }
  294. YBImageBrowser *browser = [YBImageBrowser new];
  295. browser.dataSourceArray = tempArr;
  296. browser.currentPage = imgView.tag;
  297. [browser show];
  298. }
  299. }
  300. }
  301. //长按手势
  302. -(void)youpaiflpGR:(UILongPressGestureRecognizer *)lpGR
  303. {
  304. NSString *user_id = [LCSaveModel getUserModel].youpaipuserinfo.youpaipuser_id;
  305. if (![[LCSaveData getServiceIdArr] containsObject:user_id]) {
  306. return;
  307. }
  308. //手势结束
  309. if (lpGR.state == UIGestureRecognizerStateBegan){
  310. AudioServicesPlaySystemSound(1519);
  311. } else if (lpGR.state == UIGestureRecognizerStateEnded){
  312. NSMutableArray* actionArray = [NSMutableArray array];
  313. ZCAlertAction* reportAction = [ZCAlertAction actionWithTitle:@"删除图片" andblock:^{//举报
  314. UIImageView* imgView = (UIImageView*)lpGR.view;
  315. YOUPAILCImageModel* imgModel = self.youpaipdyModel.youpaipimages[imgView.tag];
  316. if (imgModel.youpaipimg_id.length == 0) {
  317. return;
  318. }
  319. [LCHttpHelper requestWithURLString:DynamicDeleteLower parameters:@{@"type":@"2",@"info_id":imgModel.youpaipimg_id} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
  320. NSDictionary* dict = (NSDictionary*)responseObject;
  321. NSInteger code = [[dict objectForKey:@"code"] integerValue];
  322. if (code==0) {//成功
  323. [self.youpaipdyModel.youpaipimages removeObject:imgModel];
  324. if (self.youpaipdelegate && [self.youpaipdelegate respondsToSelector:@selector(youpaifdeleteImage:)]) {
  325. [self.youpaipdelegate youpaifdeleteImage:self.youpaipdyModel];
  326. }
  327. }
  328. } failure:^(NSError *error) {}];
  329. }];
  330. [actionArray addObject:reportAction];
  331. ZCAlertSheetView* alertSheet = [[ZCAlertSheetView alloc]initWithTitle:nil andShowCancelButton:YES andAction:actionArray];
  332. alertSheet.alertWindow.hidden = NO;
  333. [alertSheet show];
  334. }
  335. }
  336. //获取视频预览图,这里用到了SDImage的缓存图片功能:
  337. - (void)videoImageWithvideoURL:(NSURL *)videoURL completion:(void (^_Nullable)(UIImage *image))completionBlock{
  338. //先从缓存中找是否有图片
  339. SDImageCache *cache = [SDImageCache sharedImageCache];
  340. UIImage *memoryImage = [cache imageFromMemoryCacheForKey:videoURL.absoluteString];
  341. if(memoryImage) {
  342. completionBlock(memoryImage);
  343. return;
  344. }else{
  345. UIImage*diskImage = [cache imageFromDiskCacheForKey:videoURL.absoluteString];
  346. if(diskImage) {
  347. completionBlock(diskImage);
  348. return;
  349. }
  350. }
  351. dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
  352. AVURLAsset *asset = [[AVURLAsset alloc]initWithURL:videoURL options:nil];
  353. NSParameterAssert(asset);
  354. AVAssetImageGenerator *assetImageGenerator =[[AVAssetImageGenerator alloc]initWithAsset:asset];
  355. assetImageGenerator.appliesPreferredTrackTransform = YES;
  356. assetImageGenerator.requestedTimeToleranceAfter = kCMTimeZero;//必须设置,否则时间对应不上
  357. assetImageGenerator.requestedTimeToleranceBefore = kCMTimeZero;//必须设置,否则时间对应不上
  358. assetImageGenerator.apertureMode = AVAssetImageGeneratorApertureModeEncodedPixels;
  359. CGImageRef thumbnailImageRef = NULL;
  360. CFTimeInterval thumbnailImageTime = 1;
  361. NSError *thumbnailImageGenerationError =nil;
  362. thumbnailImageRef = [assetImageGenerator copyCGImageAtTime:CMTimeMakeWithSeconds(thumbnailImageTime, 10) actualTime:NULL error:&thumbnailImageGenerationError];
  363. if(!thumbnailImageRef)
  364. NSLog(@"thumbnailImageGenerationError %@",thumbnailImageGenerationError);
  365. UIImage *thumbnailImage = thumbnailImageRef ? [[UIImage alloc]initWithCGImage:thumbnailImageRef] :nil;
  366. if(thumbnailImage){
  367. completionBlock(thumbnailImage);
  368. dispatch_async(dispatch_get_main_queue(), ^{
  369. SDImageCache *cache = [SDImageCache sharedImageCache];
  370. // [cache storeImageToMemory:thumbnailImage forKey:videoURL.absoluteString];
  371. [cache storeImage:thumbnailImage forKey:videoURL.absoluteString completion:^{
  372. }];
  373. });
  374. }
  375. });
  376. }
  377. @end