title: Audio and Video playing in Windows 10 universal app?
body: <p>I need to play audio and video in windows app where I Get the Url from networkcall and I need to add Url to Source.
  I tried in this way, But no video is played or audio is played.
  Someone help me in how to achieve this?
  Is there any other way to achieve this?</p>
  
  <p>Thanks in Advance.</p>
  
  <p>My xaml code: </p>
  
  <pre><code>&lt;StackPanel HorizontalAlignment="Center" Grid.Row="3"&gt;
  
           &lt;MediaElement x:Name="media" 
                Source="Videos/video1.mp4" 
                Width="400" 
                AutoPlay="False"
                AreTransportControlsEnabled="True" /&gt;
  
              &lt;StackPanel Orientation="Horizontal"
              HorizontalAlignment="Center"&gt;
  
                  &lt;Button Content="Play" Click="Play_Click"/&gt;
                  &lt;Button Content="Pause" Click="Pause_Click"/&gt;
                  &lt;Button Content="Stop" Click="Stop_Click" /&gt;
  
              &lt;/StackPanel&gt;
          &lt;/StackPanel&gt;
  </code></pre>
  
  <p>My cs code:</p>
  
  <pre><code>  async void Play_Click(object sender, RoutedEventArgs e)
      {
          await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =&gt;
          {
              Uri pathUri = new Uri("https://www.youtube.com/watch?v=sOEg_YZQsTI");
              media.Source = pathUri;
              Util.debugLog("PLaying ...");
              media.Play();
              media.Volume = 40;
          });
      }
  
      async void Pause_Click(object sender, RoutedEventArgs e)
      {
          await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =&gt;
          {
              Util.debugLog("Paused .. ");
              media.Pause();
          });
      }
  
      async void Stop_Click(object sender, RoutedEventArgs e)
      {
          await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =&gt;
          {
              Util.debugLog("Stoped ..");
              media.Stop();
          });
      }
  
  
      void Media_MediaFailed(object sender, ExceptionRoutedEventArgs e)
      {
          // Handle failed media event
      }
  
      void Media_MediaOpened(object sender, RoutedEventArgs e)
      {
          // Handle open media event
      }
  
      void Media_MediaEnded(object sender, RoutedEventArgs e)
      {
          // Handle media ended event
      }
  </code></pre>