当前位置: 首页>>代码示例>>C#>>正文


C# YouTubeRequest.ParseVideo方法代码示例

本文整理汇总了C#中YouTubeRequest.ParseVideo方法的典型用法代码示例。如果您正苦于以下问题:C# YouTubeRequest.ParseVideo方法的具体用法?C# YouTubeRequest.ParseVideo怎么用?C# YouTubeRequest.ParseVideo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在YouTubeRequest的用法示例。


在下文中一共展示了YouTubeRequest.ParseVideo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ParseAndFinish

        // when an upload is completed successfully we parse the return stream
        // to setup the videoid.
        // also all retry counts will be reset to 0, as a successful upload incidates
        // a restored network condition (e.g.).
        private void ParseAndFinish(UserState u, Stream s) {
            YouTubeRequestSettings ys = new YouTubeRequestSettings(YouTubeUploader.ApplicationName,
                this.developerKey);
            YouTubeRequest ytr = new YouTubeRequest(ys);
            Video v = ytr.ParseVideo(s);

            Trace.TraceInformation("Upload successful");
            u.Row.Cells[COLUMNINDEX_STATUS].Value = "Upload successful";
            u.Row.Cells[COLUMNINDEX_STATUS].Tag = u;
            u.Row.Cells[COLUMNINDEX_VIDEOID].Value = v.VideoId;
            // we had one successful upload, reset the retry counts to 0
            lock (this.flag) {
                foreach (UserState us in retryQueue) {
                    us.RetryCounter = 0;
                }
            }
        }
开发者ID:maxbilbow,项目名称:JustForFun,代码行数:21,代码来源:insertandretry.cs

示例2: OnResumableUploaderAsyncOperationCompleted

		protected void OnResumableUploaderAsyncOperationCompleted(object sender, AsyncOperationCompletedEventArgs e)
		{
			var executeYouTubeUploaderWorkflowMessage = (IExecuteYouTubeUploaderWorkflowMessage)e.UserState;

			YouTubeUploaderService.Uploaders.Remove(executeYouTubeUploaderWorkflowMessage);

			if (e.Error != null)
			{
				if (e.Error is WebException)
				{
					var webException = (WebException) e.Error;
					var response = webException.Response;
					var responseBody = string.Empty;

					if (response != null)
					{
						if (response.ContentLength > 0)
						{
							using (var stream = response.GetResponseStream())
							{
								using (var reader = new StreamReader(stream))
								{
									responseBody = reader.ReadToEnd().Trim();
								}
							}
						}
					}
				}
			}

			var videoId = string.Empty;

			if (!e.Cancelled && e.Error == null)
			{
				var youTubeRequestSettings = new YouTubeRequestSettings(executeYouTubeUploaderWorkflowMessage.Settings.Authentication.ApplicationName, executeYouTubeUploaderWorkflowMessage.Settings.Authentication.DeveloperKey);
				var youTubeRequest = new YouTubeRequest(youTubeRequestSettings);
				var video = youTubeRequest.ParseVideo(e.ResponseStream);
				videoId = video.VideoId;
			}

			var executedYouTubeUploaderWorkflowMessage = new ExecutedYouTubeUploaderWorkflowMessage()
			{
				CorrelationId = executeYouTubeUploaderWorkflowMessage.CorrelationId,
				Cancelled = e.Cancelled,
				Error = e.Error,
				VideoId = videoId
			};

			var bus = BusDriver.Instance.GetBus(YouTubeUploaderService.BusName);
			bus.Publish(executedYouTubeUploaderWorkflowMessage);
		}
开发者ID:taliesins,项目名称:talifun-commander,代码行数:51,代码来源:ExecuteYouTubeUploaderWorkflowMessageHandlerBase.cs


注:本文中的YouTubeRequest.ParseVideo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。