0

All I'm trying to do is get the duration of a song before the player starts and load it into a label.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    OpenFileDialog1.ShowDialog()
    Player1.settings.autoStart = False
    Player1.URL = OpenFileDialog1.FileName
    Label2.Text = Player1.currentMedia.name
    Label1.Text = Player1.currentMedia.duration            

End Sub

The name of the track is loaded immediately but the durationString takes 30 secs before it is loaded.

Any ideas why?

Thanks

John

John Moore
  • 511
  • 1
  • 9
  • 23
  • I have only used media player for video. However I found that duration wasn't available until it started playing the video. It was available immediately though. – Rob Sep 11 '13 at 12:05

1 Answers1

0

After a bit more digging, this code does it

Player1.newMedia(Player1.URL).durationString

Loads the duration before the media has started playing

John Moore
  • 511
  • 1
  • 9
  • 23