MediaPlayer.Duration

Reapz

Well-known member
Joined
Dec 15, 2002
Messages
74
If I want to find the length of a particualr mp3 I use...

[VB]
MediaPlayer1.FileName = TrackName
Dim TrackLength = MediaPlayer1.Duration
[/VB]

...which returns the length in seconds.

In individual cases this is fine but when my App runs one of the first things it does is gather information about the users music collection including the total duration. (Seems kinda pointless to me but it was requested. ) The problem is that this takes ages! I only have about 10 CDs on the system atm so I hate to think how long it will take to scan someones entire collection!

Why does it take so long? Is it because the MediaPlayer has to quickly scan the entire track to get the duration?

More importantly is there a quicker way I can do this?

Cheers!
 
Back
Top