Okey Namespace is clear:
using Microsoft.DirectX.AudioVideoPlayback;
Some Global Variables in Form:
Video vdo;
public string mode="play";
public string PlayingPosition, Duration;
And now in your Button or what else to open:
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.ShowDialog();
openFileDialog1.Title = "Select video file..";
openFileDialog1.InitialDirectory = Application.StartupPath;
openFileDialog1.DefaultExt = ".avi";
openFileDialog.Filter = "Media Files|*.mpg;*.avi;*.wma;*.mov;*.wav;*.mp2;*.mp3|All Files|*.*";
vdo = new Video(openFileDialog.FileName);
vdo.Owner = panel1;
panel1.Width = 700;
panel1.Height = 390;
Duration = CalculateTime(vdo.Duration);
PlayingPosition = "0:00:00";
txtStatus.Text = PlayingPosition + "/" + Duration;
vdoTrackBar.Minimum = 0;
vdoTrackBar.Maximum = Convert.ToInt32(vdo.Duration);
And in some other Button Code to Start/Pause:
if (vdo.Playing)
{
vdo.Pause();
btnPlay.Text= "Play";
}
else
{
vdo.Play();
btnPlay.Text= "Pause";
}
BTW:
Don't name variables/members or something else in your Code after Girls...
If your aren't sure how to name it, there are some Guidelines here.
The goal is to provide a consistent set of naming
conventions that results in names that make immediate sense to
developers.