我正在尝试使用 C# 将视频上传到 Youtube。它确实适用于非常小的视频,但对于较大的视频,上传每次都会中止。那是我的代码:
public void VideoAPIUpload(Video video)
{
YouTubeRequestSettings settings = new YouTubeRequestSettings("example app", "AI39si4mUhdQfat8Dsd54qDjKSXYYnYxTaIX5PNurJetTvcAPagRvbSSR2o5xDH_obI4TEDvNieOhHEUmD9_cw0qPD51zj_wpA", "Minecraftexpertenerten@gmail.com", "mutter123") { Timeout = -1 }; ;
settings.Maximum = -1;
YouTubeRequest request = new YouTubeRequest(settings);
Google.YouTube.Video newVideo = new Google.YouTube.Video();
newVideo.Title = video.title;
newVideo.Tags.Add(new MediaCategory("Autos", YouTubeNameTable.CategorySchema));
newVideo.Keywords = video.tags;
newVideo.Description = video.description;
newVideo.YouTubeEntry.Private = false;
newVideo.Tags.Add(new MediaCategory("mydevtag, anotherdevtag",
YouTubeNameTable.DeveloperTagSchema));
// alternatively, you could just specify a descriptive string
// newVideo.YouTubeEntry.setYouTubeExtension("location", "Mountain View, CA");
newVideo.YouTubeEntry.MediaSource = new MediaFileSource("funny_video.flv",
"video/x-flv");
Google.YouTube.Video createdVideo = request.Upload(newVideo);
}