c# - 如何使用 C# 中的 Youtube API 将视频上传到 YouTube?

标签 c# video upload youtube youtube-api

下面的代码失败了?可能是什么问题?

 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);

我解决了这个问题。这是我的类别:类别必须是游戏而不是游戏

最佳答案

问题出在您的“游戏”类别上。将您的 MediaCategory 构造函数修改为以下内容:

newVideo.Tags.Add(new MediaCategory("Games", YouTubeNameTable.CategorySchema));

它应该适合你。

关于c# - 如何使用 C# 中的 Youtube API 将视频上传到 YouTube?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4764157/

相关文章:

javascript - 有没有办法在应用后从元素中删除 fitVids() ?

php - 上传文件 PHP 时生成唯一文件名的最佳方法

vue.js - axios多个异步上传的所有进度条

iPhone视频上传队列中

c# - 带有 "this"关键字的接口(interface)成员

c# - 在 C# 中使用索引处理字符串,就像在 F# 中一样

c# - 从文件系统 View 中显示图像

c# - 如何在派生类中隐藏基类公共(public)属性

performance - 从程序访问远程视频

android - 如何使用 MediaPlayer 知道第一个视频帧何时出现在屏幕上