I am using Async ResumableUpload to upload videos to YouTube however I have not been able to retrieve the VideoID for the successfully uploaded video. This was very easy for the single Sync uploads but I have been unable to find any examples for the Async.
Here's the code:
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");
Any help will be much appreciated.
Thanks.
As shown on google data provided samples you can parse the video after the upload process is completed. Regards
ru.AsyncOperationCompleted += new AsyncOperationCompletedEventHandler(ru_AsyncOperationCompleted);
void ru_AsyncOperationCompleted(object sender, AsyncOperationCompletedEventArgs e)
{
//upload complete
YouTubeRequestSettings ytSettings = new YouTubeRequestSettings("myApp", googleDevKey, ytUsername, ytPassword);
Video v = ytRequest.ParseVideo(e.ResponseStream);
string videoId = v.VideoId;
string watchPage = v.WatchPage.ToString();
}