title: Code to play videos in Windows Phone 8
body: <p>Can anyone help me how to play videos in windows phone.</p>
  
  <p>I have displayed all my videos in list box.And when i click on a particular video immediately it should be navigated to other page and play.When i click on a particular video it is navigating to other page but not playing.I was getting no errors and even warnings also.</p>
  
  <p>Xaml code in navigated page:</p>
  
  <pre><code>&lt;MediaElement x:Name="player" AutoPlay="True"/&gt;
  </code></pre>
  
  <p>Xaml.cs code in navigated page:</p>
  
  <pre><code>protected async override void OnNavigatedTo(NavigationEventArgs e)
          {
              if (!NetworkInterface.GetIsNetworkAvailable())
              {
                  MessageBox.Show("An error has occurred! Please verify your internet connection.");
                  NavigationService.GoBack();
              }
               else
              {
  
              string songcode = "";
              if (NavigationContext.QueryString.TryGetValue("songcode", out songcode))
              {
                  var url = await YouTube.GetVideoUriAsync(songcode, YouTubeQuality.Quality480P);
                  player.Source = url.Uri;
              }
  </code></pre>
  
  <p>I was a beginner in windows phone apps.</p>
  
  <p>please anybody help me with this.</p>
  
  <p>Many thanks.</p>