Hi All,
I am trying to upload a video to you tube forma asp.net from. i downloaded the youtube API,devleoperkey and added all the reference ddl in my project. but aim getting the following error "Execution of request failed: https://uploads.gdata.youtube.com/feeds/api/users/default/uploads"
at request.Upload(newVideo)
Below is my code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Google.YouTube;
using Google.GData.Client;
using Google.GData.Extensions;
using Google.GData.YouTube;
using Google.GData.Extensions.MediaRss;
protected void FileUploadbtn_Click(object sender, EventArgs e)
{
try
{
string developerKey = "xxxxxxxxxxxxxx";// got from youtube
string username = "xxxxxxxxx@gmail.com"; // Gmail username
string password = "xxxxxxxxxxxx"; // Gmail Password
string youtubeurl;
string FileName = FileUpload1.FileName;
string fillPath = FileUpload1.PostedFile.FileName;
var newp = Server.MapPath("App_Data/" + FileName);
FileUpload1.SaveAs(Server.MapPath("App_Data/" + FileName));
YouTubeRequestSettings settings;
YouTubeRequest request;
settings = new YouTubeRequestSettings("YOUTUBEAPI", developerKey, username, password) { Timeout = -1 };
// settings =new YouTubeRequestSettings()
request = new YouTubeRequest(settings);
Video newVideo = new Video();
newVideo.Title = Title;
newVideo.Description = " Sample Description";
// newVideo.Private = true;
newVideo.YouTubeEntry.Private = false;
newVideo.YouTubeEntry.MediaSource = new MediaFileSource(fillPath, "video/mp4");
Video createdVideo = request.Upload(newVideo);
Label1.Text = createdVideo.VideoId;
}
catch (Exception ex)
{
Label1.Text = ex.Message.ToString();
}
}
Can anyone help me plz
Thanks in advance
TARUN