Search code examples
c#twittertweetsharp

Post videos to twitter


I got success to post photos to Twitter. But how do i post videos to Twitter using my C# application?. For posting pictures i used Tweetsharp. Can we use Tweetsharp's SendTweetWithMediaOptions to share video? if yes How?

This is sample i used to share picture to twitter

  Bitmap img = new Bitmap(Server.MapPath(@"~/Images/Special/" + Convert.ToInt32(offerId) + "/" + specialOffer.Picture));
            MemoryStream ms = new MemoryStream();
            img.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
            ms.Seek(0, SeekOrigin.Begin);
            Dictionary<string, Stream> images = new Dictionary<string, Stream> { { "mypicture", ms } };

            var tweet = tweetservice.SendTweetWithMedia(new SendTweetWithMediaOptions { Status = urlTextToShare, Images = images });

and what i need is something like below image

enter image description here


Solution

  • You cannot upload videos to Twitter. If you read their documentation, it says:

    Supported image formats are PNG, JPG and GIF, including animated GIFs of up to 3MB

    You choices are either to upload an animated GIF or include a URL to a video (such as YouTube / Vimeo)