I am using AVAssetImageGenerator for generating the thumbnail images for video play buttons. When i pass server video url to generate image it is retuning null.
AVAsset *asset = [AVAsset assetWithURL:url];
AVAssetImageGenerator *imageGenerator = [[AVAssetImageGenerator alloc]initWithAsset:asset];
CMTime time = CMTimeMake(51,1);
CGImageRef imageRef = [imageGenerator copyCGImageAtTime:time actualTime:NULL error:NULL];
UIImage *thumbnail =[[UIImage alloc]initWithCGImage:imageRef];
CGImageRef cgref = [thumbnail CGImage];
CIImage *cim = [thumbnail CIImage];
if (cim == nil && cgref == NULL)
{
NSLog(@"no underlying data");
}
CGImageRelease(imageRef);
Always i am getting null data.rarely i am getting only one image. How can i solve this problem.