我正在使用 Async ResumableUpload 将视频上传到 YouTube,但是我无法检索成功上传视频的 VideoID。这对于单个 Sync 上传非常容易,但我一直无法找到 Async 的任何示例。
这是代码:
var mResumableUploader = new ResumableUploader(chunkSize);
mResumableUploader.AsyncOperationCompleted += MResumableUploaderAsyncOperationCompleted;
mResumableUploader.AsyncOperationProgress += MResumableUploaderAsyncOperationProgress;
var youTubeAuthenticator = new ClientLoginAuthenticator(appName, ServiceNames.YouTube, uName, passWord);
youTubeAuthenticator.DeveloperKey = devKey;
newVideo = new Video();
newVideo.Title = "video";
newVideo.Tags.Add(new MediaCategory("Entertainment", YouTubeNameTable.CategorySchema));
newVideo.Keywords = "video";
newVideo.Description = "video";
newVideo.YouTubeEntry.Private = false;
newVideo.YouTubeEntry.MediaSource = new MediaFileSource(fileName, fileContType);
var link = new AtomLink("http://uploads.gdata.youtube.com/resumable/feeds/api/users/default/uploads");
link.Rel = ResumableUploader.CreateMediaRelation;
newVideo.YouTubeEntry.Links.Add(link);
Console.WriteLine("Starting upload: ");
mResumableUploader.InsertAsync(youTubeAuthenticator, newVideo.YouTubeEntry, "inserter");
任何帮助都感激不尽。
谢谢。