10

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.

TRiG
  • 10,148
  • 7
  • 57
  • 107
Furkan Gözükara
  • 22,964
  • 77
  • 205
  • 342
  • possible duplicate of [YouTube API integration ASP.NET - upload video with a single page](http://stackoverflow.com/questions/629435/youtube-api-integration-asp-net-upload-video-with-a-single-page) – Filip Ekberg Jan 21 '11 at 21:51
  • i saw that. but it does not explain how to use youtube api. how do i integrate it ? i downloaded and installed YouTube SDK (1.7.0.1).msi – Furkan Gözükara Jan 21 '11 at 21:56
  • Hi MonsterMMORPG Shall i have the tutorial or Code regarding upload videos on YouTube. I am stuck with the Client_secret.json file.. Your guidance will be appreciated... Pls Help me... – Sagar Rawal Mar 27 '14 at 12:56

1 Answers1

5

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.

Joel B
  • 12,082
  • 10
  • 61
  • 69