I'm receiving a high/medium quality thumbnail of remote video by AVAssetImageGenerator, but still it takes 10 to 15 seconds to get thumbnail out of it.
Is there any way to get low quality thumbnail instantly?
below code I've used to get thumbnail of remote video.
The strange is when I download this video it's size was 1.1 MB and created Thumbnail size is 1.8 MB.
let assetForThumbnail = AVAsset(URL: videoURL)
let durationSeconds = CMTimeGetSeconds(assetForThumbnail.duration)
let generator = AVAssetImageGenerator(asset: assetForThumbnail)
generator.appliesPreferredTrackTransform = true
let time = CMTime(seconds: durationSeconds/3.0, preferredTimescale: 600)
generator.generateCGImagesAsynchronouslyForTimes([NSValue(CMTime: time)]) { (requestedTime: CMTime, thumbnail: CGImage?, actualTime: CMTime, result: AVAssetImageGeneratorResult, error: NSError?) in
print("error: \(error)")
print("status: \(result)")
if let thumbnailC = thumbnail {
let image = UIImage(CGImage: thumbnailC)
}
}