• 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
Me.AxWindowsMediaPlayer1.Ctlcontrols.play()
End Sub

Open in new window

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

http://msdn.microsoft.com/en-us/library/bb262049(VS.85).aspx
0
 
jhmblvdAuthor Commented:
The problem was with my understanding!
0

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