VimeoDotNet SDK

VimeoDotNet3 is now available for communicating with Vimeo API v3! Visit https://github.com/saeedafshari/VimeoDotNet3 for more details!

This library is for applications that use .NET Framework 4.0. For Metro style applications, visit this page.

Upload features are no longer included in the open source version and are available only to people who support the project. To get the code for upload, consider making a donation and then send me an email to give you the full version! Thank you!

This project was made in my spare time and is not supported by Vimeo. If you want to keep this project alive and updated, you can motivate me by making a donation to the project via PayPal. That makes me happy and more willing to help you in using the project! Thank you!
If you want to know how these donations work, read the Support Projects page using the link at the top of the page.

 

VimeoDotNet is a wrapper for Vimeo Advanced API for Microsoft .NET. It supports almost all of Advanced API’s methods, plus additional helper methods that makes things much easier.

To use this library follow these steps:

Getting started

These steps are for the current version of VimeoDotNet. For changesets prior to 69365, read this page instead.

  1. Download the latest version of VimeoDotNet from the Source Code page
  2. Add a reference to VimeoAPI from your project
  3. Create an instance of Vimeo.API.VimeoClient with your Consumer Key and Secret, and the permission level for the ticket.

After performing the steps mentioned above, you should log onto Vimeo. follow these steps to do that:

Authorization

  1. Assume our VimeoClient object’s name is vc. get an unauthorized token by calling this method:
    vc.GetUnauthorizedRequestToken();
  2. Then you should provide user with an authorization URL. Call this method to get the URL:
    string url = vc.GenerateAuthorizationUrl();
  3. After the user opens the link and authorizes your application, they should enter a verifier code in your application. You use this code to get an access token:
    vc.GetAccessToken(verifier);
  4. Finally you should call this method to complete the logon process:
    vc.Login();

Authorization Page

Verifier

App Login
After logging on successfully, be sure to save vc.Token and vc.TokenSecret to be able to log in next time using the same token. To log in with a previously used token use this code:

if (vc.Login(SavedToken, SavedSecret)) Start Application;

For more resources check out this pages:

Have fun!

http://vimeodotnet.codeplex.com/

  1. Hi Saeed,

    This code is great! thanks for it! It is going to save a lot of time on the project I am developing.

    I am doing a web application project. I only need the authentication and upload process so I have just take that part, but I will keep your API because for sure I will use it on the future.

    Thanks for this great job!

  2. Hi,

    any idea why i get a “Length cannot be less than zero.” after calling vc.vimeo_videos_getInfo(“video-id”);

    i just want to get public video/channel/album information without using user authentication. i know the simple api is maybe the better solution here, but the simple api will not provide different thumbnails for a video i guess.

    btw, here is the stack trace:

    [ArgumentOutOfRangeException: Length cannot be less than zero.
    Parameter name: length]
    System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy) +12681562
    Common.OAuthBase.GenerateTimeStamp() in C:\Users\Mike\Desktop\Libraries\vimeodotnet-66089\Vimeo\Common\OAuthBase.cs:397
    Common.VimeoAPI.BuildOAuthApiRequestUrl(String url, String token, String tokenSecret, SortedDictionary`2& parameters, String httpMethod) in C:\Users\Mike\Desktop\Libraries\vimeodotnet-66089\Vimeo\Common\VimeoApi.cs:84
    Vimeo.API.VimeoClient.GetRequestUrl(String baseUrl, String method, SortedDictionary`2 parameters, SortedDictionary`2& oauth_parameters, String httpMethod) in C:\Users\Mike\Desktop\Libraries\vimeodotnet-66089\VimeoAPI\API\VimeoClient.cs:239
    Vimeo.API.VimeoClient.ExecuteGetRequest(String method, SortedDictionary`2 parameters) in C:\Users\Mike\Desktop\Libraries\vimeodotnet-66089\VimeoAPI\API\VimeoClient.cs:244
    Vimeo.API.VimeoClient.vimeo_videos_comments_getList(String video_id, Nullable`1 page, Nullable`1 per_page) in C:\Users\Mike\Desktop\Libraries\vimeodotnet-66089\VimeoAPI\API\VimeoClient.cs:1479
    Website_Test.vimeo.send(Object sender, EventArgs e) in C:\Users\Mike\Documents\Visual Studio 2010\Projects\Test\Website_Test\vimeo.aspx.cs:31
    System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +154
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3691

    Thanks!

    Mike

    • Hi Mike,

      I tried to simulate your problem by calling vc.vimeo_videos_getInfo without authenticating. Here’s what I did:
      I created a new solution based on VimeoDotNet and modified the GlobalConstants.cs file with my Consumer Key and Secret; Made a new project (Target: .NET Framework 4.0) and added a reference to VimeoAPI. Inside this new project I wrote this:

      using Vimeo.API;
      ...
      private void button1_Click(object sender, EventArgs e)
      {
      VimeoClient vc = new VimeoClient();
      var a = vc.vimeo_videos_getInfo("24352120");
      System.Diagnostics.Debug.WriteLine(a.title);
      }

      There was a bug in parsing the unauthenticated XML response (oops! :-) ), but I don’t think it was the source of your problem. I fixed the bug (Here’s the update: http://vimeodotnet.codeplex.com/SourceControl/changeset/changes/69038) and now this piece of code works fine.

      Download the update and try what I did step by step, see if it fixes your problems. If not, inform me with any more clues you find. ;-)

      • Hi,

        is it possible to play videos from vimeo using these wrapper / Api. ?
        or only possible to view the informations about the uploaded videos ?

        thanks in advance

      • Hi. To play the videos, you can use the Embed API which gives you a Vimeo player that you can put wherever you want. VimeoDotNet helps you use the Vimeo Advanced API and Vimeo Upload API methods.

  3. Hi Saeed,

    thanks for the fast feedback and modification, but as you already mentioned that was not the reason for my problem. But good news… Take a look at OAuthBase.cs (Line 396).

    timeStamp = timeStamp.Substring(0, timeStamp.IndexOf(“.”));

    The “.” is the separator here in english UI Culture, but not so in german (development on virtual german Windows 7 machine) :) in the german UI “,” is working, so for a test i changed it to “,” and everything is fine so far.

    The real (not test) app is set to english UI culture in web.config, so no need to change here, but to have multilingual support here a change or at least a hint would be fine :)

    With everything works.

    Thanks!
    Mike

    • Wow! I didn’t see that coming! :)

      Actually I borrowed the oAuth portion of the code from another project in Vimeo’s examples page, and then implemented the Vimeo API on top of it. (That’s why there are three projects in the source code). So I had no idea something like this would happen! But I think I can modify this line to work on all regions. From what I’m seeing here, I think this code takes the integer part of the timeStamp (or something like this) which can be done in an easier way.

      Thanks!

      Edit: FYI that line from Rob Green’s OAuth code should be changed to this:
      string timeStamp = ((Int64)ts.TotalSeconds).ToString();

  4. Hi Saeed,

    I tried your code several times but always failed. So, I want a simple example to upload video to vimeo with FileUpload control in .NET Frame 4.0, can you send me via macol@bitgear.net?

    Thanks!

    • Hi,
      Could you be more specific?
      Did you get a run time error or Vimeo error? Which line doesn’t work for you?


      // vc is an authenticated VimeoClient object with upload permission
      Ticket t = vc.vimeo_videos_upload_getTicket(null, null);
      vc.PostVideo(t,@ "c:\myvideo.wmv");
      vc.vimeo_videos_upload_complete("myvideo.wmv", t.id);

  5. Hi Saeed,

    I do it like this, when I print out the Ticket.id, It returns me the error:

    “System.NullReferenceException: Object reference not set to an instance of an object”

    ———————————————-
    Vimeo.API.VimeoClient vc = new Vimeo.API.VimeoClient();

    Vimeo.API.Ticket t = vc.vimeo_videos_upload_getTicket(null, null);

    Response.Write(t.id);
    —————————————————

    Callback URL: Not set
    Upload Access: Requested – pending

    I think the “Upload Access” should not be ” pending” but “approved”, yes?

    I am confused.

    Thanks!

    • Exactly. Pending means the vimeo people didn’t give you the upload permission yet. So that’s a problem.
      And in your code I don’t see the part where you log into your account. Did you write that part? Or are you trying to get a ticket without logging in?

  6. Hi Saeed,

    I am not able to upload a file, as I told you I just take a part of your project because I already have some stuff. Can I told you my problem, hopefully you can help me.

    Basically I do the POST method with the file data, and seems that everything works but returns 0 value and on the vimeo account is not the video.

    some code:

    string baseUrl = ticket["endpoint"].Value + “&chunk_id=” + chunk_id.ToString() + “&” + OAuthTokenKey + “=” + Token;
    // this give to me all parameters as your “oAuth.GenerateSignature” with also ticket id and chunk //
    query = oAuthWebRequest(Method.POST, baseUrl);

    NameValueCollection parameters = HttpUtility.ParseQueryString(query.Split(‘?’)[1]);
    parameters.Add(“file_data”, “”);

    string endpoint = ticket["endpoint"].Value + “&chunk_id=” + chunk_id.ToString();
    HttpWebRequest req = System.Net.WebRequest.Create(endpoint) as HttpWebRequest;

    // from here is almost a copy-paste of your “PostVideo” method
    string boundary = String.Format(“———-{0}”, Guid.NewGuid());

    req.ContentType = String.Format(“multipart/form-data; boundary={0}”, boundary);
    req.Method = Method.POST.ToString();
    req.KeepAlive = true;
    req.Credentials = System.Net.CredentialCache.DefaultCredentials;

    StringBuilder header = new StringBuilder();

    foreach (string key in parameters)
    {
    header.AppendFormat(“–{0}\r\n”, boundary);
    if (key.Equals(“file_data”))
    {
    header.AppendFormat(“Content-Disposition: form-data; name=\”file_data\”; filename=\”{0}\”\r\n”,
    Path.GetFileName(path));
    header.Append(“Content-Type: application/octet-stream\r\n\r\n”);
    header.Append(“\r\n”);
    }
    else
    {
    header.AppendFormat(“Content-Disposition: form-data; name=\”” + key + “\”\r\n\r\n{0}\r\n”,
    parameters[key]);
    }
    }

    // get the header as bytes
    byte[] headerBytes = Encoding.ASCII.GetBytes(header.ToString());

    // get the footer bytes
    byte[] footerBytes = Encoding.ASCII.GetBytes(String.Format(“\r\n–{0}–“, boundary));

    // get the complete set of bytes
    byte[] data = file_data
    .Concat(headerBytes)
    .Concat(footerBytes)
    .ToArray();

    // set the content length
    req.ContentLength = data.Length;

    // write the bytes to the request stream
    using (Stream s = req.GetRequestStream())
    {
    s.Write(data, 0, data.Length);
    }

    // get the response
    HttpWebResponse response = req.GetResponse() as HttpWebResponse;

    Stream responseStream = response.GetResponseStream();
    StreamReader responseReader = new StreamReader(responseStream);

    return responseReader.ReadToEnd();

    It is returning currently a 0 value but the response says an “ok”, do I miss something?

    the video I am trying to upload is UploadVideo(“c:\\test\\xml_test2.m4v”) just in case video format matters.

    hope you can help, many thanks!

    JC

  7. Hi!

    I don’t understand very well how to login. Your code above says:
    string unauthorizedToken = vc.GetUnauthorizedRequestToken();

    but vc.GetUnauthorizedRequestToken() returns void.

    And also, I don’t know where to get the “verifier” value in
    vc.GetAccessToken(verifier)

    I hope you can help me with this.
    Thank you very much for making your wrapper public!

    • Hi Sebastian,

      I updated the tutorial and added a few pictures to show the authorization process. You might want to read it again.

      I’m here if you have any questions.

      • Thanks Saeed,

        I think my situation is different, because I’m working on a web site that will always use our own Vimeo account. Users will upload their videos to my server, and later, a process will upload them to Vimeo with a single Vimeo Account… So I don’t think I need that “verifier” string or any login process…

        I’ll keep trying to figure out.. Any help appreciated !

      • This is the only way to connect to a vimeo account using the Advanced API.
        In your case, you can authorize once, store the oauth authorized token and use it to authorize next times.

  8. Hi there,

    I am working on a web project hopefully using your wrapper. I have gotten past the authentication, but I am a little stuck with the rest.
    We probably have a little different needs than others using your wrapper. My company has a collection of videos and this app will just be a way to select and display them. What I need is to return all the videos to the account, or choose a specific tag, but still limited just to our account, then display the thumbnails so they can click and select the video they want. No upload, just this simple. We already have the page designed so all I have to do is get the list of returned videos into a simple unordered list and CSS will take care of the rest. Problem is, I can’t really find an example using your wrapper for this. I have the app already logged in, is there any place you know with any examples for what I want? It looks to me that the getbytag method returns all videos with that tag no matter what the account, which is not what I want. But even if I was to use that, I really need to see an example of a call to the method.
    Help!

    • Hello there,

      Unfortunately you can either get all of the videos for an account (vimeo.videos.getAll) or search for a tag in vimeo (vimeo.videos.getByTag). Also whichever method you use, you are limited to getting 50 videos in each page (API Request). So if you want to get all of the videos for an account, you have to know the number of videos that user has (people.getInfo) and use vimeo.videos.getAll in a loop.

      Anyway, here’s how you can call vimeo.videos.getAll to get a list of my first 50 videos using VimeoDotNet:

      var vids = vc.vimeo_videos_getAll(true, 
         1 /*page*/, 
         null, 
         VimeoClient.VideosSortMethod.Default, 
         "saeed");

      Here’s how you can find videos tagged as “cheese”:

      var vids = vc.vimeo_videos_getByTag(true, 
         1 /*page*/, 
         null, 
         VimeoClient.VideosSortMethod.Default, 
         "cheese");

      and you can for example print a list of their titles and thumbnail urls like this:

      foreach (var item in vids)
      {
         Console.WriteLine(item.title);
         Console.WriteLine(item.thumbnails[0].Url);
      }
      • thank you very much. I was able to get your examples to work very nicely. I hate to be a pest, but I do have another question. In the return info for the videos, and even if I do a videos_getinfo, I don’t seem to see a list of the tags associated with a video. Since, as you pointed out, we can’t limit a getbytag to only our account, our plan is to create our own list of tags by going through all the videos in our account, as we don’t believe we will have a huge amount of videos. The problem is I don’t see where the tags are returned for the video. Am I missing something?

      • Unfortunately it looks like there is no way to get the list of tags associated with a video.

  9. Why does the vimeo api documentation show tags as a response for video_getinfo?

  10. How do I add a description and tags when doing “PostVideo”?

    • The vimeo_videos_upload_complete method returns the video id, so:


      //Get the video ID
      var video_id = vc.vimeo_videos_upload_complete(filename, ticket_id);
      //Set the description
      vc.vimeo_videos_setDescription(video_id, "Hello, World!");
      //Add tags
      vc.vimeo_videos_addTags("foo", video_id);
      vc.vimeo_videos_addTags("bar", video_id);

      Read the methods list for more info.

  11. hi ; simply i want to ask you that can i play 3gp(H264,AMR-NB) file in your player;
    plz help me !!!!!!!!!!!!

  12. Hey Saeed great work, I’m wonder however is there any chance of a Windows Phone 7 port?

    • Thanks Carl,
      The API Wrapper should work on WP7 with few (if any) tweaks.

      If you are asking about the client application (Vimeo for Windows), I’m planning on porting it to WinRT (Windows 8 Metro) first. I’m also thinking of porting Vimeo for Windows to WP7, but I’m not sure how I can play vimeo videos on WP7 properly. I have to work on it!

  13. GenerateAuthorizationUrl return only http://vimeo.com/oauth/authorize?oauth_token=&permission=delete

    And this is not working.
    All I did was ad my consumer keys and secret like this

    var vc = new Vimeo.API.VimeoClient(APIKey, APISecret);
    vc.GetUnauthorizedRequestToken();
    string url = vc.GenerateAuthorizationUrl();

    Is this still up to date?

    Trying to debug it and the method GetUnauthorizedRequestToken build an url that returns and error:

    400 Bad Request – Missing required parameter – A required parameter was missing: oauth_callback.

    • This issue has been fixed.
      I’m getting lots of similar questions during the past month or so. This code used to work with no problem, and I suspect a change in Vimeo API is causing this problem.
      Because I haven’t used Vimeo API for a long time, and I’m too busy with my other projects to modify this wrapper every time they change their API, I really don’t know
      what the problem is exactly.

      However I did a little debugging and found out that the source of the problem is in the ExecuteGetCommand(…) method in VimeoApi.cs, which is the method that executes
      API commands. If you or anyone else found the problem, tell me and I’ll fix the wrapper so that everyone can use it.

      Thanks.

  14. Saeed,
    I have determined that the VimeoDotNet API does not properly complete the GetUnauthorizedRequestToken() call, possibly due to the fact that I do not have an oAuth_callback defined on my account. Actually, i tried it with and without a callback defined.

    Here is the error returned from the call:
    400 Bad Request – Missing required parameter – A required parameter was missing: oauth_callback.

    I do see in the documentation that you can send the string, oob, to use the callback defined on your application… but that looks to be the following call, where you are requesting an access key.

    Can you help?

    • Jashmead,

      I too have the same problem with the unauthorized token. I seem to get a “Bad Request” on the “http://vimeo.com/oauth/request_token” uri.

      Has something changed on the Vimeo API? I am just starting to use the api (yours and Vimeo’s) as from today.

      Steven

  15. OK: got it:

    * In the oAuthBase :: GenerateSignatureBase (the first overload) I added a new QueryParameter(OAuthCallbackKey, “oob”).

    * Then, in the VimeoAPI :: BuildOAuthApiRequestUrl (the second overload), I also added
    sb.AppendFormat(“&oauth_callback={0}&”, “oob”);
    to the stringbuilder, and
    parameters.Add(“oauth_callback”, “oob”);
    to the SortedDictionary.

    Hope this helps someone

    • Are you willing to provide a code update for me? I’m new to this….

    • @Steven: I finally found the time to implement your solution and so far I think it works perfect :) they probably made oauth_callback a required parameter. I’ll perform a check-in with the fix soon.

      • Is there any chance for a fix soon? I don’t understand the explanation of the code changes above.

      • Oops, I see you did provide an update. You are the best!

      • I got the latest just now. I get an error that generate signature takes 12 arguments. On

        string sig = oAuth.GenerateSignature(uri, consumerKey,
        consumerSecret,
        token, tokenSecret, httpMethod, timeStamp, nonce,
        OAuthSignatureType.HMACSHA1,
        out normalizedUrl, out normalizedRequestParameters, addCallBack);

        in VimeoApi.cs …. Can you help?

      • I’ve added another parameter (bool addCallBack) to this method, which you should send a true value to it. However, you shouldn’t even be calling this function directly, you should be using the Vimeo API classes and they will do the rest.

        Oh and there were some problems with the source control (some files weren’t uploaded before) so I’ve updated the source code again.

  16. I’m not understanding the process to get access for my applicaiton. Many users will be using my windows app to log into the same vimeo account. So do they each have to do the access process or can I just do it and store the data in the application? I don’t see code for that .. I have no clue how to proceed. Help would be appreciated.

    • I think you might be able to store the authorization data once and use it multiple times, however I’m not sure if the Terms of Use allows you to do such thing.

      • But you are saying I still have to run through the authorization steps? So what is the process.. do I check for the authorization data and if it’s non existant, mae the user authorize? That sounds confusing for the user. Do I understand the process? Then I can store it and it’ll be there at least for my use ever time of the application?

      • Auth steps are covered in the article. First, check if you already have a functional token and token secret. If not, you will have to obtain an “unauthorized request token”, make the user open an “Authorization URL” and then try to get the access token.

        I think you can’t use multiple tokens for one user and application, but you might be able to auth once and share the token between different people.

  17. Hi Saeed

    Since today, I tried to upload a video of 132mb. On doing so, I get an exception on “req.GetResponse” saying the operation timed out. Setting the ReadWriteTimeOut and TimeOut on the request doesn’t work. Do you have any idea what could go wrong?

    Thanks
    Steven

    • That’s a lot of bytes, did you do a single part upload? if so, try uploading in chunks. It’s easy:

      var path = @”C:\myvideo.mp4″;
      var t = vc.vimeo_videos_upload_getTicket();
      int chunksCount = vc.GetChunksCount(path);

      for (int i = 0; i < chunksCount; i++)
      {
      vc.PostVideo(t, i, path);
      }

      //maybe do a verify_chunks here.

      vc.vimeo_videos_upload_complete(@"myvideo.mp4", t.id);

      In an unrelated note, A couple of days ago I tried uploading a video in chunks, and the transcoded video on vimeo was corrupt. If you have this problem too after the transcode, tell me. ;)

  18. Hi Saeed

    For some reason, I cannot upload in chunks, because after a couple of consecutive calls, I get a “Operation timed out”. I tried several options (ConnectionLimits, Keepalive true and false, …). I now have a file of 625 chunks (each a megabyte I guess), and sometimes I get to 30 chunks uploaded, sometimes only 5.

    I found that, uploading in one whole chunk, and setting the ReadWriteTimeOut and the TimeOut on the request to int.MaxValue, the upload succeeds in one request. However, the concept of uploading in chunks seems more appealing.

    Could you enlighten me on how I can solve the issue with uploading in chunks?

  19. I also found that, in PostVideo method, a request is made with the ticket endpoint. However, there is a variable called url which is declared using the ticket’s endpoint.
    It seems to me that the webrequest should be made with the url variable, instead of the ticket.endpoint. When using the ticket’s endpoint, the “chunk_id” would be added multipled times (chunk_id=0&chunk_id=1&chunk_id=2, etc). Additionally, the ‘ticket.Endpoint += “&chunk_id=” chunkid.tostring()’ seems to be obsolete to me.

    Although this seems to be ‘a’ problem, it doesn’t seem to be ‘the’ problem to uploading in chunks (as mentioned above).

    Another thing: if I start Fiddler, before starting my appliciation, I do seem to manage to upload more chunks (however, not all of them). In my comment above, I stated that I have 625 chunks. Without fiddler, the max uploaded chunks was about 15. With fiddler however, the uploading stopped at 85 chunks. For some reason, the applications seems to run out of connections.

    • About the ‘ticket.Endpoint +=’ problem: It seems that you are using an old version of VimeoDotNet. Try downloading the latest version of the source code.

      I don’t really know what’s up with the timeouts, I don’t seem to get any of these errors. Can you email me your code and the debug output (using the latest version of VimeoDotNet)?

  20. So here’s what I did to ‘solve’ this issue (although for me it seems to be a workaround):

    After a few consecutive requests, I got an “Operation Timed out” exception. So I thought, maybe I could retry?
    I set the ReadWriteTimeOut and the TimeOut of the request to 5 seconds (5000ms). The PostVideo method should be able to be called multiple times (if necessary), but with a maximum amount of times. So, I created a method to allow an action to be called. If the action fails, the exception is caught and discarded. However, when a maximum amount of tries is reached, the exception is thrown.
    The PostVideo method is used within this method, and in my code, with a maximum of 5 retries.

    It seems that, for 100 chunks to be uploaded, I have 120 calls (so, in average, 10 chunks out of 100 must be called twice).

    So in short: if the call fails, call it again, and it’ll work :)

    • The solution is posting the chunks, call verify to find the missing chunks, post the missing chunks, verify again, post again, and keep doing this until all chunks are successfully uploaded.

  21. This has been very helpful – thanks so much for your hard work.

  22. Hello. I encountered a problem.When video is uploaded complete i open vimeo.com and want play uploaded video, but video dont play, it write “there was a problem loading this video”.

  23. static VimeoDotNetHelper()
    {
    client = new Vimeo.API.VimeoClient(app_key, app_secret);
    bool isLogin = client.Login(user_token, user_secret);

    }

    return await TaskEx.Run(() =>
    {
    try
    {
    string res = client.Upload(fileName);
    Vimeo.API.VimeoClient.vimeo_videos_upload_getQuotaResponse qresp = new VimeoClient.vimeo_videos_upload_getQuotaResponse();
    var quota = client.vimeo_videos_upload_getQuota();
    Ticket ticket = client.vimeo_videos_upload_getTicket(res);
    Chunks ch = client.vimeo_videos_upload_verifyChunks(ticket.id);
    string complete = client.vimeo_videos_upload_complete(fileName, ticket.id);
    return “https://vimeo.com/” + res;
    }
    catch (Exception ex)
    {
    LogoHelper.WriteLog(ex);
    return “”;
    }
    });
    i have vimeo plus accaunt.

  24. If i upload file throuth vimeo.com the video is palaing normally, but if i upload with VimeoApi it’s not work…

    • You are using the all-in-one method Upload(), so there’s no need to follow any of the upload steps. Remove all other lines, your code should be like this:

      string res = client.Upload(fileName);
      return “https://vimeo.com/” + res;

      or if the video file is too big to fit entirely in memory, your code can be like this:

      string res = client.UploadInChunks(fileName);
      return “https://vimeo.com/” + res;

      these methods handle all the upload steps and return the final video id on vimeo if the operation is successful.

      What your code does right now is:
      1. It uploads the file fine, and gets the video ID (using the all in one method)
      2. it gets another ticket and tries to Replace the video you have just uploaded
      3. It uploads nothing and tells vimeo to finish the process, hence ruining the video.

  25. string res = client.Upload(fileName);
    return “https://vimeo.com/” + res;

    Now i see next:
    great things are about to happen – your video will start converting shortly
    but conversion does not start.
    may by i need call
    string complete = client.vimeo_videos_upload_complete(fileName, ticket.id);
    ?

  26. it happened. thank you.
    I have more questions:
    1) Can i Cancel uploading process?
    2) i need ProgersBar. Can I get a percentage of upload?

    • Yes you can do both, but you have to use the regular uploading steps: 1. get a ticket 2. post video chunks 3. verify 4. complete

      read the upload tutorials in my blog (you can find them from the menu on top of my blog). also the VDNUploader sample in the project and Vimeo for Windows Advanced Uploader can be good references for learning the steps.

  27. I have new problem. i upload some file(1.76 Mb) and get two parts at a rate of 1 Mb and what is left(~0.7 Mb). In Vimeo upload only first chunk. in varifcation method i have mismatch between the two bytes
    if (item.size == ApiKeyForm.vc.GetChunkSize(size, item.id, TicketForm.ChunkSize))
    so the chank again add to list and sey me “There are still (AllChank) chunks left.\nAre you sure you want to complete the upload?”

    my code:
    Ticket ticket = client.vimeo_videos_upload_getTicket();
    FileInfo fi = new FileInfo(fileName);
    long size = fi.Length;
    int resSize= (int)size / 20;
    int chankCount = client.GetChunksCount(fileName);
    Queue chankQueue = new Queue();
    for (int i = 0; i 0)
    {
    try
    {
    int id = chankQueue.Dequeue();
    client.PostVideo(ticket, id, fileName);
    }
    catch
    {

    }
    }
    var vc = client.vimeo_videos_upload_verifyChunks(ticket.id);
    if (vc != null)
    {
    foreach (var item in vc.Items)
    {
    if (item.size != client.GetChunkSize(size, item.id))
    client.PostVideo(ticket, item.id, fileName);
    }
    }

    • I’m not sure what your problem is, I have uploaded several videos with different methods during the past few weeks to check for problems and they all uploaded fine.

      in your code you are trying to dequeue an empty queue and your for loop is all wrong, it shouldn’t even compile! for (int i = 0; i 0)

      • Im thory. it’s my copy-paste trable:
        return await TaskEx.Run(() =>
        {
        try
        {
        Ticket ticket = client.vimeo_videos_upload_getTicket();
        int chankCount = client.GetChunksCount(fileName);
        Queue chankQueue = new Queue();
        for (int i = 0; i 0)
        {
        try
        {
        int id = chankQueue.Dequeue();
        client.PostVideo(ticket, id, fileName);
        // var vcc = client.vimeo_videos_upload_verifyChunks(ticket.id);
        }
        catch
        {
        }
        }
        var vc = client.vimeo_videos_upload_verifyChunks(ticket.id);
        if (vc != null)
        {
        foreach (var item in vc.Items)
        {
        if (item.size – 2 != client.GetChunkSize(size, item.id))
        client.PostVideo(ticket, item.id, fileName);//return two bytes greater
        }
        }
        return “https://vimeo.com/” + client.vimeo_videos_upload_complete(fileName, ticket.id);
        }
        catch (Exception ex)
        {

        LogoHelper.WriteLog(ex);
        return “”;
        }
        });

      • ” for (int i = 0; i 0)
        { }” don’t write(((

      • can you write me your mail?not all of the code is displayed…

      • saeed a-t saeedoo d-o-t com

  28. In your application, this problem too.

  29. So, have you noticed any changes in the Vimeo API recently? I see that they are returning a DECIMAL for the duration in the .getInfo call. You (and I, as I use your stuff) have duration as an INT, using Int.Parse() to get the value. Well, guess what, that doesn’t work when the duration is 462.33

    Did you run into that issue?

  30. Hi, firstly, thank you for all of them.. I have a stupid problem.. I dont know how to get verifier code.. When I create my developer account in vimeo, I wrote google.com as Callback URL. After I call string url = vc.GenerateAuthorizationUrl(); this function and I open link and I click “allow” in vimeo, after that it redirects google.com .. I dont know how to get verifier code or which page I must change it. I think that I make a small mistake but I dont know where is it..

    thank you

    • And my second question (I wrote access token manually) When I want to upload a video, It occours error getting ticket. Is it about update access? Because I have just requested

      Upload Access

      Requested – Pending decision.
      You should receive a decision within 3 business days of your request.

      If its not about that, where can be problem? Sorry I am really new on it

      thank you

    • Hi, VimeoDotNet is designed for desktop applications that don’t care about the callback URL, if you want to use the callback URL you should modify the code a little bit.

      That being said, you have specified a wrong callback URL when you were registering the application. Go to the Vimeo Developers page, find your application, and change the callback URL.

  31. :) I was thinking that callback url is compulsory.. I removed it and It has been solved. Thak you very very much for everything ! :)

  32. Hi Saeed, I want to search video in vimeo with you library. But I am not sure that is possible.. Could you show me how can I do it? I will type a keyword and I want library to sends me list of videos which matches my criteria.

    thank yoy

  33. Hi Saeed,

    My source code is like;
    protected void Page_Load(object sender, EventArgs e)
    {
    var vc = new Vimeo.API.VimeoClient(“3aa0af40ed92c1d4064b1xxxxxxxxxxxxxxxxxx”, “36a4154cce6eb38e7xxxxxxxxxxxxxxxxxxxx”, “delete”);
    vc.GetUnauthorizedRequestToken();
    string url = vc.GenerateAuthorizationUrl();
    vc.GetAccessToken(“coxxxxxxx-qoxxx”);
    vc.Login();
    if (vc.Login(“3544a1ff87xxxxxxxxxxxxxxxxxxxxxxx”, “e68c22c285be02349xxxxxxxxxxxxxxxxxxxxx”))
    {
    //start application
    }

    }

    I opened url then click ‘allow’ and now i have a verifier but i can’t arrive this page.How can I arrive this page?

    http://afsharious.files.wordpress.com/2011/08/vfw_auth3.jpg?w=552&h=275

    Also I wrote https://vimeo.com/user12374770 for app url on edit page.Is this true? or should I write another url ?

    Thanks in advance

    • Did you write https://vimeo.com/user12374770 for the callback URL? If so, that’s wrong. You should delete that or set it to your (web) application’s auth page.

      That picture is not a page, it’s a form in Vimeo for Windows. It’s not included in the VimeoDotNet library. I don’t understand what is your problem when you have the verifier code?

  34. Hİ saeed

    I want to show my videos on my page.My source code is like;

    dlYanMenu.DataSource = vc.vimeo_videos_getAll(“12374770″, true, Vimeo.API.VimeoClient.VideosSortMethod.Default,1,3);

    dlYanMenu.DataBind();

    But I show this error message;

    DataBinding: ‘Vimeo.API.Video’ does not contain a property with the name ‘id’

    How can I solve this problem

    Thanks in advance

    • You can’t bind a videos object to your UI, you have to create your own data structure. Also I don’t think you would even want to bind an entire videos object because it contains a lot of information.

  35. Hi, first of all i like to thanks you for such a wonderful library. I used it and manage to upload video on vimeo. After that i am storing video information in my local database for mapping purpose. but after uploading when i call getinfo method to get the uploaded video information i am getting video duration 0 as vimeo is doing some post uploaded process. so can you guide me how to get duration after upload. I am using ASP.net MVC/C#

    • Thanks! Unfortunately that is the value the Vimeo API gives us and I have no control over it. Though, it is logical for the API to return 0 for the duration before encoding the video, since the video must be processed first in order to find out its duration.

      Anyway, there’s nothing I can do to fix this problem, but you can post it in Vimeo API forums (vimeo.com/forums/api/) to see if there’s a workaround.

      Of course since you have the file locally, you can easily use some Win32 APIs or DirectX or some other tool to get the duration of the file. Here’s an example:
      http://www.codeproject.com/Articles/43208/How-to-get-the-length-duration-of-a-media-File-in

  36. Hi Thanks for reply. I have another question. In your API you used setPrivacy for Advance API. but how to set privacy for domain specific? ex. allow video to be access by specific domain such as domain1. there is one method in vimeo, “videos.embed.setPrivacy” which can be used to set domain specific privacy, but i did not find any relevant method in your API. So does this mean that it is not possible from Advance API?

  37. Hi saeed

    I have two account(basic and plus) and i use this method;

    vc.vimeo_albums_getAll(userid, Vimeo.API.VimeoClient.AlbumsSortMethods.Alphabetical, 1, null)

    I can use this method on basic account but i can’t on plus account.I met a error ;

    Line 44: public static Album FromElement(XElement e)
    Line 45: {
    Line 46: return new Album
    Line 47: {
    Line 48: id = e.Attribute(“id”).Value,

    I can’t understand.What is the difference between plus and basic account.

    Thanks in advance.

    • I just have a basic account so I can’t test the code on plus or pro accounts. You can either get me a plus account if you want me to fix the problem, or you can look at the code and fix it yourself.

    • @frhtngn: I came here looking for a solution to the same issue. Not finding one I debugged the code. For me, it was dying here because I hadn’t assigned a video to this particular album and it, thus, did not have a thumbnail so it was dying on the portion of code within the Album class where it builds the object on the fly…since thumbnail information was not present in the XML/JSON, it was attempting to reference properties of a null XElement object.

      Hope this helps (though it’s been quite a few months since your post). I don’t see a lot of need, for my implementation, to pay attention to albums that do not have videos in them so I will likely take it a few steps back into my code and not even try to get Album info for anything that does not (if possible).

  38. Hi Saeed,

    I am using free account of vimeo and trying to upload the video’s from my application over vimeo. But first, incoming user need to authenticate my application on vimeo and then i can get user detail or can do various things. Now, once user has been authenticated my application and I got the “oauth_verifier” for user, I don’t want to show that Authenticate VIMEO screen to user. I can store essential information in database which i required in database and use those to login the user automatically to VIMEO. But I am getting NULL object. Here’s I code, I am using :

    VimeoClient oVimeoClient = new VimeoClient(“CKey”, “CSecert”);
    oVimeoClient.GetAccessToken(“AccessTokenGotFromCallBackURLPage”);
    oVimeoClient.Login();

    Is there’s anything i skipped in code? Basically I don’t want the user to login again on vimeo and authenticate application once it done.

    Thanks,
    Ravi Joshi
    ravijoshi21@gmail.com

  39. Thanks Saeed, Got the solution.

  40. hi , i need vimeo uploading videos asp.net c# .but i have vimeo login details. could u give me some help.

  41. Saeed Afshari ,
    how to get verifier from vimeo upload ?

    GetAccessToken(string verifier)

    verifier?

  42. saeed,
    i got verifier code. thanks for your comments.

  43. saeed ,
    i used file upload to form post method via ajax.

    and also page load function code:

    Vimeo.API.VimeoClient vimeo = new Vimeo.API.VimeoClient(“xxxxxxxxxxxxxxxx”, “xxxxxxxxxxxxxx”, “write”);
    vimeo.GetUnauthorizedRequestToken();
    var url = vimeo.GenerateAuthorizationUrl();
    vimeo.GetAccessToken(“xxxxxxxx”);
    vimeo.Login(“xxxxxxxxxxxxxxx”, “xxxxxxxxxxxxxx”);
    html:

    Upload

    then,

    1.Check the quota:
    2.Get a ticket:
    3.Send the video data:
    4.Verify the transfer:
    5.Complete the upload:
    these are steps. three steps completed. last 5 th step how to call……..?

    code:
    var endpoint= xxxx; //end point session value
    $.ajax_upload(button, {
    action: endpoint,
    onSubmit: function (file, ext) {
    //checking file extension

    onComplete: function (file, response) {
    alert(“File”+file+”Response”+response);

    i got upload file.mp4 from file variable oncomplete function.

    now how to call complete the method ? Please help?

    • Have you read this guide?

      Basically if you don’t need to do any advanced stuff and your only goal is to upload the video file in one pass, there is the all-in-one method Upload that solves your problem:

      vimeo.Upload(@”D:\video.mp4”);

      Otherwise, to answer your question, you “complete” the upload process you need to call this method:

      vimeo.vimeo_videos_upload_complete(ticket);

  44. saeed,

    yes, i red your notes, you did vimeo upload, first save as file to server folder at D:\video.mp4 (method File.saveas(filepath) and then upload file from D:\video.mp4 to vimeo server.

    but my requirement , we need upload file directly to vimeo server. ( don’t save server path :D:\video.mp4)
    ( i did form post method html , this method upload succesfully, but i couldnot get video id)

    please help ?

  45. HI,

    I compiled the project. Registered an app on vimeo.

    Entered the token credentials. But I keep getting the message ‘invalid token’.

    Can anyone help”?

    Thanks in advance.

  46. Hi Saeed!

    Thank you for the great effort on this library. However I think something is broken. I am not able to get an accesstoken when authorizing a user. I use the same steps as you describe in the authorization process, but when getting the access token with the verification code, the token and tokensecret is null/empty.

    If you could take a quick look at this gist, I would be much obliged.

  47. Wow, quick response! I like! :)

    I tried removing it, using the default value “delete”, but still no change.

    Are you sure the authorization part is still working? Maybe vimeo changed something?

    • I’m not sure; could you tell me the values in each step of your program? (By step I mean before any VimeoDotNet function calls :) )

      Or try logging in with the example included with the project on CodePlex and see if it works; because I myself downloaded the uploader yesterday and used it and it worked :)

      [Update: There *might* be something wrong with VimeoDotNet because I just saw another comment saying that they get invalid token, though I highly doubt it because I used the *same thing* yesterday! I'll try to take a look at it myself later today.]

      • Ok, cause I can’t figure out the problem :p

        I have included the logs from the debug window (your logging), as DetailedLogging.

        I also created a testapp on vimeo, and updated the gist with the real keys, tokens & secrets.

        When I try to get the accesstoken, I get the response Unauthorized.

        And when I try to use api.Login(“token”, “secret”), I get the repsonse “bad oAuth signature” or something.

        Thanks for the quick answers and the dedication :) Let me know if you need something :)

      • You’re welcome!

        This is very strange. I’ll take a look at later today and will tell you the results.

      • Now I am able to authenticate & log in! :) It seems that vimeo just took some time to register the app or something, since I got a unauthorized response from vimeo.

        Appreciate your time :)

      • Haha, Cool! I was beginning to wonder what kind of sorcery is this that I could connect using the exact same code :D

  48. Hi Saeed,

    Is there a way to get all items from My Portfolio page in Vimeo. I can get all videos uploaded by a user but did not find a function to get all portfolios. I am not sure if I should call them portfolios or channels or albums. I tried with vimeo_channels_getAll() and vimeo_albums_getAll() but not get anything. I would really appreciate any help.Thanks!

  49. Hi Trying to create an album using the API – IS Video ID mandatory? What happens if iam a new user and have no video yet ?

  50. The type or namespace name ‘Ticket’ could not be found (are you missing a using directive or an assembly reference?)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 96 other followers

%d bloggers like this: