About using windows media player

Jan 4 2008 12:27 AM

Hi I am developing an application to play video files. I try to use Windows media player as a reference in my application. The following is the code I am trying to use to play the video files. it gives an exception. please help me.

Anushka

 

MediaPlayer.MediaPlayerClass pl = new MediaPlayer.MediaPlayerClass();

 

private void button1_Click(object sender, EventArgs e)

{

try

{

pl.DisplaySize = MPDisplaySizeConstants.mpDefaultSize;

pl.ShowAudioControls = true;

pl.FileName = "clock.avi";

pl.Open("clock.avi");

pl.ShowDialog(MPShowDialogConstants.mpShowDialogOptions);

pl.ShowDisplay = true;

pl.Play();

}

catch (Exception exp)

{

MessageBox.Show(exp.Message);

}

 

 


Answers (2)