gauravtyagi2777 / google-gdata

Automatically exported from code.google.com/p/google-gdata
0 stars 0 forks source link

Cannot close stream until all bytes are written. Youtube API - direct upload - C# #472

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hello. i am using the code below for uploading videos

YouTubeRequestSettings settings = new YouTubeRequestSettings("xxxxx",
              "xxxxx-xxxxx",
              "xxxxx", "xxxxx");
            YouTubeRequest request = new YouTubeRequest(settings);

            Video newVideo = new Video();

            newVideo.Title = srTitle;
            newVideo.Tags.Add(new MediaCategory("Games", YouTubeNameTable.CategorySchema));
            newVideo.Keywords = srKeywords;

            newVideo.Description = srDescription;

            newVideo.YouTubeEntry.Private = false;
            newVideo.YouTubeEntry.setYouTubeExtension("location", "Game Trailers HD");

            newVideo.YouTubeEntry.MediaSource = new MediaFileSource(srWhichVideo, "video/quicktime");

            request.Settings.Timeout = 9999999;

            Video createdVideo = request.Upload(newVideo);
            string srVideoUrl = createdVideo.WatchPage.AbsoluteUri.ToString().Replace("&feature=youtube_gdata_player", "");

this code works perfectly at some videos but fails at some. i have to solve the 
problem thank you.

uploaded videos are below 100 mb and have very fast connection

using desktop C# application netframework 4.0 and latest API

Original issue reported on code.google.com by GameTrai...@hotmail.com on 22 Jan 2011 at 3:27

GoogleCodeExporter commented 8 years ago
Is the issue reproducible with a specific video or it fails randomly?
What is the error message you get when it fails?

Original comment by ccherub...@google.com on 22 Jan 2011 at 3:52

GoogleCodeExporter commented 8 years ago
i get this error message :  Cannot close stream until all bytes are written

it is not specific. actually it does not fail at very small videos. generally 
fails at above 10 mb videos. but i checked and it uploaded 25 mb video while 
failed 11 mb video. i checked api page and there is not resumable upload api 
for .net :(

Original comment by GameTrai...@hotmail.com on 22 Jan 2011 at 4:10

GoogleCodeExporter commented 8 years ago
This library implements the Resumable Uploader component and your issue has 
already been discussed other times:

http://code.google.com/p/google-gdata/issues/list?can=1&q=resumable+upload

Have you checked the YouTubeContentUploader?

Original comment by ccherub...@google.com on 22 Jan 2011 at 4:16

GoogleCodeExporter commented 8 years ago
Please also look at http://code.google.com/p/google-gdata/issues/detail?id=431

Original comment by ccherub...@google.com on 22 Jan 2011 at 4:17

GoogleCodeExporter commented 8 years ago
yes discussed but no solution. i checked now and it even uploaded 271 mb file 
but failed at 10 20 mb files. i don't know totaly seems like random.

Original comment by GameTrai...@hotmail.com on 22 Jan 2011 at 12:05

GoogleCodeExporter commented 8 years ago
and i can't find anywhere .net resumable upload library . can you provide me 
link . thank you.

Original comment by GameTrai...@hotmail.com on 22 Jan 2011 at 12:12

GoogleCodeExporter commented 8 years ago
The ResumableUploader class is defined at:

http://code.google.com/p/google-gdata/source/browse/trunk/clients/cs/src/core/re
sumableupload.cs

The YouTubeUploader project is in the Samples solution:

http://code.google.com/p/google-gdata/source/browse/trunk/clients/cs/samples/You
TubeUploader/

Original comment by ccherub...@google.com on 22 Jan 2011 at 5:47

GoogleCodeExporter commented 8 years ago

Original comment by ccherub...@google.com on 1 Feb 2011 at 9:52