Showing posts with label windows media player in C#. Show all posts
Showing posts with label windows media player in C#. Show all posts

Tuesday, November 20, 2012

how to check the state of media in window media player in .Net/C#


   axWindowsMediaPlayer1.PlayStateChange += new AxWMPLib._WMPOCXEvents_PlayStateChangeEventHandler(axWindowsMediaPlayer1_PlayStateChange);

  void axWindowsMediaPlayer1_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
        {
            if (axWindowsMediaPlayer1.playState == WMPLib.WMPPlayState.wmppsStopped)
            {
                 // Your code
            }
        }

Usage of Windows media player in .net


axWindowsMediaPlayer1 is default name of windows media player control name.
     axWindowsMediaPlayer1.URL = @"C:\test.wmv";

how to add windows media player in C#.net


On toolbox, right click and choose Items....

From COM Components select Windows Media Player
 You will see that Windows media player icon at the right side of left toolbox and as you will place that icon on the form windows media player will added on teh form and you will the two references in the right side references area.