title: Windows Media Player Duration Not Working?
body: <p>I am currently making a WPF App as a school project. I chose a Media player topic.</p>
  <p>I have a slight problem with returning track length of a song and assigning it as a maximum for a slider (I used a slider for song seeking).</p>
  <pre><code>                /*List&lt;string&gt; pathPesme = new List&lt;string&gt;();
                  path = od.FileNames;
                  for (int i = 0; i &lt; path.Length; i++)
                  {
                      lista.Add(path[i]);
                      m.CreateControl();
                      media = this.m.newMedia(path[i]);*/
  
  //When i want to instance a new class Pesma(song) and put the track length(duzina), it works and returns the value in a mm:ss format.
  
                      string ime = System.IO.Path.GetFileName(path[i]);
                      string duzina = media.durationString;
                      Pesma pesma = new Pesma(ime, path[i], duzina);
                      listaPesmi.Add(pesma);
                  }
  </code></pre>
  <p>However, when i try to do a similar thing and put it as Slider.Maximum, it doesn't work.</p>
  <pre><code>                        foreach (var pesma in dispesma)/**/
                          {
                              string aa=iseciString(lbxListaPesama.Items[lbxListaPesama.SelectedIndex].ToString(), ':'); 
  //Method for cutting string to get song name
                              if (pesma.ImePesme == aa)
                              {
                                  m.URL = pesma.Path;
                                  premotajSlider.Maximum = Math.Ceiling(m.currentMedia.duration); //Slider: Here i try to put the max value. In the debugger, it returns a 0
                                  m.Ctlcontrols.play();
                                  jacinaZvukaSlider.Value = m.settings.volume;
                              }
                          }
  </code></pre>
  <p>It's my first time asking on StackOverflow, so I hope I didn't do something bad. If I did, sorry, still in the learning phase.</p>