Results 1 to 8 of 8

Thread: Play/Pause Button Anyone Please ??

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2011
    Posts
    21

    Unhappy Play/Pause Button Anyone Please ??

    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.

    Code:
    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
    Last edited by fasanay; Oct 31st, 2013 at 02:37 PM. Reason: bump

  2. #2

    Thread Starter
    Junior Member
    Join Date
    Feb 2011
    Posts
    21

    Re: Play/Pause Button Anyone Please ??

    Can anyone please help me ..

  3. #3
    Member
    Join Date
    Jan 2012
    Posts
    51

    Re: Play/Pause Button Anyone Please ??

    Have you tried determining the amount of items in the playlist and when you get to that amount, stop?

  4. #4
    Frenzied Member HanneSThEGreaT's Avatar
    Join Date
    Nov 2003
    Location
    Vereeniging, South Africa
    Posts
    1,491

    Re: Play/Pause Button Anyone Please ??

    The looping could also be that you have the Repeat functionality set to On. Try switching it off
    VB.NET MVP 2008 - Present

  5. #5
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863

    Re: Play/Pause Button Anyone Please ??

    Have you tried:
    Code:
     AxWindowsMediaPlayer1.settings.setMode("loop", False)
    ?
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Feb 2011
    Posts
    21

    Re: Play/Pause Button Anyone Please ??

    Thanks for the suggestions guys but
    Code:
    AxWindowsMediaPlayer1.settings.setMode("loop", False)
    didnt work, tried putting inside and outside the if statement, didnt work in either case, the songs are still repeating after the end of playlist.

  7. #7
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863

    Re: Play/Pause Button Anyone Please ??

    ??
    Before the line:
    Code:
    AxWindowsMediaPlayer1.Ctlcontrols.play()
    put
    Code:
    Debug.Print ("Loop-Setting is: " & AxWindowsMediaPlayer1.settings.getMode("loop").toString)
    and post what you get in the Immediate-Window
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

  8. #8

    Thread Starter
    Junior Member
    Join Date
    Feb 2011
    Posts
    21

    Re: Play/Pause Button Anyone Please ??

    Hi Guys - The Debug Print is giving me "Loop-Setting is: False", but i still dont understand why its looping

Tags for this Thread

Posting Permissions

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



Click Here to Expand Forum to Full Width