locked
Need Help About Video Player with my winforms RRS feed

  • Question

  • Hi every one.

    i would like to add a media player into my winforms app so i tryed with this code below.

     private void BtnParcourContact_Click(object sender, EventArgs e)
            {
                if (vdo != null)
                {
                    vdo.Stop();
                    TmVideo.Stop();
                    BtnPlay.BackgroundImage = GestionEmail.Properties.Resources.foret_dalaba;
                    trackVolume.Value = 0;
                }
                OpenFileDialog openFilDialog = new OpenFileDialog();
                openFilDialog.ShowDialog();
                openFilDialog.Title = "Select video file..";
                openFilDialog.InitialDirectory = Application.StartupPath;
                openFilDialog.DefaultExt = ".avi";
                openFilDialog.Filter = "Media Files|*.mpg;*.avi;*.wma;*.mov;*.wav;*.mp2;*.mp3|All Files|*.*";
                if (openFilDialog.FileName != "")
                {
                    FrmContact.ActiveForm.Text = openFilDialog.FileName + " - Anand Media Player";
                    vdo = new Video(openFilDialog.FileName)
                    {
                        Owner = pnlVideo
                    };
                    formSize = new Size(this.Width, this.Height);
                    pnlSize = new Size(pnlVideo.Width, pnlVideo.Height);
                    Duration = CalculateTime(vdo.Duration);
                    PlayingPosition = "0:00:00";
                    LblVideoPosition.Text = PlayingPosition + "/" + Duration;

                    trackVolume.Minimum = 0;
                    trackVolume.Maximum = Convert.ToInt32(vdo.Duration);
                }

    }

    i get error with message: video getting null value so nothing to do after because no continue from the app.

    somebody can help pleas???


    • Edited by Young Boy Wednesday, October 17, 2018 2:26 PM
    Wednesday, October 17, 2018 2:25 PM