Results 1 to 2 of 2

Thread: AxWindowsMediaPlayer1.currentPlaylist Duration Iissue

  1. #1
    Junior Member
    Join Date
    Feb 11
    Posts
    17

    AxWindowsMediaPlayer1.currentPlaylist Duration Iissue

    Hey Guys - I am having major issues getting the duration of the first song in my playlist, or index 0, cant figure out what I am doing wrong, please help.

    I can get the name but somehow cant get the duration of index 0 or the first song, I get the duration of everything that follows after but just the first one eludes me.

    Code:
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    
    
            AxWindowsMediaPlayer1.currentPlaylist.clear()
            timerDuration.Enabled = False
    
            FromA = A1.SelectedItem
            ToA = A2.SelectedItem
    
            FromA = CInt(FromA)
            ToA = CInt(ToA)
    
            SuID = Su.SelectedIndex + 1
            SuID = CInt(SuID)
    
            SuNumber = Su.SelectedIndex
            SuNumber = SuNumber + 1
            SuNumber = (Format(SuNumber, "000"))
    
            Dim oMedia As WMPLib.IWMPMedia
            Dim mp3fileName As String
            Dim d As Integer
    
                For d = FromATo ToA
    
                    Dim c As String = SuNumber
                    Dim g As String = (Format(d, "000"))
                    mp3fileName = (SuNumber & g)
                    mp3fileName = mp3fileName + ".mp3"
    
                    folderName = My.Settings.versepath
                    oMedia = AxWindowsMediaPlayer1.newMedia(folderName & "\" & mp3fileName)
                    AxWindowsMediaPlayer1.currentPlaylist.appendItem(oMedia)
                    oMedia.setItemInfo("Index", AxWindowsMediaPlayer1.currentPlaylist.count)
    
                Next
            End If
    
            For x As Integer = 0 To AxWindowsMediaPlayer1.currentPlaylist.count - 1
    
                MsgBox(AxWindowsMediaPlayer1.currentPlaylist.Item(x).name)
                MessageBox.Show(String.Format("duration is {0} seconds.", AxWindowsMediaPlayer1.currentPlaylist.Item(x).duration))
    
                timerDuration.Interval = AxWindowsMediaPlayer1.currentPlaylist.Item(x).duration
                timerDuration.Enabled = True
    
            Next x
    
    
            AxWindowsMediaPlayer1.Ctlcontrols.play()

  2. #2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •