2015-06-30 57 views
0

我正在使用TweetInvi在Twitter上发布视频。用Tweetinvi上传视频

TwitterCredentials.SetCredentials(token.Token,token.TokenSecret,ConfigurationManager.AppSettings["ConsumerKey"], ConfigurationManager. AppSettings["ConsumerSecret"]); 

var filePath = string.Format("{0}content\\participant\\video\\{1}.{2}", Request.PhysicalApplicationPath, p.video, "mp4"); 
byte[] file1 =System.IO.File.ReadAllBytes(filePath); 

var tweet = Tweetinvi.Tweet.CreateTweet(message); 
tweet.AddMedia(file1, "video");    
var success = tweet.Publish(); 

Tweet成功发布。但视频文件丢失。 我已使用 tweetinvi twwet with media的代码

在此先感谢。

+0

我用tinytwitter https://github.com/SnapStreamJason/TinyTwitter。视频uplaod工作正常。 –

回答

2

Twitter正在使用新的视频上传机制。 Tweetinvi尚未发布此功能,但它将在Tweetinvi 0.9.8.2中提供,我今天将发布它将包含此特定功能。

在此期间,请按照此link中提供的说明(将该标记作为回答的解决方案)。


更新:

您现在可以使用使用Tweetinvi 0.9.8.2的VideoUploader。不幸的是,的NuGet有一些问题,所以你必须指定对于现在的版本:

安装,包装TweetinviAPI -Version 0.9.8.2

下面是一个代码示例:

var binary = File.ReadAllBytes(@"C:\video.mp4"); 
var media = VideoUploader.UploadVideo(binary); 
var tweet = Tweet.CreateTweet("hello" + Guid.NewGuid()); 
tweet.AddMedia(media); 
var success = tweet.Publish(); 

干杯, Linvi