मैं वीडियो से थंबनेल प्राप्त करने और इसे अपने टेबलव्यू में दिखाने की कोशिश कर रहा हूं। यहां मेरा कोड है:आईओएस - बिना वीडियो के थंबनेल कैसे प्राप्त करें?
- (UIImage *)imageFromVideoURL:(NSURL *)contentURL {
AVAsset *asset = [AVAsset assetWithURL:contentURL];
// Get thumbnail at the very start of the video
CMTime thumbnailTime = [asset duration];
thumbnailTime.value = 25;
// Get image from the video at the given time
AVAssetImageGenerator *imageGenerator = [[AVAssetImageGenerator alloc] initWithAsset:asset];
CGImageRef imageRef = [imageGenerator copyCGImageAtTime:thumbnailTime actualTime:NULL error:NULL];
UIImage *thumbnail = [UIImage imageWithCGImage:imageRef];
CGImageRelease(imageRef);
return thumbnail;
}
लेकिन छवि हमेशा काला लौटती है। क्या गलत है?
टाइम.वल्यू मिलीसेकंड में है शायद समय पर फ्रेम काला है क्या आपने फ्रेम को किसी अन्य मूल्य –
में आपकी मदद के लिए धन्यवाद दिया है! यह काम करता हैं। – TienLe
अधिक स्वागत @TienLe –