Ejemplo n.º 1
0
        protected async void youtubevideo2(string id)
        {
            try
            {
                ProgressProgressBar2.IsEnabled = true;
                var uri = await YouTube.GetVideoUriAsync(id, YouTubeQuality.Quality720P);

                // “JPF_iD1IXyc” video id from youtube video link
                if (uri != null)
                {
                    YouTubePlayerMediaElement2.Source = uri.Uri;
                    YouTubePlayerMediaElement2.Play();
                    // YouTubePlayerMediaElement.Source = uri.Uri;
                    // YouTubePlayerMediaElement.Play();
                }
                else
                {
                    Debugger.Break();
                    // TODO: Show error message (no video uri found)
                    ProgressProgressBar.IsEnabled = false;
                }
            }
            catch (Exception exception)
            {
                // TODO: Add exception handling
                Debugger.Break();
                ProgressProgressBar.IsEnabled = false;
            }
        }
Ejemplo n.º 2
0
 private void Pausebtn_Click2(object sender, RoutedEventArgs e)
 {
     if (YouTubePlayerMediaElement2.CurrentState == MediaElementState.Playing)
     {
         YouTubePlayerMediaElement2.Pause();
         //Pausebtn.Icon = new SymbolIcon(Symbol.Play);
     }
     else if (YouTubePlayerMediaElement2.CurrentState == MediaElementState.Paused)
     {
         //Pausebtn.Icon = new SymbolIcon(Symbol.Pause);
         YouTubePlayerMediaElement2.Play();
     }
 }