Library code snippets

Calculate the duration of a song (Media Player)

The code below calculates the length of the track in minutes and seconds from the Windows Media Player properties (which just gives the result in seconds). lblPT is the label used to display the Current Position and total time of Song, in

mm:ss / mm:ss
current position / time remaining

lblPT.Caption = wmp.CurrentPosition \ 60 & ":" & Format(Int(wmp.CurrentPosition Mod 60), "00") & " / " & wmp.SelectionEnd \ 60 & ":" & Format(Int(wmp.SelectionEnd Mod 60), "00")


wmp.CurrentPosition gives the location in seconds of the song
wmp.SelectionEnd gives the total seconds of the selected MP3 Song

Comments

  1. 01 Jan 1999 at 00:00

    This thread is for discussions of Calculate the duration of a song (Media Player).

Leave a comment

Sign in or Join us (it's free).