0

C# API を使用して、500 MB のビデオを YouTube にアップロードしようとしています。最後の行で、引数 null 例外を受け取ります。2 番目の引数である URI は何ですか? これが私のコードです:

[WebMethod]
public string InsertVideoToYouTube(FileStream fs, string filename, string title, string description, string userName, string password)
{
    Video newVideo = new Video();
    newVideo.Title = title;
    newVideo.Tags.Add(new MediaCategory("Sports", YouTubeNameTable.CategorySchema));
    newVideo.Description = description;
    newVideo.YouTubeEntry.Private = false;
    newVideo.YouTubeEntry.MediaSource = new MediaFileSource(fs, Path.GetFileName(filename), "video/x-ms-wmv");

    var youTubeAuthenticator = new ClientLoginAuthenticator("KenticoVideo",
                    ServiceNames.YouTube, new GDataCredentials(userName, password));
youTubeAuthenticator.DeveloperKey = "xxx";
    ResumableUploader uploader = new ResumableUploader(256);

    uploader.Insert(youTubeAuthenticator, new Uri("http://www.mysite.com"), fs, "video/x-ms-wmv", ""); // start upload
}

スタック トレースは次のとおりです。

System.ArgumentNullException: Value cannot be null.
Parameter name: uriString
   at System.Uri..ctor(String uriString)
   at Google.GData.Client.ResumableUpload.ResumableUploader.InitiateUpload(Uri resumableUploadUri, Authenticator authentication, String contentType, String slug, Int64 contentLength, String httpMethod)
   at Google.GData.Client.ResumableUpload.ResumableUploader.InitiateUpload(Uri resumableUploadUri, Authenticator authentication, String contentType, String slug, Int64 contentLength)
   at Google.GData.Client.ResumableUpload.ResumableUploader.Insert(Authenticator authentication, Uri resumableUploadUri, Stream payload, String contentType, String slug, AsyncData data)
   at Google.GData.Client.ResumableUpload.ResumableUploader.Insert(Authenticator authentication, Uri resumableUploadUri, Stream payload, String contentType, String slug)
   at PreveaYTProxy.InsertVideoToYouTube(FileStream fs, String filename, String title, String description, String userName, String password) in c:\inetpub\wwwroot\Customers\imaginasium\PreveaYTProxy\App_Code\PreveaYTProxy.cs:line 57
   at _Default.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\Customers\imaginasium\PreveaYTProxy\Default.aspx.cs:line 20
   at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
   at System.Web.UI.Control.OnLoad(EventArgs e)
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

正しいコードを使用していますか? ここを見ましたが、必要なコードが見つかりません:

https://groups.google.com/forum/#!topic/gdata-dotnet-client-library/AWoPGB9_NzE

4

0 に答える 0