Videodan küçük resim alıp masaüstümde göstermeye çalışıyorum. İşte benim kodum:iOS - Videonun oynatılmadan küçük resmi nasıl edinilir?
- (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;
}
Ancak görüntü her zaman siyah olarak döndürülür. Sorun nedir?
Zaman.value milisaniyedir, belki de zaman çerçevesi siyahtır Çerçeveyi başka bir değere dönüştürdünüz mü –
Yardımlarınız için teşekkürler! İşe yarıyor. – TienLe
Most Welcome @TienLe –