cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Back again with another edition of 'How we use Dropbox', so find out how Emma uses to-do lists to get it all done 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

Re: Fetching video thumbnails in Swifty Dropbox

Greg-DB
Dropboxer

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.

 

Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropboxer
What do Dropbox user levels mean?
Need more support?