Results 1 to 2 of 2

Thread: [SOLVED] MediaPlayer skips track

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2010
    Posts
    71

    [SOLVED] MediaPlayer skips track

    Hey guys,
    Media Player is skipping some tracks, in interval of 2 tracks, I don't know why.

    Imagine a list of 5 tracks.

    Track 1 - Plays ok.
    Track 2 - Plays ok.
    Track 3 - Goes to it, don't start and skip to next.
    Track 4 - Plays ok.
    Track 5 - Skips / plays (can't remember)

    And when I loop it, it will do the same thing!

    Here is the code:

    vb.net Code:
    1. Private Sub AxWindowsMediaPlayer1_PlayStateChange(ByVal sender As Object, ByVal e As AxWMPLib._WMPOCXEvents_PlayStateChangeEvent) Handles AxWindowsMediaPlayer1.PlayStateChange
    2.  
    3.         'IF THERE ARE NO CLIPS PLAYING
    4.         If AxWindowsMediaPlayer1.playState = WMPLib.WMPPlayState.wmppsStopped Then
    5.  
    6.             If frmPainel.lst_videos.SelectedIndex = (frmPainel.lst_videos.Items.Count - 1) Then
    7.  
    8.                 frmPainel.lst_videos.SelectedIndex = 0
    9.                 url = frmPainel.lst_videos.Items.Item(frmPainel.lst_videos.SelectedIndex).ToString
    10.  
    11.                 AxWindowsMediaPlayer1.URL = url
    12.                 AxWindowsMediaPlayer1.Ctlcontrols.play()
    13.  
    14.             Else
    15.  
    16.                 frmPainel.lst_videos.SelectedIndex += 1
    17.                 MsgBox(frmPainel.lst_videos.SelectedIndex)
    18.                 url = frmPainel.lst_videos.Items.Item(frmPainel.lst_videos.SelectedIndex).ToString
    19.  
    20.                 AxWindowsMediaPlayer1.URL = url
    21.                 AxWindowsMediaPlayer1.Ctlcontrols.play()
    22.  
    23.             End If
    24.  
    25.         End If
    26.  
    27.     End Sub

    Suggestions? I'm almost sure that it has to do with the increasing of SelectedIndex by 1, but I don't understand why it works ok with some tracks and with others it just skip.

    EDIT:
    I've been trying to discover what's going on, and I went out pulling on a Listbox every playstates crossed by WMP, so therefore I could check that it skips some tracks, because the 3 don't show up, and 3 is the signal that it is playing.

    http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx



    I think I'm forgetting some condition or some other thing, don't know.

    Suggestions?
    Last edited by SirPereira; May 3rd, 2010 at 04:32 AM.

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Mar 2010
    Posts
    71

    Re: MediaPlayer skips track

    I've solved it! I put all the code in a timer, and when PlayState occurs I activated the Timer.

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