krulz

krulz

  • NA
  • 1
  • 0

How to play WindowsMediaPlayer .

Apr 26 2007 12:47 AM
Hello everyone,

I want to open and stop the Video files in the WindowsMediaPlayer through Windows application. I am using a third party GUI software, so I wont be able to add WMPlayer control on to my application. I just need to control the WMPlayer by the code.
The below mentioned sample code is able to open the player and play the Video file. But the stop and close functionalities are not working in this.
Can U please tell me how to control the mediaplayer through code. I want to implement functionalities like 'Pause', 'Fullscreen' etc..

using WMPLib;

namespace Sample_MediaPlayer
{

public partial class Form1 : Form
{
private WindowsMediaPlayerClass wmPlayer = new WindowsMediaPlayerClass();
//private WindowsMediaPlayer wmPlayer = new WindowsMediaPlayer();

public Form1()
{
InitializeComponent();
}

private void Play_Click(object sender, EventArgs e)
{
wmPlayer.openPlayer(@"C:\SampleVideo.wmv");

}

private void Stop_Click(object sender, EventArgs e)
{
wmPlayer.close();
//wmPlayer.controls.stop();
}
}
}



- Thanks


Answers (1)