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(); } }; }
void BtnPlay_Click(object sender, RoutedEventArgs e) { if (player.IsPlaying) { player.Pause(); } else { player.Resume(); } }
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()); } } }
private void PlayPauseSimpleButton_ClickForPause(object sender, EventArgs e) { _player.Pause(); playPauseSimpleButton.Image = Properties.Resources.play; playPauseSimpleButton.Click -= PlayPauseSimpleButton_ClickForPause; playPauseSimpleButton.Click += PlayPauseSimpleButton_ClickForPlay; }
internal void Pause() { Dispatcher.Invoke(() => { player.Pause(); //IsEnabled = false; }); }
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; } } }
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; } } }
private void ButtonPauseOnClick(object sender, RoutedEventArgs e) { player.Pause(); }