youtube api上传不起作用

时间:2013-05-14 04:03:11

标签: youtube-api

我在上传mp4文件时遇到问题。它应该很简单,但每次都会失败。如果我通过浏览器手动上传它可以正常工作。在示例后使用google api失败。

settings = new YouTubeRequestSettings(_ProductName, _DeveloperKey, _LoginName, _LoginPassword);
request = new YouTubeRequest(settings);

video = new Video();



video.Title = "My Test Movie";
video.Tags.Add(new MediaCategory("Autos", YouTubeNameTable.CategorySchema));
video.Keywords = "cars, funny";
video.Description = "My description";
video.YouTubeEntry.Private = false;
video.Tags.Add(new MediaCategory("mydevtag, anotherdevtag", YouTubeNameTable.DeveloperTagSchema));
video.YouTubeEntry.MediaSource = new MediaFileSource(@"C:\MyFolder\example.mp4", "video/mp4");
videoUpload = request.Upload(video);
if (videoUpload == null)
    result = false;
else

它总是导致异常错误:

Cannot close stream until all bytes are written.
The request was aborted: The request was canceled.

该文件显示在youtube上,但出现错误:

Failed (unable to convert video file).  

问题是,如果我通过浏览器手动上传相同的文件,它可以正常工作。

有什么想法吗?

0 个答案:

没有答案