Hi,
I use the following code to get thumbnail for images and videos (using Swifty Dropbox). It works for images and for many videos but crashes on some other videos. Shouldn't unsuccessful thumb generation be captured in the error section? Is there a Swift counterpart for Android's getThumbnailBuilder?
func fetchDropboxThumbnail(client: DropboxClient, file: Files.Metadata, toPath: String) {
let destination : (NSURL, NSHTTPURLResponse) -> NSURL = { temporaryURL, response in
let thumbUrl = NSURL(fileURLWithPath: toPath)
return thumbUrl
}
client.files.getThumbnail(path: file.pathLower, destination: destination).response { response, error in
if let response = response {
print("Assuming thumbnail saved to toPath")
}
else {
print("\(error)")
// Assuming thumbnail could not be generated
}
}
}