1,105,406 Community Members

Play/Pause Button

Member Avatar
fasanay
Newbie Poster
1 post since Oct 2013
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Hi Guys / Gals - Is there any way to track your AxWindowsMediaPlayer1 when it reaches the end of the Playlist, I am doing a Play / Pause Button but it goes on looping the playlist endlessly, so I was just hoping if I can know it has reached the end of the playlist I can put a stop to it.

Or maybe there is a better way of implementing the Play / Pause Button

Your help will be greatly appreciated.

Thanks
Jim

Here is the code basically I have two populated list boxes and i select to play from which song to which song which makes up my Playlist.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim oMedia As WMPLib.IWMPMedia
Dim mp3fileName As String
Dim d As Integer

 FromSong = Song1.SelectedItem
 ToSong = Song2.SelectedItem

If My.Settings.songpath = "" Then
            MessageBox.Show("Please Select a Audio Folder")
        Else
            For d = FromSong To ToSong

                mp3fileName = mp3fileName + ".mp3"

                folderName = My.Settings.songpath
                oMedia = AxWindowsMediaPlayer1.newMedia(folderName & "\" & mp3fileName)
                oMedia.setItemInfo("Index", AxWindowsMediaPlayer1.currentPlaylist.count)
                AxWindowsMediaPlayer1.currentPlaylist.appendItem(oMedia)

            Next

        End If

        If Button1.Tag = "Play" Then
            Button1.Tag = "Pause"
            AxWindowsMediaPlayer1.Ctlcontrols.play()
            Button1.BackgroundImage = My.Resources.iconPause
        ElseIf Button1.Tag = "Pause" Then
            Button1.Tag = "Play"
            Button1.BackgroundImage = My.Resources.iconPlay
            AxWindowsMediaPlayer1.Ctlcontrols.pause()

        End If

End Sub
Member Avatar
Gé48
Junior Poster in Training
76 posts since Apr 2010
Reputation Points: 1 [?]
Q&As Helped to Solve: 14 [?]
Skill Endorsements: 0 [?]
 
0
 

Hi, I am working on a project with AxWindowsMediaPlayer as well. Where you use ListBoxes
I use Listviews. In my project if the index of the current song is the same as the items
count in the listview it will stop.

If ListViewTracks.Items.SelectedIndices(0) = ListViewTracks.Items.Count Then
    ButtonStop.PerformClick()
End If
You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article