-
axWindowsMediaPlayer
Ok, I saw too many posts regarding how to detect the end of a song using axWindowsMediaPlayer.
Alot say you have to watch the axWindowsMediaPlayer.status till it actually becomes "Stopped",
that is wrong... Why? What if the user presses the Stop button your application? It returns "Stopped" too, so that won't work.
axWindowsMediaPlayer.EndOfStream is still not good. But some people think it is.
Ok, so the trick is to use the axWindowsMediaPlayer.PlayStateChanged().
Basically, this will let you monitor every single state of your axWindowsMediaPlayer control.
Here is a list of all the states.
0 = Undefined
1 = Stopped (by User)
2 = Paused
3 = Playing
4 = Scan Forward
5 = Scan Backwards
6 = Buffering
7 = Waiting
8 = Media Ended
9 = Transitioning
10 = Ready
11 = Reconnecting
12 = Last
So, from that list you should know that you must use 8.
So, in the event we will do the following:
private void axWindowsMediaPlayer1_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e) {
if (e.newState == 8) {
//Your Code Here
}
}
That's basically it.
Hope this helps alot of people,
But most importantly YOU The Reader!
ClayC
-
Re: axWindowsMediaPlayer
Thanks for the info, but these forums aren't for passing on data in this manner.
Consider turning this info into an article and submit it as a Code Guru article.
-
Re: axWindowsMediaPlayer
Sure thing, I will try to find the articles etc... I love to post tutorials as it makes life easier for everyone ;)
and please do check this link: http://www.codeguru.com/forum/showthread.php?t=489275
it's something I am working on :)
Thanks for the tips,
ClayC
-
Re: axWindowsMediaPlayer
Yeah, I saw that. That fits into the product announcement forum. The forums under specific languages and/or technologies are for getting help, not for product announcements. Product announcements go into the Product Announcement forum.
-
Re: axWindowsMediaPlayer
Yeah I kinda learned that now :)
btw this tutorial now is foun on this link
http://www.codeguru.com/article-preview.php/16597