我们可以使用asp.net网站上传到youtube的最大视频大小是多少

时间:2014-03-07 13:44:32

标签: c# asp.net youtube

您好我正在使用基于浏览器的上传通过我的asp.net网站将视频上传到youtube。

YouTubeService service = new YouTubeService("MyAppName", devkey);
YouTubeRequestSettings objSettings = new YouTubeRequestSettings("eBizLink", devkey, username, password);
objSettings.Timeout = 999999990;
objSettings.Maximum = 2000000000;
YouTubeRequest objRequest = new YouTubeRequest(objSettings);
((GDataRequestFactory)objRequest.Service.RequestFactory).Timeout = 9999999;
((GDataRequestFactory)service.RequestFactory).KeepAlive = false;
objRequest.Settings.Timeout = 9999999;//60 * 60 * 1000

//objSettings.Timeout = 10000000;
//objSettings.Maximum = 2000000000;
Video objNewVideo = new Video();
//objNewVideo.Title = txtTitle.Text.Trim();
objNewVideo.Title = ViewState["VideoName"].ToString();
objNewVideo.Tags.Add(new MediaCategory("Animals", YouTubeNameTable.CategorySchema));
objNewVideo.Keywords = txtKeyWrd.Text.Trim();
objNewVideo.Description = txtDescription.Text.Trim();
objNewVideo.YouTubeEntry.Private = false;
objNewVideo.YouTubeEntry.AccessControls.Add(new YtAccessControl("list", "denied"));

//objNewVideo.YouTubeEntry.State.Name="restricted";
//objNewVideo.YouTubeEntry.State.Reason = "Must login";
objNewVideo.Tags.Add(new MediaCategory("mydevtag, anotherdevtag", YouTubeNameTable.DeveloperTagSchema));
objNewVideo.YouTubeEntry.Location = new GeoRssWhere(37, -122);
objNewVideo.YouTubeEntry.MediaSource = new MediaFileSource(FilePath, "video/mp4");
Video createdVideo = objRequest.Upload(objNewVideo);

的Web.config:

<httpRuntime executionTimeout="24000" maxRequestLength="4124672" requestValidationMode="4.5"/>
<requestFiltering>
    <requestLimits maxAllowedContentLength="2147483648"/>
</requestFiltering>

这可以接受最大100MB,但我希望上传2GB视频。

我的疑问:
我是否需要对上述代码进行一些更改
OR
我是否需要对帐户设置进行一些更改。

2 个答案:

答案 0 :(得分:0)

  

从YouTube网页上传文件大小限制为2 GB,如果使用最新浏览器版本,则限制为20 GB

http://en.wikipedia.org/wiki/YouTube#Uploading

答案 1 :(得分:0)

试试这个

<system.webServer>
   <security>
     <requestFiltering>
       <requestLimits maxAllowedContentLength="1073741824"/>
     </requestFiltering>
   </security>
</system.webServer>

这适用于1GB。随意增加maxAllowedContentLength。