Ejemplo n.º 1
0
        public MpvVideoBar()
        {
            InitializeComponent();

            this.Resize += OnResize;

            trackBarPosition.MouseDown += (s, e) =>
            {
                dragging = true;
                mpvPlayer.Pause();

                trackBarPosition.SetValueToMousePosition(e);
            };

            trackBarPosition.MouseMove += (s, e) =>
            {
                if (!setDraggingToFalse) // while this is true this means that the mouse is no longer being held down
                {
                    if (dragging)
                    {
                        trackBarPosition.SetValueToMousePosition(e);
                    }
                }
            };

            trackBarPosition.MouseUp += (s, e) =>
            {
                setDraggingToFalse = true; // this delays the ability to tell the program that dragging is false, preventing quick clicks/drags from being unidentified
                if (playing)
                {
                    mpvPlayer.Resume();
                }
            };
        }
Ejemplo n.º 2
0
 void BtnPlay_Click(object sender, RoutedEventArgs e)
 {
     if (player.IsPlaying)
     {
         player.Pause();
     }
     else
     {
         player.Resume();
     }
 }
Ejemplo n.º 3
0
 private void btnPlayPause_Click(object sender, EventArgs e)
 {
     if (player.IsMediaLoaded)
     {
         if (isPaused)
         {
             btnPlayPause.BackgroundImage       = Image.FromFile("./resources/images/pause.png");
             btnPlayPause.BackgroundImageLayout = ImageLayout.Stretch;
             player.Resume();
             isPaused = false;
         }
         else
         {
             btnPlayPause.BackgroundImage       = Image.FromFile("./resources/images/play.png");
             btnPlayPause.BackgroundImageLayout = ImageLayout.Stretch;
             player.Pause();
             isPaused = true;
         }
     }
     else
     {
         if (!string.IsNullOrEmpty(currURL))
         {
             SetMedia(currURL, 0, GetLangValue(), GetSubValue());
         }
     }
 }
Ejemplo n.º 4
0
 private void PlayPauseSimpleButton_ClickForPause(object sender, EventArgs e)
 {
     _player.Pause();
     playPauseSimpleButton.Image  = Properties.Resources.play;
     playPauseSimpleButton.Click -= PlayPauseSimpleButton_ClickForPause;
     playPauseSimpleButton.Click += PlayPauseSimpleButton_ClickForPlay;
 }
Ejemplo n.º 5
0
 internal void Pause()
 {
     Dispatcher.Invoke(() =>
     {
         player.Pause();
         //IsEnabled = false;
     });
 }
Ejemplo n.º 6
0
 private void VideoPlayer_Click(object sender, EventArgs e)
 {
     if (player.IsMediaLoaded)
     {
         if (player.IsPlaying)
         {
             player.Pause();
             PlayIcon.Visibility = Visibility.Visible;
         }
         else
         {
             player.Resume();
             PlayIcon.Visibility = Visibility.Hidden;
         }
     }
 }
Ejemplo n.º 7
0
 private void btnPlayPause_Click(object sender, EventArgs e)
 {
     if (player.IsMediaLoaded)
     {
         if (isPaused)
         {
             btnPlayPause.BackgroundImage       = Image.FromFile("./resources/images/pause.png");
             btnPlayPause.BackgroundImageLayout = ImageLayout.Stretch;
             player.Resume();
             isPaused = false;
         }
         else
         {
             btnPlayPause.BackgroundImage       = Image.FromFile("./resources/images/play.png");
             btnPlayPause.BackgroundImageLayout = ImageLayout.Stretch;
             player.Pause();
             isPaused = true;
         }
     }
 }
Ejemplo n.º 8
0
 private void ButtonPauseOnClick(object sender, RoutedEventArgs e)
 {
     player.Pause();
 }