0
protected void Button1_Click(object sender, EventArgs e)
{
    YouTubeRequestSettings settings = new YouTubeRequestSettings("youtube", "developer key", "ID", "PAswd");
    YouTubeRequest request = new YouTubeRequest(settings);

    Video newVideo = new Video();

    newVideo.Title = txttitle.Text.Trim();
    newVideo.Tags.Add(new MediaCategory("Autos", YouTubeNameTable.CategorySchema));
    newVideo.Keywords = txtkeyword.Text.Trim();
    newVideo.Description = txtdesc.Text.Trim();
    newVideo.YouTubeEntry.Private = false;
    newVideo.Tags.Add(new MediaCategory("mydevtag, anotherdevtag", YouTubeNameTable.DeveloperTagSchema));

    newVideo.YouTubeEntry.Location = new GeoRssWhere(37, -122);

    newVideo.YouTubeEntry.MediaSource = new MediaFileSource("C:\\AVISample.avi", "video/quicktime");

    Video createdVideo = request.Upload(newVideo);
}

上传 2MB 文件并显示此错误需要太多时间:

在写入所有字节之前无法关闭流。

4

0 回答 0