I picked a video from album using UIImagePickerController
and trying to generate thumbnail from it using below function:
func getThumbnailFrom(path: URL) -> UIImage? {
do {
let asset = AVURLAsset.init(url: path)
print(asset.url)
let imgGenerator = AVAssetImageGenerator(asset: asset)
imgGenerator.appliesPreferredTrackTransform = true
let cgImage = try imgGenerator.copyCGImage(at: CMTimeMake(0, 1), actualTime: nil)
let thumbnail = UIImage(cgImage: cgImage)
return thumbnail
} catch let error {
print("*** Error generating thumbnail: \(error.localizedDescription)")
return nil
}
}
But on logs I van see *** Error generating thumbnail: Cannot Open
[discovery] errors encountered while discovering extensions: Error Domain=PlugInKit Code=13 "query cancelled" UserInfo={NSLocalizedDescription=query cancelled}
Any idea why ? Its the bug in iOS 11 devices, any idea how to fix this issue and generate thumbnail ?
Thanks!