Chandresh Khambhayata
Chandresh Khambhayata

Reputation: 1777

How to use YouTubeRequest in Xamarin.Forms (Portable)

I want to upload Video in YouTube from my account whenever a user clicks on the YouTube upload button, I just want to know that what should I do if I have to send the stream content on YouTube. Or how can I get the path of video from Stream Data?

string developerkey = "api_key";
YouTubeRequestSettings settings = new YouTubeRequestSettings("Sample", developerkey , "email_id", "password");
YouTubeRequest request = new YouTubeRequest(settings);

Video newVideo = new Video();
newVideo.Title = "Video Title Here || ArgeKumandan";
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.MediaSource = new MediaFileSource(@"‪C:\Users\Yudiz\Desktop\small.mp4", "video/mp4");

var createdVideo = request.Upload(newVideo);

Thank You.

Upvotes: 1

Views: 97

Answers (1)

Linda Lawton - DaImTo
Linda Lawton - DaImTo

Reputation: 116958

You appear to be using the Gdata library for YouTube API v2.0. The Youtube v2.0 API is deprecated and no longer works.

Note: The YouTube Data API (v2) has been officially deprecated as of March 4, 2014. Please refer to our deprecation policy for more information. Please use the YouTube Data API (v3) for new integrations and migrate applications still using the v2 API to the v3 API as well.

Also you can not use client login (login and password) to access any google API. You will need to use Oauth2 to access the YouTube API.

Answer: Your code will not work as the API you are trying to access is no longer valid. You will need to switch to using the YouTube Data API.

Upvotes: 1

Related Questions