• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 376
  • Last Modified:

How to play group of MP3 files continuously

Hi, I'm trying to get a group of MP3 files to play one after the other, using Visual Basic 2008.

I have the songs in a folder, I can load and play them one at a time, or I can load a playlist but I'm having trouble getting the player to recognize when one song ends, it just stops at the end of the song. How do you get the player to recognize that one song has ended and play the next song in the listbox? I have tried using a loop through the index of the listbox, but again when the song reaches an end it stops and you have to load the next song yourself.

Private Sub btnPlayAll_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPlayAll.Click
Me.tmrPlay.Enabled = True
If Me.AxWindowsMediaPlayer1.Ctlcontrols.currentPositionString >= Me.AxWindowsMediaPlayer1.currentMedia.durationString.TrimEnd Then
intPos = intPos + 1
If intPos > intMax Then
intPos = 1
End If
End If
Fill_Screen() '' reads array to text boxes on the form.
Me.AxWindowsMediaPlayer1.URL = Trim(strData(4, intPos)) 'Play the currently selected song
End Sub

Open in new window

1 Solution
You could use the stateChanged event of the control to see if the player is stopped then play the next file.

jhmblvdAuthor Commented:
The problem was with my understanding!

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now