/// <summary> /// Create the Video Resource object containing the metadata for the video to be uploaded /// </summary> /// <returns>Video</returns> private static Video CreateVideoResource() { Video VideoResource = new Video(); VideoSnippet vs = new VideoSnippet { Title = "Test Title", Description = "Test Description", Tags = new string[] { "keyword1", "keyword2", "keyword3" }, CategoryId = "25" // News & Politics }; VideoResource.Snippet = vs; VideoResource.Status = new VideoStatus { Embeddable = true, PrivacyStatus = "private" }; // PrivacyStatus must be all lowercase. VideoResource.RecordingDetails = new VideoRecordingDetails { Location = new GeoPoint { Latitude = 41.327464, Longitude = -72.194555, Altitude = 10 }, LocationDescription = "East Lyme, CT, U.S.A.", RecordingDate = DateTime.Now.Date }; return(VideoResource); }
/// <summary> /// Конструктор. /// </summary> /// <param name="videoSnippet">Инфошка о видео.</param> public VideoViewModel(VideoSnippet videoSnippet) { this.videoSnippet = videoSnippet; this.VideoUrl = string.Format("http://www.youtube.com/embed/{0}", videoSnippet.Id); // TODO: Переделать на Thumbnails нормальный this.PreviewImage = new BitmapImage(new Uri(string.Format("http://img.youtube.com/vi/{0}/sddefault.jpg", videoSnippet.Id))); ((BitmapImage)this.PreviewImage).CacheOption = BitmapCacheOption.OnLoad; this.DownloadCommand = new DelegateCommand((arg) => { Download(arg as VideoInfo); }, (arg) => arg is VideoInfo); }
private static (string, string) GetYoutubeInfo(string id) { YoutubeRequest request = BuildRequest(id); VideoListResponse response = request.Execute(); if (response.Items.Count == 0) { return(string.Empty, string.Empty); } VideoSnippet snippet = response.Items[0].Snippet; return(snippet.Title, GetThumbnailUrl(snippet.Thumbnails)); }
public VideoItem() { Id = new VideoId(); Snippet = new VideoSnippet(); }