4 Replies - 262 Views - Last Post: 07 February 2012 - 11:06 AM Rate Topic: -----

Topic Sponsor:

#1 abubu  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 06-February 12

I have problem with my mp3 player that im making at the moment

Posted 06 February 2012 - 05:36 AM

Hello,As the topic says i have problem with my mp3 player.I want to make the mp3 palyer auto changing the next song after finishing another but as i tried to do that the only thing that happened was that the same song is repeating over and over.Here is the code i used :

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As 
System.EventArgs) Handles Timer1.Tick
        If (AxWindowsMediaPlayer1.playState = WMPLib.WMPPlayState.wmppsStopped) Then
            If (ListBox1.SelectedIndex < ListBox1.Items.Count - 1) Then
                ListBox1.SelectedIndex = ListBox1.SelectedIndex + 1
                ListBox1.SelectedItem = ListBox1.SelectedIndex
                AxWindowsMediaPlayer1.URL = ListBox1.SelectedItem
                AxWindowsMediaPlayer1.Ctlcontrols.play()

            End If
        End If

    End Sub



Is This A Good Question/Topic? 0
  • +

Replies To: I have problem with my mp3 player that im making at the moment

#2 CharlieMay  Icon User is offline

  • This space intentionally left blank
  • member icon

Reputation: 960
  • View blog
  • Posts: 3,354
  • Joined: 25-September 09

Re: I have problem with my mp3 player that im making at the moment

Posted 06 February 2012 - 06:28 AM

Are you doing anything with the axWindowsMediaPlayer elsewhere in your code? what you have looks like it should work.

Perhaps step through your code and ensure that it is following the logic as you think you have written it. Are you staring the first song somewhere or does the timer handle that? What is the Enum value of the PlayState when the timer is processed? Things like this should give you a better look at what's going on behind the scenes.

For example, if I drag a axWMP control onto a form and check the playstate at runtime, I get an Enum of 0 which is the wmppsUndefined state.

This post has been edited by CharlieMay: 06 February 2012 - 06:31 AM

Was This Post Helpful? 0
  • +
  • -

#3 sela007  Icon User is offline

  • D.I.C Addict

Reputation: 67
  • View blog
  • Posts: 522
  • Joined: 21-December 11

Re: I have problem with my mp3 player that im making at the moment

Posted 06 February 2012 - 07:11 AM

try put your code in AxWindowsMediaPlayer1_PlayStateChange event.
   Private Sub AxWindowsMediaPlayer1_PlayStateChange(ByVal sender As Object, ByVal e As AxWMPLib._WMPOCXEvents_PlayStateChangeEvent) Handles AxWindowsMediaPlayer1.PlayStateChange
'now change url

End Sub


Was This Post Helpful? 0
  • +
  • -

#4 DimitriV  Icon User is offline

  • It's been so long, without this feeling
  • member icon

Reputation: 513
  • View blog
  • Posts: 2,533
  • Joined: 24-July 11

Re: I have problem with my mp3 player that im making at the moment

Posted 06 February 2012 - 01:30 PM

You don't need to set SelectedItem upon changing SelectedIndex - getting SelectedItem returns the item at the index of SelectedIndex. (0-based)
Was This Post Helpful? 0
  • +
  • -

#5 abubu  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 06-February 12

Re: I have problem with my mp3 player that im making at the moment

Posted 07 February 2012 - 11:06 AM

Thanks all for helping seem like i've got it :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1