Пример #1
0
        private async void btnPlay_Click(object sender, EventArgs e)
        {
            if (this._play.CurrentStatus != MediaStatus.Stopped)
            {
                if (this._play.CurrentStatus == MediaStatus.Paused)
                {
                    // Is currently paused so start playing file and set the image to the pause image.
                    btnPlay.Image = MediaPlayer.Properties.Resources.pause;
                }
                if (this._play.CurrentStatus == MediaStatus.Playing)
                {
                    // Is currently playing a file so pause it and set the image to the play image.
                    btnPlay.Image = MediaPlayer.Properties.Resources.play;
                }

                this._play.Pause();

                return;
            }

            if (this._filePath == String.Empty || this._filePath == null)
            {
                if (openFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    this._filePath = openFileDialog1.FileName;
                }
                else
                {
                    MessageBox.Show("You must select a video file.", "Select a file", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }

            _videoSettings = LibMPlayerCommon.DiscoverFactory.Get(this._filePath, MediaPlayer.Properties.Settings.Default.MPlayerPath);
            await _videoSettings.ExecuteAsync();

            this._play.Play(this._filePath);
            lblVideoLength.Text = TimeConversion.ConvertTimeHHMMSS(_videoSettings.Length);

            btnPlay.Image = MediaPlayer.Properties.Resources.pause;

            comboBoxAudioTracks.DisplayMember = "Name";
            comboBoxAudioTracks.ValueMember   = "ID";
            comboBoxAudioTracks.DataSource    = _videoSettings.AudioTracks;


            comboBoxSubtitles.DisplayMember = "Name";
            comboBoxSubtitles.ValueMember   = "ID";
            comboBoxSubtitles.DataSource    = _videoSettings.SubtitleList;
        }
Пример #2
0
 // Sets in motions events to set this._totalTime.  Is called as soon as the video starts.
 private void LoadCurrentPlayingFileLength()
 {
     // This works even with streaming.
     Discover file = new Discover(this.currentFilePath, this._backendProgram.MPlayer);
     this._totalTime = file.Length;
 }
Пример #3
0
 // Sets in motions events to set this._totalTime.  Is called as soon as the video starts.
 private void LoadCurrentPlayingFileLength()
 {
     // This works even with streaming.
     Discover file = new Discover(this.currentFilePath);
     this._totalTime = file.Length;
     this._aspectRatio = file.AspectRatio;
 }
Пример #4
0
        private void btnPlay_Click(object sender, EventArgs e)
        {
            if (this._play.CurrentStatus != MediaStatus.Stopped)
            {
                if (this._play.CurrentStatus == MediaStatus.Paused)
                {
                    // Is currently paused so start playing file and set the image to the pause image.
                    btnPlay.Image = MediaPlayer.Properties.Resources.pause;
                }
                if (this._play.CurrentStatus == MediaStatus.Playing)
                {
                    // Is currently playing a file so pause it and set the image to the play image.
                    btnPlay.Image = MediaPlayer.Properties.Resources.play;
                }

                this._play.Pause();

                return;

            }

            if (this._filePath == String.Empty || this._filePath == null)
            {

                if (openFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    this._filePath = openFileDialog1.FileName;
                }
                else
                {
                    MessageBox.Show("You must select a video file.", "Select a file", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }

            _videoSettings = new Discover(this._filePath, MediaPlayer.Properties.Settings.Default.MPlayerPath);
            this._play.Play(this._filePath);
            lblVideoLength.Text = TimeConversion.ConvertTimeHHMMSS(_videoSettings.Length);

            btnPlay.Image = MediaPlayer.Properties.Resources.pause;

            comboBoxAudioTracks.DisplayMember = "Name";
            comboBoxAudioTracks.ValueMember = "ID";
            comboBoxAudioTracks.DataSource = _videoSettings.AudioTracks;

            comboBoxSubtitles.DisplayMember = "Name";
            comboBoxSubtitles.ValueMember = "ID";
            comboBoxSubtitles.DataSource = _videoSettings.SubtitleList;
        }