Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UploadThumbnailAsync not working? #130

Open
Onthrax opened this issue May 28, 2019 · 2 comments
Open

UploadThumbnailAsync not working? #130

Onthrax opened this issue May 28, 2019 · 2 comments
Assignees

Comments

@Onthrax
Copy link

Onthrax commented May 28, 2019

Hi,

I've been having difficulties uploading a custom thumbnail to vimeo. Every attempt results in images like this: https://i.vimeocdn.com/video/786876502_480.jpg

I don't see anything wrong with the code but perhaps I am doing something wrong.
Or perhaps Vimeo has changed something.

Please assist.

Using file = New VimeoDotNet.Net.BinaryContent(FileUpload1.FileContent, "image/jpeg") Dim uploaded = Await Client.UploadThumbnailAsync(Record.VimeoClipID, file) End Using

@Onthrax Onthrax changed the title UploadThumbnailAsync not working UploadThumbnailAsync not working? May 28, 2019
@zizzex
Copy link

zizzex commented Aug 30, 2019

Hi,
I have the same problem, thumbnails appear as Onthrax described.
I have tried with png, same results.
I have also tried to use a frame of the video by setting "time" as described here: https://developer.vimeo.com/api/upload/thumbnails#creating-a-thumbnail but always same result.

Anyone can help?
Thanks.

@zizzex
Copy link

zizzex commented Aug 30, 2019

Update: I was encoding "active" and "time" in the url, instead they should be put in the body.
I have made the correction and now works, I can use a frame of the video as thumbnail without having to upload any file.

public async Task SetThumbnailAsync(long clipId, float time)
        {
            try
            {
                ThrowIfUnauthorized();
                var request = _apiRequestFactory.GetApiRequest(AccessToken);
                request.Method = HttpMethod.Post;
                request.Path = Endpoints.Pictures;
                request.UrlSegments.Add("clipId", clipId.ToString());
                var parameters = new Dictionary<string, string>
                {
                    ["active"] = "true",
                    ["time"] = time.ToString()
                };
                request.Body = new FormUrlEncodedContent(parameters);
                var response = await request.ExecuteRequestAsync().ConfigureAwait(false);
                CheckStatusCodeError(null, response, "Error Setting thumbnail image.");
            }
            catch (Exception ex)
            {
                if (ex is VimeoApiException)
                {
                    throw;
                }
                throw new VimeoUploadException("Error Setting thumbnail image.", null, ex);
            }
        }

@mfilippov mfilippov self-assigned this Oct 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants