objective c - How to generate video thumbnail iOS without network call to server? -


i want when user pick video gallery want thumbnail image of video.so possible thumbnail image of video without uploading server?

- (void)imagepickercontroller:(uiimagepickercontroller *)picker didfinishpickingmediawithinfo:(nsdictionary *)info {     nsurl *urlvideo = [info objectforkey:uiimagepickercontrollermediaurl];     __block nsdata *moviedata = [[nsdata alloc]initwithcontentsofurl:urlvideo];avurlasset *asset=[[avurlasset alloc] initwithurl:urlvideo options:nil];     avassetimagegenerator *generator = [[avassetimagegenerator alloc] initwithasset:asset];     generator.appliespreferredtracktransform=true;       cmtime thumbtime = cmtimemakewithseconds(0,30);      avassetimagegeneratorcompletionhandler handler = ^(cmtime requestedtime, cgimageref im, cmtime actualtime, avassetimagegeneratorresult result, nserror *error){         if (result != avassetimagegeneratorsucceeded) {             nslog(@"couldn't generate thumbnail, error:%@", error);         }          uiimage *img = [uiimage imagewithcgimage:im];     }; } 

Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -