hoangduit / google-gdata

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

Upload Error: Cannot close stream until all bytes are written. #364

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Upload any FLV to YouTube using the DirectUpload method in the API in a 
C# Desktop Application.

What is the expected output? What do you see instead?
Expected Output: Flv file successfully uploaded to YouTube.
Instead I see: An Error -
((System.Net.WebException)(ex))

{"The request was aborted: The request was canceled."}
Inner Exception :{"Cannot close stream until all bytes are written."}

What version of the product are you using? On what operating system?
I using Windows 7, Visual Studio 2008, C#.
I am using the YouTube SDK; it was uploaded on Feb 15; it has no version, 
but is the latest because I downloaded it a week ago.

Please provide any additional information below.
I am using the code below:
            Video newVideo = new Video();
            newVideo.Title = Title;
            newVideo.Tags.Add(new MediaCategory
(cboCatrgories.SelectedItem.ToString(), YouTubeNameTable.CategorySchema));
            newVideo.Keywords = tags;
            newVideo.Description = Description;
            newVideo.YouTubeEntry.Private = false;
            newVideo.YouTubeEntry.MediaSource = new MediaFileSource
(FilePath,
              "video/x-flv");
            Video createdVideo = YouTubeLogin.Upload(newVideo);

The source of the problem seems to be in the API, not in the code above.  
I this its the part when the file is being sent to YouTube server, in a 
loop.

Original issue reported on code.google.com by pathachiever11 on 4 Apr 2010 at 11:20

GoogleCodeExporter commented 9 years ago
What is the timeout settings for your request and is it possible that the 
upload just
takes longer than the timeout? (that is the most common problem here - the 
default
timeout is i think 100sek (pending version of .NET) and if the upload takes 
longer,
boom). 

If you don't mind, you better use the new ResumableUpload component. 

Original comment by fman...@gmail.com on 7 Apr 2010 at 4:02

GoogleCodeExporter commented 9 years ago
I've tried changing the timeout setting to big numbers.  Still, I get the 
error.  I 
am just uploading a 19 MB flv video, not big at all.

Can you elaborate more on the "ResumableUpload"?  I am sorry, but I am not 
familiar 
with it.

Thanks.

Original comment by pathachiever11 on 8 Apr 2010 at 12:30

GoogleCodeExporter commented 9 years ago
YouTube recently introduced a resumable upload service, which by default allows 
you
to chunk your uploads. The .NET library has a ResumableUpload Component and a 
long,
extensive sample (The YouTubeContentUploader). 

I will probably not spend much time in fixing direct upload (i can easily see 
that
there is a bug in that codepath in the .net client), as i see that to be a 
relict of
the past, as long as you don't tell me: hey, i really can't use the 
ResumableUpload
feature for this and that reason...

Original comment by fman...@gmail.com on 8 Apr 2010 at 10:54

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Thanks.  I found the sample and it looks pretty easy.

Original comment by pathachiever11 on 9 Apr 2010 at 3:46

GoogleCodeExporter commented 9 years ago

Original comment by fman...@gmail.com on 6 May 2010 at 2:35