title: How to get the total duration of a video using MediaElement of UWP
body: <p>I'am playing a video using  MediaElement. Now I want to get it's total duration before playing it. How is it possible? </p>
  
  <pre><code>FileOpenPicker openPicker = new FileOpenPicker();
  foreach (string extension in FileExtensions.Video)
  {
      openPicker.FileTypeFilter.Add(extension);
  }
  StorageFile file = await openPicker.PickSingleFileAsync();
  // mediaPlayer is a MediaElement defined in XAML
  if (file != null)
  {
      var stream = await file.OpenAsync(Windows.Storage.FileAccessMode.Read);
      videoMediaElement.SetSource(stream, file.ContentType);
  
      var totalDurationTime = videoMediaElement.NaturalDuration.TimeSpan.TotalSeconds;//get value zero
      var totalDurationTime1 = TimeSpan.FromSeconds(videoMediaElement.NaturalDuration.TimeSpan.TotalSeconds);//get zero
      videoMediaElement.Play();
  }
  </code></pre>