|
-
May 2nd, 2010, 01:48 PM
#1
Thread Starter
Lively Member
[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:
Private Sub AxWindowsMediaPlayer1_PlayStateChange(ByVal sender As Object, ByVal e As AxWMPLib._WMPOCXEvents_PlayStateChangeEvent) Handles AxWindowsMediaPlayer1.PlayStateChange
'IF THERE ARE NO CLIPS PLAYING
If AxWindowsMediaPlayer1.playState = WMPLib.WMPPlayState.wmppsStopped Then
If frmPainel.lst_videos.SelectedIndex = (frmPainel.lst_videos.Items.Count - 1) Then
frmPainel.lst_videos.SelectedIndex = 0
url = frmPainel.lst_videos.Items.Item(frmPainel.lst_videos.SelectedIndex).ToString
AxWindowsMediaPlayer1.URL = url
AxWindowsMediaPlayer1.Ctlcontrols.play()
Else
frmPainel.lst_videos.SelectedIndex += 1
MsgBox(frmPainel.lst_videos.SelectedIndex)
url = frmPainel.lst_videos.Items.Item(frmPainel.lst_videos.SelectedIndex).ToString
AxWindowsMediaPlayer1.URL = url
AxWindowsMediaPlayer1.Ctlcontrols.play()
End If
End If
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.
-
May 3rd, 2010, 04:32 AM
#2
Thread Starter
Lively Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|