Esempio n. 1
0
        private void playVideoToolStripMenuItem_Click_1(object sender, EventArgs e)
        {
            OpenFileDialog opFD = new OpenFileDialog();

            opFD.Filter = "Mp4 files(*.mp4)|*.mp4";
            if (opFD.ShowDialog() == DialogResult.OK)
            {
                elementHost1.BringToFront();
                listBox1.Items.Clear();
                path.Clear();
                listBox1.Hide();
                pictureBox1.Hide();
                sound.UnloadedBehavior = 0;
                sound.LoadedBehavior   = 0;
                sound.Source           = new Uri(opFD.FileName);
                playVideoToolStripMenuItem.BackgroundImage = null;
                playmusicToolStripMenuItem.BackgroundImage = Sisko.Properties.Resources.Violeta_SomosCanarias__2_;
                backward_btn.Hide();
                forward_btn.Hide();
                shuffle_btn.Hide();
                repeat_btn.Hide();
                movie_mode       = true;
                play_btn.Enabled = true;
                music_mode       = false;
                var tfile    = TagLib.File.Create(opFD.FileName);
                var duration = (int)tfile.Properties.Duration.TotalSeconds;
                trackBar2.Maximum = duration;
                time.Text         = Convert.ToString(duration / 60) + ":" + Convert.ToString(duration % 60);
                m = 0; s = 0;
                showtime.Enabled = false;
                show             = 0;
                songname.Text    = "----------------------------------------------------------";
                hide_playbar.Start();
                hide_upper.Start();
                t.Enabled                = true;
                movie_playing            = true;
                play_btn.BackgroundImage = Sisko.Properties.Resources.icons8_gradient_line_65;
                sound.Play();
            }
        }
Esempio n. 2
0
        internal void PlaySoundInternal(string source = null, double speed = 1.0, bool loop = false)
        {
            if (System.Windows.Threading.Dispatcher.CurrentDispatcher != _element.Dispatcher)
            {
                _element.Dispatcher.BeginInvoke((Action <string, double, bool>)PlaySoundInternal, source, speed, loop);
                return;
            }

            try
            {
                if (source == null)
                {
                    _element.Stop();
                    _element.Source = null;
                    return;
                }

                _element.Volume     = UserSettings.Default.Volume / 100;
                _element.SpeedRatio = speed;
                _element.Source     = new Uri(source, UriKind.RelativeOrAbsolute);

                _loop = loop;

                _element.Play();

                if (!_isListenerAttached)
                {
                    AttachListener();
                    _isListenerAttached = true;
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message, CommonSettings.AppName);
            }
        }
Esempio n. 3
0
 private void RestartVideo(System.Windows.Controls.MediaElement video)
 {
     video.Position = TimeSpan.Zero;
     video.Play();
 }