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);}
Anushka ThilakarathnePosted Jan 4, 2008, 5:41 AM
It works successfully khan. Thank you very much.
Anushka
ArshadPosted Jan 4, 2008, 5:14 AM
Hi.first you add the window media player DLL in ur application through the ComReference.and under the button even u wrte this code.
protected void Button3_Click(object sender, EventArgs e){
WMPLib.
WindowsMediaPlayerClass wmp = new WindowsMediaPlayerClass();wmp.openPlayer(MapPath("Give ur Song Path here Example XYZ.mp3"
));}
It wil work,Wmp will open n the song will be play
Regards
Arshad Khan