我想使用C#Winform將視頻上傳到youtube,而且我總是得到「Invalid credentials」異常。使用C#winform將視頻上傳到YouTube「無效的憑據」異常
- 我正在使用我的Gmail帳戶的用戶名和密碼:這可以嗎?
- 應用程序名稱 - 它可以是任何東西?或者我需要在某處註冊?
- 我在http://code.google.com/apis/youtube/dashboard中創建了一個開發人員密鑰,我是否需要執行更多激活才能使此代碼有效?
這是我的代碼:
YouTubeRequestSettings settings;
YouTubeRequest request;
string devkey = "My DEV KEY";
string username = "MY GAMIL MAIL";
string password = "MY GAMIL PASSWORD";
settings = new YouTubeRequestSettings("SOME APPLICATION", devkey, username, password) { Timeout = -1 };
request = new YouTubeRequest(settings);
Video newVideo = new Video();
newVideo.Title = Title;
newVideo.Description = Description;
newVideo.Private = true;
newVideo.YouTubeEntry.Private = false;
newVideo.YouTubeEntry.MediaSource = new MediaFileSource(FilePath, "video/mp4");
Video createdVideo = request.Upload(newVideo);
return createdVideo.VideoId;