CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2009
    Location
    Malta (GMT +1)
    Posts
    21

    Post 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

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    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.

  3. #3
    Join Date
    Dec 2009
    Location
    Malta (GMT +1)
    Posts
    21

    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

  4. #4
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    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.

  5. #5
    Join Date
    Dec 2009
    Location
    Malta (GMT +1)
    Posts
    21

    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

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

Featured