playing mp3's [ http://www.andreavb.com/forum/viewtopic.php?TopicID=857 ]


Nicholas
17-01-2003 at 09:35 PM
playing mp3's

Hi, I'm trying to make a program that play's a Mp3 file but I'm having a problem getting the file to play, Do I need to add a component for VB6 and then add the control? Thanks for any help. Nick




vbgen
18-01-2003 at 06:32 PM
Re: playing mp3's

hope you can easily grasp what controls you'll need in this code...
Private Sub PlaySong(ByVal Index As Integer)
'Purpose:  Load a song, then play it
    If Index >= 1 Then
        LoadSong Index
    Else
        LoadSong 1
    End If
    
    If MediaPlayer1.Filename <> "" Then
        MediaPlayer1.Play
        bStopPressed = False
    End If
End Sub

Private Sub LoadSong(ByVal Index As Integer)
'Purpose:  Loads a song into the mediaplayer and sets properties

    If Index <= lstPlayList1.ListItems.Count Then
        lstPlayList1.ListItems(iCurrentIndex).Bold = False
        lstPlayList1.ListItems(iCurrentIndex).ListSubItems(1).Bold = False
        lstPlayList1.ListItems(iCurrentIndex).ListSubItems(2).Bold = False
        iCurrentIndex = Index
        MediaPlayer1.Filename = lstFilenames.List(Index - 1)
        
        Label1.Caption = "Current Song: " & lstPlayList1.ListItems(Index).ListSubItems(1).Text & " by " & lstPlayList1.ListItems(Index).ListSubItems(2).Text
        'Label1.Caption = "Current Song: " & Right(lstPlayList.List(Index), Len(lstPlayList.List(Index)) - Len(Str(Index)) - 1)
        sFormTitle = frmMain.sPlayerName & " - [" & lstPlayList1.ListItems(Index).ListSubItems(1).Text & "-" & lstPlayList1.ListItems(Index).ListSubItems(2).Text & "]  "
        frmMain.Caption = sFormTitle
        'HCSSlider1.Max = MediaPlayer1.Duration
        'HCSSlider1.Min = 0
        lstPlayList1.ListItems(Index).Selected = True
        lstPlayList1.ListItems(Index).EnsureVisible
        lstPlayList1.ListItems(Index).Bold = True
        lstPlayList1.ListItems(Index).ListSubItems(1).Bold = True
        lstPlayList1.ListItems(Index).ListSubItems(2).Bold = True
        lstPlayList1.Refresh
    End If
End Sub


and obviously, with this code you'll need a mediaplayer control.

____________________________
Been busy trying to take a second degree <--it's not working out...




sajoo
26-05-2003 at 07:59 AM
Re: playing mp3's

hi
  I do this ciding

but i can't find the istplaylist control, how i can place it on the form pls tell me




____________________________
sajoo




sajoo
26-05-2003 at 07:59 AM
Re: playing mp3's

hi
  I do this ciding

but i can't find the "istplaylist1" control, how i can place it on the form pls tell me




____________________________
sajoo




vbgen
26-05-2003 at 05:45 PM
Re: playing mp3's

i believe that's a listbox you need on your form

  sorry i forgot to tell you

____________________________
Been busy trying to take a second degree <--it's not working out...




sajoo
27-05-2003 at 12:27 PM
Re: playing mp3's

hi

but in which control i will find it
i mean

in component  tab what option i should select


thankx
sajoo

____________________________
sajoo




vbgen
29-05-2003 at 05:57 PM
Re: playing mp3's

well, the listbox i am tokn about is actually the FileListBox, which is in your toolbar already. it's a common control.



____________________________
Been busy trying to take a second degree <--it's not working out...




sajoo
30-05-2003 at 05:24 AM
Re: playing mp3's

Hi

Thankx  again


sajoo





____________________________
sajoo