Extract thumbnail from video url

前端 未结 6 832
悲哀的现实
悲哀的现实 2021-01-05 15:57

I have to extract a thumbnail from a video (from url) and I use this code:

NSString *stringUrl = video.stringurl;
NSURL *url = [NSURL URLWithString:stringUrl         


        
6条回答
  •  余生分开走
    2021-01-05 16:56

    on one of my app i've captured an image from the video url like this:

    MPMoviePlayerController *player = [[[MPMoviePlayerController alloc] initWithContentURL:videoURL]autorelease];
    UIImage  *thumbnail = [player thumbnailImageAtTime:0.0 timeOption:MPMovieTimeOptionNearestKeyFrame];
    

    just passing the url object as videoURL and with the use of MPMoviePlayerController i successfully able to have the image all the time. hope you too will be able to do this with this simple code

提交回复
热议问题