cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Fetching video thumbnails in Swifty Dropbox

Fetching video thumbnails in Swifty Dropbox

sigrem
New member | Level 1

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

            }

        }

    }

1 Reply 1

Greg-DB
Dropbox Staff

The files.getThumbnail method in the SwityDropbox SDK is the equivalent method for getting thumbnails as getThumbnailBuilder in the Android/Java SDK.

Anyway, yes, errors from the getThumbnail call should be captured by the error code block. Can you share whatever output/crash you're getting? Also, the parameters you're using may be helpful.

 

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?