Exemple #1
0
        private void downloadFile()
        {
            YouTube youtube = YouTube.Default;
            Video   vid     = youtube.GetVideo(textBox1.Text);

            System.IO.File.WriteAllBytes(Application.StartupPath + "\\" + vid.FullName, vid.GetBytes());
            var inputfile = new MediaFile {
                Filename = Application.StartupPath + "\\" + vid.FullName
            };
            var outputfile = new MediaFile {
                Filename = $"{Application.StartupPath + "\\" + vid.FullName}.mp3"
            };

            button1.Enabled = false;
            if (true)
            {
                using (var engine = new Engine())
                {
                    engine.GetMetadata(inputfile);
                    if (checkBox1.Checked)
                    {
                        engine.Convert(inputfile, outputfile);
                    }
                }

                MessageBox.Show("Download Completed.");
                button1.Enabled = true;
            }
            else
            {
                button1.Enabled = true;
                MessageBox.Show("Oops! Houston we have a problem...");
            }
        }
Exemple #2
0
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            try
            {
                if (NetworkInterface.GetIsNetworkAvailable())
                {
                    video = e.Parameter as Video;
                    var Url = await YouTube.GetVideoUriAsync(video.Id, YouTubeQuality.Quality720P);

                    Player.Source = Url.Uri;
                }
                else
                {
                    MessageDialog message = new MessageDialog("you are not connect internet!...");
                    await message.ShowAsync();

                    this.Frame.GoBack();
                }
            }
            catch (Exception err)
            {
            }
        }
Exemple #3
0
 private async void btn1080p_Click(object sender, RoutedEventArgs e)
 {
     await YouTube.GetVideoUriAsync(video.Id, YouTubeQuality.Quality1080P);
 }