如何上传使用C#中的YouTube API在YouYube视频? [英] How can I upload a video to YouYube using the Youtube API in C#?
本文介绍了如何上传使用C#中的YouTube API在YouYube视频?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
下面的代码失败?可能是什么问题?
YouTubeRequestSettings设置=新YouTubeRequestSettings(whatwill来这里?,
我的API钥匙,
我的YouTube登录电子邮件,我的YouTube登录密码);
YouTubeRequest要求=新YouTubeRequest(设置);
视频newVideo =新视频();
newVideo.Title =测试1;
newVideo.Tags.Add(新MediaCategory(游戏,YouTubeNameTable.CategorySchema));
newVideo.Keywords =测试1,测试2;
newVideo.Description =测试3测试4;
newVideo.YouTubeEntry.Private = FALSE;
newVideo.Tags.Add(新MediaCategory(标签1,标签2,
YouTubeNameTable.DeveloperTagSchema));
newVideo.YouTubeEntry.Location =新GeoRssWhere(37,-122);
newVideo.YouTubeEntry.MediaSource =新MediaFileSource(C:\\test.avi,视频/ QuickTime的);
。视频createdVideo = request.Upload(newVideo);
我解决了这个问题。这是我的类别:该类别必须的游戏的代替的游戏的
解决方案
问题是你的游戏的范畴。修改你的 MediaCategory
构造函数如下:
newVideo.Tags.Add (新MediaCategory(游戏,YouTubeNameTable.CategorySchema));
和它应该为你工作。
The code below fails? What might be the problem?
YouTubeRequestSettings settings = new YouTubeRequestSettings("whatwill come here ?",
"my api key",
"my youtube login email", "my youtube login password");
YouTubeRequest request = new YouTubeRequest(settings);
Video newVideo = new Video();
newVideo.Title = "test 1";
newVideo.Tags.Add(new MediaCategory("Gaming", YouTubeNameTable.CategorySchema));
newVideo.Keywords = "test 1 , test 2";
newVideo.Description = "test 3 test 4";
newVideo.YouTubeEntry.Private = false;
newVideo.Tags.Add(new MediaCategory("tag 1, tag 2",
YouTubeNameTable.DeveloperTagSchema));
newVideo.YouTubeEntry.Location = new GeoRssWhere(37, -122);
newVideo.YouTubeEntry.MediaSource = new MediaFileSource("C:\\test.avi", "video/quicktime");
Video createdVideo = request.Upload(newVideo);
I solved the problem. It was my category: the category has to be Games instead of Gaming.
解决方案
The problem is with your "Gaming" category. Amend your MediaCategory
constructor to the following:
newVideo.Tags.Add(new MediaCategory("Games", YouTubeNameTable.CategorySchema));
and it should work for you.
这篇关于如何上传使用C#中的YouTube API在YouYube视频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文