/// <summary> /// Default contructor. /// </summary> /// <param name="fileName">The name of the video.</param> public VideoSource(string fileName) { InitializeComponent(); Cursor = Cursors.AppStarting; _loadVideoDel = LoadVideoAsync; _loadVideoDel.BeginInvoke(new Uri(fileName), LoadFramesCallback, null); }
private void LoadVideo_DoWork(object sender, DoWorkEventArgs e) { pictureBox1.ImageLocation = string.Format(@"http://i3.ytimg.com/vi/{0}/hqdefault.jpg", GetVideoIDFromUrl("https://youtube.com" + videohref[1])); pictureBox2.ImageLocation = string.Format(@"http://i3.ytimg.com/vi/{0}/hqdefault.jpg", GetVideoIDFromUrl("https://youtube.com" + videohref[2])); pictureBox3.ImageLocation = string.Format(@"http://i3.ytimg.com/vi/{0}/hqdefault.jpg", GetVideoIDFromUrl("https://youtube.com" + videohref[3])); pictureBox4.ImageLocation = string.Format(@"http://i3.ytimg.com/vi/{0}/hqdefault.jpg", GetVideoIDFromUrl("https://youtube.com" + videohref[4])); pictureBox5.ImageLocation = string.Format(@"http://i3.ytimg.com/vi/{0}/hqdefault.jpg", GetVideoIDFromUrl("https://youtube.com" + videohref[5])); Invoke((MethodInvoker) delegate { label1.Text = videotitle[1]; label2.Text = videotitle[2]; label3.Text = videotitle[3]; label4.Text = videotitle[4]; label5.Text = videotitle[5]; }); LoadVideo.CancelAsync(); }
// private void Youtube_Subscribtion(object sender, WebBrowserDocumentCompletedEventArgs e) { str += "a"; if (str.Length > 2) { webBrowser1.Stop(); HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument(); doc.LoadHtml(webBrowser1.DocumentText); HtmlNodeCollection links = doc.DocumentNode.SelectNodes(".//div/h3/a"); foreach (HtmlNode link in links) { videohref.Add(link.GetAttributeValue("href", "")); videotitle.Add(link.InnerText); } webBrowser1.Dispose(); LoadVideo.RunWorkerAsync(); } }