private async void tocarSom(string filename) { try { //var player = Plugin.SimpleAudioPlayer.CrossSimpleAudioPlayer.Current; try { if (player.IsPlaying) { player.Stop(); } else { player.Load(filename); player.Play(); } } catch (Exception ex) { player.Stop(); throw new Exception(ex.Message); } } catch (Exception ex) { await DisplayAlert("Atenção", ex.Message, "OK"); } }
public Task Stop() { _audioStreamPlayer.Stop(); _audioStreamPlayer.Dispose(); _audioStream.Dispose(); return(Task.Delay(0)); }
// Theme Sounds start public void StopSounds() { if (allSounds.IsPlaying) { allSounds.Stop(); } }
private void SoundStop01() { if (playerAlarm.IsPlaying) { playerAlarm.Stop(); } }
private void SoundStop02() { if (playerWood.IsPlaying) { playerWood.Stop(); } }
private void SoundStop03() { if (playerF1.IsPlaying) { playerF1.Stop(); } }
private async Task IntruderMode() { int timer = CommonHelper.IntruderModeTimer; for (int second = 0; second < timer; second++) { Notifications.Insert(0, new NotificationModel() { Date = DateTime.Now, Message = "You didn't say the magic word", Tag = "Error" }); if (second == 5) { PlaySound(); ShowDeniedImage = true; } await Task.Delay(500); } _player.Stop(); ShowDeniedImage = false; _intruderMode = false; await LoadData(); }
private void PlayCurrentSound() // pour que le son s'execute encore si le laser monte et descend { ISimpleAudioPlayer player = Plugin.SimpleAudioPlayer.CrossSimpleAudioPlayer.Current; player.Stop(); player.Play(); }
public void StopAreaMusic() { if (areaMusicPlayer == null) { areaMusicPlayer = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer(); } try { if (areaMusicPlayer.IsPlaying) { areaMusicPlayer.Stop(); } } catch (Exception ex) { } if (areaAmbientSoundsPlayer == null) { areaAmbientSoundsPlayer = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer(); } try { if (areaAmbientSoundsPlayer.IsPlaying) { areaAmbientSoundsPlayer.Stop(); } } catch (Exception ex) { } }
// Returns to the previous page when an area outside the popup is clicked private async void CloseAllPopup() { player.Stop(); await PopupNavigation.Instance.PopAsync(); player.Dispose(); player = null; }
protected override void OnDisappearing() { AudioPlaying = false; if (player != null) { if ((player.IsPlaying == true) && (player != null)) { player.Stop(); } } if (timer != null) { timer.StopTimer(); } BufferingAudioStatus(false); }
protected override bool OnBackButtonPressed() { if (!stl_StartMenu.IsVisible) { stl_SaveDataMenu.IsVisible = false; stl_SaveDataMenu.Opacity = 0; frm_NewUser.IsVisible = false; frm_NewUser.Scale = .1; stl_StartMenu.Opacity = 1; stl_StartMenu.IsVisible = true; return(true); } else { IntroTheme.Stop(); return(false); } }