【问题标题】:c# app + upload video to Youtubec# app+上传视频到Youtube
【发布时间】:2011-11-21 21:43:47
【问题描述】:

我需要创建一个 c# 应用程序,我可以在其中将视频(我提供视频的路径为 .mp4)上传到 Youtube。

我该怎么做?我需要在我的 Google Data .NET 客户端库项目中添加一个引用,并且我还必须获得一个开发者密钥。

为了添加引用如:

using Google.GData.Client; 

// I need to have a method authentificate :     
YouTubeRequestSettings settings = 
     new YouTubeRequestSettings("example app", clientID, developerKey);
YouTubeRequest request = 
     new YouTubeRequest(settings); 

另外,如果我有视频 .mp4,我是否需要有一个模型才能将其上传到 youtube 上?建模这样的 Tile,Description....?

此外,为了将参考 suh 添加为 Google Data Core API LIBRARY,我需要构建 Google Data api sdk。为此,我需要添加对 Nunit 的引用。但暂时,下载站点不起作用。我确实需要构建 sdk 才能添加对我的项目的引用,对吗?

需要帮助

【问题讨论】:

标签: c# upload youtube-api


【解决方案1】:

一旦你下载了你提到的库,Google Data .NET,这里有一个从本地文件上传视频的 sn-p,你应该在你的应用程序中包含这样的 sn-p。

Video newVideo = new Video();

newVideo.Title ="My Test Movie";
newVideo.Tags.Add(new MediaCategory("Autos", YouTubeNameTable.CategorySchema));
newVideo.Keywords = "cars, funny";
newVideo.Description = "My description";
newVideo.YouTubeEntry.Private = false;
newVideo.Tags.Add(new MediaCategory("mydevtag, anotherdevtag", 
  YouTubeNameTable.DeveloperTagSchema));

newVideo.YouTubeEntry.Location = new GeoRssWhere(37, -122);
// alternatively, you could just specify a descriptive string
// newVideo.YouTubeEntry.setYouTubeExtension("location", "Mountain View, CA");

newVideo.YouTubeEntry.MediaSource = new MediaFileSource("c:\\file.mov",
  "video/quicktime");
Video createdVideo = request.Upload(newVideo);

有关详细文档和示例,请参阅官方公开的 .NET 开发人员指南:YouTube APIs and Tools - Developer's Guide: .NET

【讨论】:

    猜你喜欢
    • 2013-03-07
    • 2011-11-30
    • 2020-05-12
    • 1970-01-01
    • 2013-12-12
    • 2012-04-12
    • 2012-07-19
    • 2012-03-07
    • 2016-01-11
    相关资源
    最近更新 更多