public async void TogglePlay(object sender, EventArgs arg) { if (MediaPlayer.State == MediaPlayerState.Playing) { await PlaybackController.Pause(); } else { await PlaybackController.Play(); } }
protected override void PlayInternal(bool resume) { if (PlaybackController.IsPlaying) { PlaybackController.Pause(); } MediaType type = MediaTypeResolver.DetermineType(path); ConfigData.ExternalPlayer p = configuredPlayers[type]; string args = string.Format(p.Args, path); Process.Start(p.Command, args); MarkWatched(); }
// change an image when tapping a play button private async void TapGestureRecognizer_Tapped(object sender, EventArgs e) { // editing it later isTapPlayButton = !isTapPlayButton; if (isTapPlayButton) { MyPlayButton.Source = "pausebutton.png"; await CrossMediaManager.Current.Play("http://zmp3-mp3-s1-te-zmp3-fpthn-1.zadn.vn/11779c713b35d26b8b24/992888775050630550?key=ip7LPVb1UkVmpS_F51-Fng&expires=1495601215"); CrossMediaManager.Current.PlayingChanged += Current_PlayingChanged; } else { MyPlayButton.Source = "playbutton.png"; await PlaybackController.Pause(); } }
private async void HandleNotificationActions(object sender, string action) { if (action.Equals(MediaServiceBase.ActionPlay)) { await PlaybackController.Play(); } else if (action.Equals(MediaServiceBase.ActionPause)) { await PlaybackController.Pause(); } else if (action.Equals(MediaServiceBase.ActionPrevious)) { await PlaybackController.PlayPreviousOrSeekToStart(); } else if (action.Equals(MediaServiceBase.ActionNext)) { await PlaybackController.PlayNext(); } else if (action.Equals(MediaServiceBase.ActionStop)) { await Stop(); } }
private void AMixIsPaused() { playbackController.Pause(); }
void ExecutePauseCommand(object obj) { GoToPlay = true; GoToPause = false; PlaybackController.Pause(); }
public MainViewModel() { _saveFileInfo = new FileInfo(CaptureController.SavePath); // Initialize file watcher. _fileWatcher.Path = Path.GetDirectoryName(CaptureController.SavePath); _fileWatcher.Filter = Path.GetFileName(CaptureController.SavePath); _fileWatcher.Changed += (s, e) => OnPropertyChanged(nameof(Size)); _fileWatcher.EnableRaisingEvents = true; CaptureController.StateChanged += (s, e) => CaptureState = e.State; PlaybackController.StateChanged += (s, e) => PlaybackState = e.State; CaptureCommand = new Command(() => { if (CaptureState == State.Idle) { CaptureController.Start(); } else { CaptureController.Stop(); } }, () => PlaybackState == State.Idle); CapturePauseCommand = new Command(() => { if (CaptureState == State.Running) { CaptureController.Pause(); } else { CaptureController.Resume(); } UpdatePage(); }, () => CaptureState != State.Idle); PlaybackCommand = new Command(() => { if (PlaybackState == State.Idle) { PlaybackController.Start(); } else { PlaybackController.Stop(); } UpdatePage(); }, () => CaptureState == State.Idle && File.Exists(CaptureController.SavePath)); PlaybackPauseCommand = new Command(() => { if (PlaybackState == State.Running) { PlaybackController.Pause(); } else { PlaybackController.Resume(); } UpdatePage(); }, () => PlaybackState != State.Idle); }