Menu

#339 Error when trying to upload video

open
nobody
None
2020-03-13
2019-12-08
Anonymous
No

Originally created by: xerz-one

Trying to upload a video results in failure. Using the following code:

StatusUpdate tweet = new StatusUpdate("some text");
tweet.setMedia(video);
twitter.updateStatus(tweet);

where video is a File variable, returns the following error:

SEVERE: null
403:The request is understood, but it has been refused. An accompanying error message will explain why. This code is used when requests are being denied due to update limits (https://support.twitter.com/articles/15364-about-twitter-limits-update-api-dm-and-following).
message - Error creating status.
code - 189

Relevant discussions can be found on the Internet at:
    http://www.google.co.jp/search?q=2fc5b7cb or
    http://www.google.co.jp/search?q=10c2a80b
TwitterException{exceptionCode=[2fc5b7cb-10c2a80b], statusCode=403, message=Error creating status., code=189, retryAfter=-1, rateLimitStatus=null, version=4.0.7}

The issue is not reproducible with images, only with videos (tested MP4+H.264 only), regardless of whenever they had an audio track, their size or length.

Discussion

  • Anonymous

    Anonymous - 2020-01-15

    Originally posted by: diekuehlung

    The video you are trying to upload is to big.

    Choose a video file stored on your computer and click Open. You’ll be prompted if the video isn’t in a supported format. Maximum file size is 512MB for TweetVideo, but you are able to upload a video longer than 2 minutes and 20 seconds, and trim it before including the video in a Tweet

    Source: https://help.twitter.com/en/using-twitter/twitter-videos

     
  • Anonymous

    Anonymous - 2020-01-15

    Originally posted by: xerz-one

    I can grant you, a trivially small video (I'm talking 1MB or less) would still not do it.

     
  • Anonymous

    Anonymous - 2020-03-13

    Originally posted by: thatshawt

    Use StatusUpdate.setMediaIds(long... mediaIds) instead of StatusUpdate.setMedia(File file)

    File file = new File("coolVideo.mp4");
    StatusUpdate status = new StatusUpdate("Insert cool tweet here");
    UploadedMedia media = null;
    
    if(file.length() > 1000000){//did this because for files above 1mb you need to use chunked uploading
        media = twitter.uploadMediaChunked(file.getName(), new BufferedInputStream(new FileInputStream(file)));
    }else{
        media = twitter.uploadMedia(file);
    }
    
    if(media != null)
        status.setMediaIds(media.getMediaId());//use this instead of tweet.setMedia(video);
    twitter.updateStatus(status);
    
     

Log in to post a comment.