mp3 player

song play complete

Page 1 of 1

6 Replies - 3342 Views - Last Post: 05 May 2010 - 07:20 PM Rate Topic: -----

#1 itzkhurram  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 29-April 10

mp3 player

Posted 30 April 2010 - 12:53 AM

I am designing mp3 player 90% work completed but 1 problem

when i select a song and click on play button need is the playlist disable, means song play complete then playlist enable.

and playlist is showing complete directory name, need simple song name.

thanks my code is here.

using axwindowsmediaplayer
*** this is the category button where i select my song and fill playlist

 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        playlist.Items.Clear()
        Dim folderInfo As New IO.DirectoryInfo("d:\songs\wedding")

        Dim arrFilesInFolder() As IO.FileInfo

        Dim fileInFolder As IO.FileInfo


        arrFilesInFolder = folderInfo.GetFiles("*.mp3")

        For Each fileInFolder In arrFilesInFolder

            playlist.Items.Add(fileInFolder.FullName)

        Next
    End Sub


*** here I am trying to disable and enable my playlist. but not successful

Private Sub AxWindowsMediaPlayer2_StatusChange(ByVal sender As Object, ByVal e As System.EventArgs) Handles AxWindowsMediaPlayer2.StatusChange

        If WMPLib.WMPPlayState.wmppsPlaying Then

            playlist.Enabled = False
        Else
            playlist.Enabled = True
        End If

    End Sub
End Class



Is This A Good Question/Topic? 0
  • +

Replies To: mp3 player

#2 adamarek  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 15-November 09

Re: mp3 player

Posted 30 April 2010 - 04:20 AM

Try this...

Private Sub AxWindowsMediaPlayer2_StatusChange(ByVal sender System.Object, ByVal e As AxWMPLib._WMPOCXEvents_PlayStateChangeEvent) Handles AxWindowsMediaPlayer2.StatusChange 
 
        If e.newState = 9 Then
            playlist.Enabled = False 
        ElseIf e.newState = 8 Then
            playlist.Enabled = True 
        End If 
 
    End Sub 


Was This Post Helpful? 0
  • +
  • -

#3 itzkhurram  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 29-April 10

Re: mp3 player

Posted 30 April 2010 - 05:15 AM

Error 1 Method 'Private Sub AxWindowsMediaPlayer2_StatusChange(sender As Object, e As AxWMPLib._WMPOCXEvents_PlayStateChangeEvent)' cannot handle event 'Public Event StatusChange(sender As Object, e As System.EventArgs)' because they do not have a compatible signature.




View Postadamarek, on 30 April 2010 - 03:20 AM, said:

Try this...

Private Sub AxWindowsMediaPlayer2_StatusChange(ByVal sender System.Object, ByVal e As AxWMPLib._WMPOCXEvents_PlayStateChangeEvent) Handles AxWindowsMediaPlayer2.StatusChange 
 
        If e.newState = 9 Then
            playlist.Enabled = False 
        ElseIf e.newState = 8 Then
            playlist.Enabled = True 
        End If 
 
    End Sub 


Was This Post Helpful? 0
  • +
  • -

#4 Recoil  Icon User is offline

  • D.I.C Regular

Reputation: 24
  • View blog
  • Posts: 292
  • Joined: 28-June 08

Re: mp3 player

Posted 30 April 2010 - 05:45 AM

Best way to get help on this issue != double posting
Was This Post Helpful? 0
  • +
  • -

#5 adamarek  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 15-November 09

Re: mp3 player

Posted 30 April 2010 - 07:14 AM

In the Sub where you use:
Player.URL = (filename)' Play song
'   Add the Handler
AddHandler Player.PlayStateChange, AddressOf AxWindowsMediaPlayer2_StatusChange


Remove 'Handles AxWindowsMediaPlayer2.StatusChange

Private Sub AxWindowsMediaPlayer2_StatusChange(ByVal sender System.Object, ByVal e As AxWMPLib._WMPOCXEvents_PlayStateChangeEvent)   
        If e.newState = 9 Then 
            playlist.Enabled = False  
        ElseIf e.newState = 8 Then 
            playlist.Enabled = True  
        End If  
  
    End Sub 

Was This Post Helpful? 0
  • +
  • -

#6 itzkhurram  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 29-April 10

Re: mp3 player

Posted 03 May 2010 - 12:27 AM

change Private to Public sub

If e.newState = 3 Then &&& 3 is playing
playlist.Enabled = False
ElseIf e.newState = 1 Then &&&& 1 is stopped
playlist.Enabled = True
End If


thanks to all
but 1 thing is remaining
list box show only song name not a directory path

<code>
playlist.Items.Clear()


Dim folderInfo As New IO.DirectoryInfo("d:\songs\old")

Dim arrFilesInFolder() As IO.FileInfo

Dim fileInFolder As IO.FileInfo


arrFilesInFolder = folderInfo.GetFiles("*.mp3")

For Each fileInFolder In arrFilesInFolder
playlist.Items.Add(System.IO.Path.GetFileName(fileInFolder.FullName))

Next

but when i double click on playlist song not run

</code>

View Postadamarek, on 30 April 2010 - 06:14 AM, said:

In the Sub where you use:
Player.URL = (filename)' Play song
'   Add the Handler
AddHandler Player.PlayStateChange, AddressOf AxWindowsMediaPlayer2_StatusChange


Remove 'Handles AxWindowsMediaPlayer2.StatusChange

Private Sub AxWindowsMediaPlayer2_StatusChange(ByVal sender System.Object, ByVal e As AxWMPLib._WMPOCXEvents_PlayStateChangeEvent)   
        If e.newState = 9 Then 
            playlist.Enabled = False  
        ElseIf e.newState = 8 Then 
            playlist.Enabled = True  
        End If  
  
    End Sub 

Was This Post Helpful? 0
  • +
  • -

#7 lozthegreat1  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 17
  • Joined: 29-April 10

Re: mp3 player

Posted 05 May 2010 - 07:20 PM

here try this it might work im not sure though


            Form1.AxWindowsMediaPlayer1.URL = OpenFileDialog1.FileName
            Form1.Label1.Text = Form1.AxWindowsMediaPlayer1.currentMedia.name
            Form1.AxWindowsMediaPlayer1.mediaCollection.add(Form1.AxWindowsMediaPlayer1.URL)
            ListBox1.Items.Add(Form1.AxWindowsMediaPlayer1.currentMedia.name)
            urlArray(count) = OpenFileDialog1.FileName
            mediaArray(count) = Form1.AxWindowsMediaPlayer1.currentMedia.name
            count = count + 1
            Me.ListBox1.Text = Form1.AxWindowsMediaPlayer1.currentMedia.name

This post has been edited by lozthegreat1: 05 May 2010 - 07:22 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1