3

Im using Tweetinvi and can upload files < 15MB without problem. however over that it fails, even though the Twitter API official docs state "File size should not exceed 15 mb (sync) / 512 mb (async)". I had assumed Tweetinvi would be using async logic and therefore should work, but seems not.

Any ideas if Im doing anything wrong or simply if Tweetinvi doesnt allow this.

Thanks in advance.

Linvi
  • 2,077
  • 1
  • 14
  • 28
Doug Rees
  • 29
  • 3

2 Answers2

1

I am the developer of Tweetinvi.

When the upload was implemented, the async was not part of the REST API. But as I can read, this seems to be dependent on the media_category.

Please try to set the media_category to amplify_video as followed.

var binary = File.ReadAllBytes("filepath");
var media = Upload.UploadVideo(binary, mediaCategory: "amplify_video");

Then use the Upload.GetMediaStatus to know when the upload has successfully completed.

var status = Upload.GetMediaStatus(media);

if (status.ProcessingInfo.State == "succeeded")
{
    // You can now publish your tweet
}

Documentation : https://github.com/linvi/tweetinvi/wiki/Upload#upload-status-video

Please note that Upload will be slightly improved in the next release of Tweetinvi (1.2).

Regardless of whether this solution works or not please let me know so that I can investigate and fix any potential bug or update the documentation.

Thanks

Linvi
  • 2,077
  • 1
  • 14
  • 28
0

OK this is my bad. Im really sorry but it appears someone had revoked my API permissions without telling me, but for some reason I wasnt getting the relevant error when I called the upload. It was only when i tried to do a simple Tweetinvi.Account.GetCurrentAccountSettings that i got the relevant error that helped me track it down.

Doug Rees
  • 29
  • 3
  • Could you please provide more information regarding the media_category you are using? Also, could you please let me know if I can close the twittercommunity ticket? If this question is closed please mark it as resolved ;) – Linvi Oct 19 '16 at 09:09
  • It is resolved. Your code works fine. It was related to someone remove my app's credentials in twitter... – Doug Rees Oct 21 '16 at 10:35