0

using the Google.YouTube.YouTubeRequest.Upload(Video v) api call then I get:

GDataRequestException with a response string "Metadata part is too large".

This direct upload call works on my personal development machine, but I get that exception on our QA machine.

any ideas?

EDIT here is the code: so the only metadata that is added is title,description and tags (same metadata on both machines and same video).

           public void Add(InternalVideo video)
           {
           var youtubeVideo = ConvertVideo(video);
               var v = _request.Upload(youtubeVideo);
            }
    private Video ConvertVideo(InternalVideo video)
    {
        var youTubeVideo = new Video();

        youTubeVideo.Title = video.Title;
        youTubeVideo.Description = video.Description;
        AddTags(video, youTubeVideo);

        string contentType = MediaFileSource.GetContentTypeForFileName(video.URL);
        byte[] imageData = DownloadData(video.URL);
        File.WriteAllBytes(_tempVideoFileName, imageData);

        youTubeVideo.MediaSource = new MediaFileSource(_tempVideoFileName, contentType);
        var link = new AtomLink("http://uploads.gdata.youtube.com/resumable/feeds/api/users/default/uploads");
        link.Rel = ResumableUploader.CreateMediaRelation;
        youTubeVideo.YouTubeEntry.Links.Add(link);
        youTubeVideo.Private = false;

        return youTubeVideo;

}

    private void AddTags(InternalVideo video, Video youTubeVideo)
    {
        var category = video.Client.ClientSyndicationProviders[0].SyndicationProvider.Category;
        youTubeVideo.Tags.Clear();
        youTubeVideo.Tags.Add(new MediaCategory(category, YouTubeNameTable.CategorySchema));
        youTubeVideo.Keywords = video.Tags;
    }

EDIT 2: This code works: _resumableUploader = new ResumableUploader(25); WebResponse r = _resumableUploader.Insert(_youTubeAuthenticator, youtubeVideo.YouTubeEntry);

I'm not sure why I had to use the resumeable uploader to make this work. The only difference between machines is that that the QA machine is windows server 2003 R2, while the development machine is a windows 7 professional.

4

2 回答 2

0

为我工作......我添加了 HKEY_CLASSES_ROOT .flv 和 .mp4,然后我在 IIS 中回收了应用程序池并工作了!谢谢

于 2014-01-09T05:24:07.500 回答
0

我遇到了同样的问题(win 7 pro 和 server 2008)并且得到了同样的无用错误信息。在将 GoogleApi\core\mediaservice.cs、EntrySend 函数中的 outputStream 的内容写入本地机器和服务器上的日志文件后,我终于弄明白了。我没有在服务器上注册我尝试上传的 mp4 文件类型。一旦我在服务器上注册了文件类型,它就可以工作了。

如果其他人需要这样做,只需在您的客户端上的 HKEY_CLASSES_ROOT 下找到文件扩展名密钥,然后右键单击它并单击导出。然后将创建的 .reg 文件移动到您的服务器并双击它以获取添加到您的服务器的值。我还在 IIS 中的 MIME 类型中添加了文件类型,但我认为这不是必需的,并且在安装注册表项之前,我还在 IIS 中回收了我的应用程序池,然后再次测试它。

于 2013-02-28T21:02:27.637 回答