/// <summary> /// Stops the playback. /// </summary> /// <remarks> /// You may need to stop or pause playing a sound when your app is paused. /// </remarks> public void Stop() { if (_player.State == PlayerState.Playing) { _player.Stop(); _streamPolicy.ReleaseFocus(AudioStreamFocusOptions.Playback, AudioStreamBehaviors.Fading, null); } }
/// <summary> /// Asynchronously stops ringing /// </summary> public void StopSound() { if (player != null) { player.Stop(); player.Unprepare(); audioStreamPolicy.ReleaseFocus(AudioStreamFocusOptions.Playback, AudioStreamBehaviors.NoResume, null); player.Dispose(); player = null; } if (audioStreamPolicy != null) { audioStreamPolicy.Dispose(); } }