c# app + upload video to Youtube
I need to create a c# application where I can upload a video ( I gi开发者_如何学Pythonve the path for the video which is .mp4) to Youtube.
How can I do that? I need to add a reference in my project of Google Data .NET Client library and I also have to obtain a Developer key.
In order to add reference such as:
using Google.GData.Client;
// I need to have a method authentificate :
YouTubeRequestSettings settings =
new YouTubeRequestSettings("example app", clientID, developerKey);
YouTubeRequest request =
new YouTubeRequest(settings);
Also if I have the video .mp4 do I need to have a model for uploading it on youtube? Model such Tile, Description....?
Moreover in order to add reference suh as Google Data Core API LIBRARY I need to build Google Data api sdk . In order to do that, I need to add reference to Nunit. but for moment, the download site doesn't work. I do need to build the sdk in order to add reference to my project , right?
Need help please
once you have downloaded the library you mentioned, Google Data .NET, here is a snippet to upload a video from a local file, you should include such snippet in your application.
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);
For extensive documentation and samples refer to the official, public, .NET Developer's Guide: YouTube APIs and Tools - Developer's Guide: .NET
精彩评论