Thulasiram pakala

Thulasiram pakala

  • 907
  • 872
  • 114.6k

i need to upload videos to separate channel in utube

Jun 29 2016 5:27 AM
hi i a
using System;
using System.Collections.Generic;
using System.Linq;
using Google.GData.Client;
using Google.YouTube;
using Google.GData;
using Google.GData.Extensions.Location;
//using Google.Apis.Authentication.OAuth2;
//using Google.Apis.Authentication.OAuth2.DotNetOpenAuth;
using System.Security.Cryptography.X509Certificates;
//using Google.Apis.YouTube.v3;
using Google.GData.Extensions.MediaRss;
//using Google.YouTube;
using DotNetOpenAuth.OAuth2;
//using Google.Apis.Upload;
using System.Media;
using Google.GData.Extensions;
using Google.GData.YouTube;
using System.IO;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using System.Security;
using System.util;
using System.Web.Util;
using System.ServiceModel;
using System.ServiceProcess;
//using Google.Apis.Authentication;
//using Google.Apis.Drive.v2;
using Google.Apis.Drive.v2.Data;
public partial class utube : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Btnsubmit_Click(object sender, EventArgs e)
{
try
{
string videopath, videotitle, videodesc;
videopath = upload.PostedFile.FileName;
//@"C:\Users\Ercin\Dropbox\Cloudy\Visual Studio\Projects\videoupload\videoupload\badstart.flv";
//upload.PostedFile.ContentType;
videotitle = upload.FileName;
videodesc = "MANGO ";
UploadVideo(videopath, videotitle, videodesc);
}
catch (Exception exception)
{
Response.Write("Upload failed: " + exception.Message);
}
}
public static string UploadVideo(string FilePath, string Title, string Description)
{
YouTubeRequestSettings settings;
YouTubeRequest request;
string devkey = "ATIC";
string username = "[email protected]";
string password = "f00baeda7981e21cf49b32e62ef34c6b";
settings = new YouTubeRequestSettings("utubwurl", devkey, username, password) { Timeout = 10000000 };
request = new YouTubeRequest(settings);
Video newVideo = new Video();
newVideo.Title = Title;
newVideo.Description = Description;
newVideo.Private = true;
newVideo.YouTubeEntry.Private = false;
newVideo.Keywords = "AGRI";
// newVideo.Tags.Add(new MediaCategory("ATIC", YouTubeNameTable.CategorySchema));
newVideo.YouTubeEntry.Location = new GeoRssWhere(37, -122);
// Stream stream = new MemoryStream(content);
//Stream stream = new MemoryStream(content);
//newVideo.YouTubeEntry.MediaSource = new MediaFileSource(stream, fileName, contentType);
//Video createdVideo = request.Upload(newVideo);
newVideo.YouTubeEntry.MediaSource = new MediaFileSource("C:\\Demo\\YoutubeVideoUpload\\e3a6f15f-4a8c-40d5-9cc8-c45d30b7f9ed.mov", "video/quicktime");
// newVideo.YouTubeEntry.MediaSource = new MediaFileSource(FilePath, "video/flv");
Video createdVideo = request.Upload(newVideo);
return createdVideo.VideoId;
}
 
i got error like  Could not find file 'C:\Program Files\Common Files\Microsoft Shared\DevServer\10.0\VID-20151217-WA0000.mp4'.
 
please kindly help  
 

Answers (1)