title: Best way to upload video on twitter
body: <p>I have to upload video to twitter (post a tweet text with video) from my java application. I use twitter4j to upload images and it works perfectly. I'm confused about the best way to upload video. I have found in this link <a href="https://github.com/mrisney/twitter-java-ads-sdk/blob/master/src/examples/VideoUploadExample.java" rel="nofollow">https://github.com/mrisney/twitter-java-ads-sdk/blob/master/src/examples/VideoUploadExample.java</a> the code that implements the
  twurl command but I want to know if it's possible to upload video with twitter4j
  like I have done for the image? Or have I to use the twurl way to do it? 
  And is there any possibility to post video directely on twitter? </p>
  
  <p>This is what I do for the image upload </p>
  
  <pre><code>     `  Twitter twitter = new TwitterFactory().getInstance();
          twitter.setOAuthConsumer(consumerKey, consumerSecret);
          AccessToken accessToken = new AccessToken(accessTokenStr,
                  accessTokenSecret);
          twitter.setOAuthAccessToken(accessToken);
          StatusUpdate statusUpdate = new StatusUpdate(text);
          statusUpdate.setMedia("New pic", new URL(photo).openStream());
          twitter.updateStatus(statusUpdate.inReplyToStatusId(tweetId));` 
  </code></pre>
  
  <p>Thanks</p>