1

我在上传 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).  

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

有任何想法吗?

4

0 回答 0