Ads Inside Post

Search in This Blog

Youtube upload error while upload video occurred in Google.GData.Client.dll

Problem:

While working with Google.GData.YouTube Api to upload video from your computer system to own youtube account you can get the error as below:

"An unhandled exception of type 'Google.GData.Client.GDataRequestException' occurred in Google.GData.Client.dll"
"Additional information: Execution of request failed: https://uploads.gdata.youtube.com/feeds/api/users/default/uploads"

Solution:

This is occurs when you want to upload large file so set timeout of  YouTubeRequest and YouTubeRequestSettings to high.
Also set the correct MIME-TYPE of your video, otherwise you can get the same error.
for example if you want to upload flv file then it's mime type is "video/x-flv".

Example:


Below is the c# code:

YouTubeRequestSettings ytrs = new YouTubeRequestSettings("applicationName", "Key", "gmailemail@gmail.com", "password");
YouTubeRequest ytr= new YouTubeRequest(ytrs );
((GDataRequestFactory)ytr.Service.RequestFactory).Timeout = 9999999;
ytrs .Timeout = -1;